src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/opto/compile.cpp

src/share/vm/opto/compile.cpp

Print this page
rev 5462 : 8024069: replace_in_map() should operate on parent maps
Summary: type information gets lost because replace_in_map() doesn't update parent maps
Reviewed-by:
rev 5464 : 8024070: C2 needs some form of type speculation
Summary: record unused type profile information with type system, propagate and use it.
Reviewed-by:
rev 5465 : imported patch speculative-cleanup

*** 1358,1368 **** tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,aklass,false,offset); } // During the 2nd round of IterGVN, NotNull castings are removed. // Make sure the Bottom and NotNull variants alias the same. // Also, make sure exact and non-exact variants alias the same. ! if( ptr == TypePtr::NotNull || ta->klass_is_exact() ) { tj = ta = TypeAryPtr::make(TypePtr::BotPTR,ta->ary(),ta->klass(),false,offset); } } // Oop pointers need some flattening --- 1358,1368 ---- tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,aklass,false,offset); } // During the 2nd round of IterGVN, NotNull castings are removed. // Make sure the Bottom and NotNull variants alias the same. // Also, make sure exact and non-exact variants alias the same. ! if(ptr == TypePtr::NotNull || ta->klass_is_exact() || ta->speculative() != NULL) { tj = ta = TypeAryPtr::make(TypePtr::BotPTR,ta->ary(),ta->klass(),false,offset); } } // Oop pointers need some flattening
*** 1383,1392 **** --- 1383,1395 ---- // During the 2nd round of IterGVN, NotNull castings are removed. // Make sure the Bottom and NotNull variants alias the same. // Also, make sure exact and non-exact variants alias the same. tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,offset); } + if (to->speculative() != NULL) { + tj = to = TypeInstPtr::make(to->ptr(),to->klass(),to->klass_is_exact(),to->const_oop(),to->offset(), to->instance_id()); + } // Canonicalize the holder of this field if (offset >= 0 && offset < instanceOopDesc::base_offset_in_bytes()) { // First handle header references such as a LoadKlassNode, even if the // object's klass is unloaded at compile time (4965979). if (!is_known_inst) { // Do it only for non-instance types
*** 2011,2020 **** --- 2014,2029 ---- print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2); if (failing()) return; } + // Remove the speculative part of types and clean up the graph from + // the extra CheckCastPP nodes whose only purpose is to carry + // them. Do that early so that optimizations are not disrupted by + // the extra CheckCastPP nodes. + remove_speculative_types(igvn); + // No more new expensive nodes will be added to the list from here // so keep only the actual candidates for optimizations. cleanup_expensive_nodes(igvn); // Perform escape analysis
*** 3792,3801 **** --- 3801,3846 ---- // OptimizeExpensiveOps is off. n->set_req(0, NULL); } } + // Remove the speculative part of types and clean up the graph + void Compile::remove_speculative_types(PhaseIterGVN &igvn) { + if (UseTypeSpeculation) { + Unique_Node_List tmp; + tmp.push(root()); + int modified = 0; + // Go over all CastPP nodes that carry a specultive taype, drop the + // speculative part of the type and enqueue the castPP node for an + // igvn which may optimize it out. + for (uint next = 0; next < tmp.size(); ++next) { + Node *n = tmp.at(next); + if (n->is_Type() && n->as_Type()->type()->isa_oopptr() != NULL && n->as_Type()->type()->is_oopptr()->speculative() != NULL) { + TypeNode* tn = n->as_Type(); + const TypeOopPtr* t = tn->type()->is_oopptr(); + bool in_hash = igvn.hash_delete(n); + assert(in_hash, "CastPP node should be in igvn hash table"); + tn->set_type(t->remove_speculative()); + igvn.hash_insert(n); + igvn._worklist.push(n); // give it a chance to go away + modified++; + } + uint max = n->len(); + for( uint i = 0; i < max; ++i ) { + Node *m = n->in(i); + if (not_a_node(m)) continue; + tmp.push(m); + } + } + // Drop the speculative part of all types in the igvn's type table + igvn.remove_speculative_types(); + if (modified > 0) { + igvn.optimize(); + } + } + } + // Auxiliary method to support randomized stressing/fuzzing. // // This method can be called the arbitrary number of times, with current count // as the argument. The logic allows selecting a single candidate from the // running list of candidates as follows:
src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File