src/share/vm/opto/graphKit.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/share/vm/opto/graphKit.cpp
src/share/vm/opto/graphKit.cpp
Print this page
rev 5771 : 8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
Summary: type methods shouldn't always operate on speculative part
Reviewed-by:
rev 5772 : imported patch typefixes-8027422-chris
rev 5774 : 8031752: Failed speculative optimizations should be reattempted when root of compilation is different
Summary: support for speculative traps that keep track of the root of the compilation in which a trap occurs.
Reviewed-by:
rev 5777 : 8031754: Type speculation should favor profile data from outermost inlined method
Summary: favor profile data coming from outer most method
Reviewed-by:
*** 2107,2140 ****
* @param exact_kls type from profiling
*
* @return node with improved type
*/
Node* GraphKit::record_profile_for_speculation(Node* n, ciKlass* exact_kls) {
! const TypeOopPtr* current_type = _gvn.type(n)->isa_oopptr();
assert(UseTypeSpeculation, "type speculation must be on");
! if (exact_kls != NULL &&
// nothing to improve if type is already exact
! (current_type == NULL ||
! (!current_type->klass_is_exact() &&
! (current_type->speculative() == NULL ||
! !current_type->speculative()->klass_is_exact())))) {
const TypeKlassPtr* tklass = TypeKlassPtr::make(exact_kls);
const TypeOopPtr* xtype = tklass->as_instance_type();
assert(xtype->klass_is_exact(), "Should be exact");
// Build a type with a speculative type (what we think we know
// about the type but will need a guard when we use it)
! const TypeOopPtr* spec_type = TypeOopPtr::make(TypePtr::BotPTR, Type::OffsetBot, TypeOopPtr::InstanceBot, xtype);
! // We're changing the type, we need a new cast node to carry the
! // new type. The new type depends on the control: what profiling
! // tells us is only valid from here as far as we can tell.
! Node* cast = new(C) CastPPNode(n, spec_type);
! cast->init_req(0, control());
cast = _gvn.transform(cast);
replace_in_map(n, cast);
n = cast;
}
return n;
}
/**
* Record profiling data from receiver profiling at an invoke with the
--- 2107,2154 ----
* @param exact_kls type from profiling
*
* @return node with improved type
*/
Node* GraphKit::record_profile_for_speculation(Node* n, ciKlass* exact_kls) {
! const Type* current_type = _gvn.type(n);
assert(UseTypeSpeculation, "type speculation must be on");
!
// nothing to improve if type is already exact
! bool do_klass = current_type->isa_oopptr() == NULL || !current_type->is_oopptr()->klass_is_exact();
!
! const TypeOopPtr* speculative = current_type->speculative();
!
! // If the node already has an exact speculative type keep it, unless
! // it was provided by profiling that is at a deeper inlining
! // level. Profiling at a higher inlining depth is expected to be
! // less accurate.
! if (do_klass &&
! (current_type->speculative_type() == NULL ||
! ((int)jvms()->depth()) < current_type->speculative()->inline_depth())) {
! if (exact_kls != NULL) {
const TypeKlassPtr* tklass = TypeKlassPtr::make(exact_kls);
const TypeOopPtr* xtype = tklass->as_instance_type();
assert(xtype->klass_is_exact(), "Should be exact");
+ // record the new speculative type's depth
+ speculative = xtype->with_inline_depth(jvms()->depth());
+ }
+ }
+ if (speculative != current_type->speculative()) {
// Build a type with a speculative type (what we think we know
// about the type but will need a guard when we use it)
! const TypeOopPtr* spec_type = TypeOopPtr::make(TypePtr::BotPTR, Type::OffsetBot, TypeOopPtr::InstanceBot, speculative);
! // We're changing the type, we need a new CheckCast node to carry
! // the new type. The new type depends on the control: what
! // profiling tells us is only valid from here as far as we can
! // tell.
! Node* cast = new(C) CheckCastPPNode(control(), n, current_type->remove_speculative()->join_speculative(spec_type));
cast = _gvn.transform(cast);
replace_in_map(n, cast);
n = cast;
}
+
return n;
}
/**
* Record profiling data from receiver profiling at an invoke with the
src/share/vm/opto/graphKit.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File