180 next_hit_cg = NULL; |
180 next_hit_cg = NULL; |
181 } |
181 } |
182 } |
182 } |
183 } |
183 } |
184 CallGenerator* miss_cg; |
184 CallGenerator* miss_cg; |
|
185 Deoptimization::DeoptReason reason = (profile.morphism() == 2) ? |
|
186 Deoptimization::Reason_bimorphic : |
|
187 Deoptimization::Reason_class_check; |
185 if (( profile.morphism() == 1 || |
188 if (( profile.morphism() == 1 || |
186 (profile.morphism() == 2 && next_hit_cg != NULL) ) && |
189 (profile.morphism() == 2 && next_hit_cg != NULL) ) && |
187 |
190 !too_many_traps(jvms->method(), jvms->bci(), reason) |
188 !too_many_traps(Deoptimization::Reason_class_check) |
|
189 |
|
190 // Check only total number of traps per method to allow |
|
191 // the transition from monomorphic to bimorphic case between |
|
192 // compilations without falling into virtual call. |
|
193 // A monomorphic case may have the class_check trap flag is set |
|
194 // due to the time gap between the uncommon trap processing |
|
195 // when flags are set in MDO and the call site bytecode execution |
|
196 // in Interpreter when MDO counters are updated. |
|
197 // There was also class_check trap in monomorphic case due to |
|
198 // the bug 6225440. |
|
199 |
|
200 ) { |
191 ) { |
201 // Generate uncommon trap for class check failure path |
192 // Generate uncommon trap for class check failure path |
202 // in case of monomorphic or bimorphic virtual call site. |
193 // in case of monomorphic or bimorphic virtual call site. |
203 miss_cg = CallGenerator::for_uncommon_trap(call_method, |
194 miss_cg = CallGenerator::for_uncommon_trap(call_method, reason, |
204 Deoptimization::Reason_class_check, |
|
205 Deoptimization::Action_maybe_recompile); |
195 Deoptimization::Action_maybe_recompile); |
206 } else { |
196 } else { |
207 // Generate virtual call for class check failure path |
197 // Generate virtual call for class check failure path |
208 // in case of polymorphic virtual call site. |
198 // in case of polymorphic virtual call site. |
209 miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index); |
199 miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index); |