|
Alex Kashchenko |
f7e4c1a |
# HG changeset patch
|
|
Alex Kashchenko |
f7e4c1a |
# User roland
|
|
Alex Kashchenko |
f7e4c1a |
# Date 1469615613 -7200
|
|
Alex Kashchenko |
f7e4c1a |
# Wed Jul 27 12:33:33 2016 +0200
|
|
Alex Kashchenko |
f7e4c1a |
# Node ID fd29eff8b797daa41a68394ced7fe80c9e8c96e9
|
|
Alex Kashchenko |
f7e4c1a |
# Parent ee9bffb3bd390b2ad805c7b59d7d2ab8a68a4367
|
|
Alex Kashchenko |
f7e4c1a |
8162384, PR3122: Performance regression: bimorphic inlining may be bypassed by type speculation
|
|
Alex Kashchenko |
f7e4c1a |
Summary: when speculation fails at a call fallback to profile data at the call site
|
|
Alex Kashchenko |
f7e4c1a |
Reviewed-by: kvn
|
|
Alex Kashchenko |
f7e4c1a |
|
|
Alex Kashchenko |
f7e4c1a |
diff -r ee9bffb3bd39 -r fd29eff8b797 src/share/vm/opto/doCall.cpp
|
|
Alex Kashchenko |
f7e4c1a |
--- openjdk/hotspot/src/share/vm/opto/doCall.cpp Mon Aug 01 16:33:54 2016 +0100
|
|
Alex Kashchenko |
f7e4c1a |
+++ openjdk/hotspot/src/share/vm/opto/doCall.cpp Wed Jul 27 12:33:33 2016 +0200
|
|
Alex Kashchenko |
f7e4c1a |
@@ -205,16 +205,22 @@
|
|
Alex Kashchenko |
f7e4c1a |
|
|
Alex Kashchenko |
f7e4c1a |
int morphism = profile.morphism();
|
|
Alex Kashchenko |
f7e4c1a |
if (speculative_receiver_type != NULL) {
|
|
Alex Kashchenko |
f7e4c1a |
- // We have a speculative type, we should be able to resolve
|
|
Alex Kashchenko |
f7e4c1a |
- // the call. We do that before looking at the profiling at
|
|
Alex Kashchenko |
f7e4c1a |
- // this invoke because it may lead to bimorphic inlining which
|
|
Alex Kashchenko |
f7e4c1a |
- // a speculative type should help us avoid.
|
|
Alex Kashchenko |
f7e4c1a |
- receiver_method = callee->resolve_invoke(jvms->method()->holder(),
|
|
Alex Kashchenko |
f7e4c1a |
- speculative_receiver_type);
|
|
Alex Kashchenko |
f7e4c1a |
- if (receiver_method == NULL) {
|
|
Alex Kashchenko |
f7e4c1a |
+ if (!too_many_traps(caller, bci, Deoptimization::Reason_speculate_class_check)) {
|
|
Alex Kashchenko |
f7e4c1a |
+ // We have a speculative type, we should be able to resolve
|
|
Alex Kashchenko |
f7e4c1a |
+ // the call. We do that before looking at the profiling at
|
|
Alex Kashchenko |
f7e4c1a |
+ // this invoke because it may lead to bimorphic inlining which
|
|
Alex Kashchenko |
f7e4c1a |
+ // a speculative type should help us avoid.
|
|
Alex Kashchenko |
f7e4c1a |
+ receiver_method = callee->resolve_invoke(jvms->method()->holder(),
|
|
Alex Kashchenko |
f7e4c1a |
+ speculative_receiver_type);
|
|
Alex Kashchenko |
f7e4c1a |
+ if (receiver_method == NULL) {
|
|
Alex Kashchenko |
f7e4c1a |
+ speculative_receiver_type = NULL;
|
|
Alex Kashchenko |
f7e4c1a |
+ } else {
|
|
Alex Kashchenko |
f7e4c1a |
+ morphism = 1;
|
|
Alex Kashchenko |
f7e4c1a |
+ }
|
|
Alex Kashchenko |
f7e4c1a |
+ } else {
|
|
Alex Kashchenko |
f7e4c1a |
+ // speculation failed before. Use profiling at the call
|
|
Alex Kashchenko |
f7e4c1a |
+ // (could allow bimorphic inlining for instance).
|
|
Alex Kashchenko |
f7e4c1a |
speculative_receiver_type = NULL;
|
|
Alex Kashchenko |
f7e4c1a |
- } else {
|
|
Alex Kashchenko |
f7e4c1a |
- morphism = 1;
|
|
Alex Kashchenko |
f7e4c1a |
}
|
|
Alex Kashchenko |
f7e4c1a |
}
|
|
Alex Kashchenko |
f7e4c1a |
if (receiver_method == NULL &&
|
|
Alex Kashchenko |
f7e4c1a |
@@ -252,7 +258,7 @@
|
|
Alex Kashchenko |
f7e4c1a |
Deoptimization::Reason_bimorphic :
|
|
Alex Kashchenko |
f7e4c1a |
(speculative_receiver_type == NULL ? Deoptimization::Reason_class_check : Deoptimization::Reason_speculate_class_check);
|
|
Alex Kashchenko |
f7e4c1a |
if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) &&
|
|
Alex Kashchenko |
f7e4c1a |
- !too_many_traps(jvms->method(), jvms->bci(), reason)
|
|
Alex Kashchenko |
f7e4c1a |
+ !too_many_traps(caller, bci, reason)
|
|
Alex Kashchenko |
f7e4c1a |
) {
|
|
Alex Kashchenko |
f7e4c1a |
// Generate uncommon trap for class check failure path
|
|
Alex Kashchenko |
f7e4c1a |
// in case of monomorphic or bimorphic virtual call site.
|