< prev index next >
src/share/vm/opto/doCall.cpp
Print this page
rev 11688 : 8162384: Performance regression: bimorphic inlining may be bypassed by type speculation
Summary: when speculation fails at a call fallback to profile data at the call site
Reviewed-by:
@@ -207,10 +207,11 @@
bool have_major_receiver = (100.*profile.receiver_prob(0) >= (float)TypeProfileMajorReceiverPercent);
ciMethod* receiver_method = NULL;
int morphism = profile.morphism();
if (speculative_receiver_type != NULL) {
+ if (!too_many_traps(caller, bci, Deoptimization::Reason_speculate_class_check)) {
// We have a speculative type, we should be able to resolve
// the call. We do that before looking at the profiling at
// this invoke because it may lead to bimorphic inlining which
// a speculative type should help us avoid.
receiver_method = callee->resolve_invoke(jvms->method()->holder(),
@@ -218,10 +219,15 @@
if (receiver_method == NULL) {
speculative_receiver_type = NULL;
} else {
morphism = 1;
}
+ } else {
+ // speculation failed before. Use profiling at the call
+ // (could allow bimorphic inlining for instance).
+ speculative_receiver_type = NULL;
+ }
}
if (receiver_method == NULL &&
(have_major_receiver || morphism == 1 ||
(morphism == 2 && UseBimorphicInlining))) {
// receiver_method = profile.method();
@@ -253,11 +259,11 @@
}
CallGenerator* miss_cg;
Deoptimization::DeoptReason reason = morphism == 2 ?
Deoptimization::Reason_bimorphic : Deoptimization::reason_class_check(speculative_receiver_type != NULL);
if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) &&
- !too_many_traps(jvms->method(), jvms->bci(), reason)
+ !too_many_traps(caller, bci, reason)
) {
// Generate uncommon trap for class check failure path
// in case of monomorphic or bimorphic virtual call site.
miss_cg = CallGenerator::for_uncommon_trap(callee, reason,
Deoptimization::Action_maybe_recompile);
< prev index next >