src/share/vm/opto/graphKit.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/graphKit.cpp Wed Jan 22 10:24:40 2014
--- new/src/share/vm/opto/graphKit.cpp Wed Jan 22 10:24:40 2014
*** 2107,2140 ****
--- 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 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())))) {
+ 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, 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());
! 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