# HG changeset patch # User zmajo # Date 1469693975 0 # Node ID 30ef632d501d9fad8bb2b46e167d0d9c9c47c83f # Parent 1806aff6f2d10f2032778ab4027c2d576dd667e3# Parent fd448de45578c968fd32f331e19c42954dfd31ff Merge diff -r 1806aff6f2d1 -r 30ef632d501d hotspot/src/share/vm/opto/doCall.cpp --- a/hotspot/src/share/vm/opto/doCall.cpp Wed Jul 27 10:56:01 2016 -0700 +++ b/hotspot/src/share/vm/opto/doCall.cpp Thu Jul 28 08:19:35 2016 +0000 @@ -209,16 +209,22 @@ int morphism = profile.morphism(); if (speculative_receiver_type != NULL) { - // 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(), - speculative_receiver_type); - if (receiver_method == 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(), + speculative_receiver_type); + 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; - } else { - morphism = 1; } } if (receiver_method == NULL && @@ -255,7 +261,7 @@ 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.