244 // Look up second receiver.
245 CallGenerator* next_hit_cg = NULL;
246 ciMethod* next_receiver_method = NULL;
247 if (morphism == 2 && UseBimorphicInlining) {
248 next_receiver_method = callee->resolve_invoke(jvms->method()->holder(),
249 profile.receiver(1));
250 if (next_receiver_method != NULL) {
251 next_hit_cg = this->call_generator(next_receiver_method,
252 vtable_index, !call_does_dispatch, jvms,
253 allow_inline, prof_factor);
254 if (next_hit_cg != NULL && !next_hit_cg->is_inline() &&
255 have_major_receiver && UseOnlyInlinedBimorphic) {
256 // Skip if we can't inline second receiver's method
257 next_hit_cg = NULL;
258 }
259 }
260 }
261 CallGenerator* miss_cg;
262 Deoptimization::DeoptReason reason = morphism == 2 ?
263 Deoptimization::Reason_bimorphic :
264 Deoptimization::Reason_class_check;
265 if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) &&
266 !too_many_traps(jvms->method(), jvms->bci(), reason)
267 ) {
268 // Generate uncommon trap for class check failure path
269 // in case of monomorphic or bimorphic virtual call site.
270 miss_cg = CallGenerator::for_uncommon_trap(callee, reason,
271 Deoptimization::Action_maybe_recompile);
272 } else {
273 // Generate virtual call for class check failure path
274 // in case of polymorphic virtual call site.
275 miss_cg = CallGenerator::for_virtual_call(callee, vtable_index);
276 }
277 if (miss_cg != NULL) {
278 if (next_hit_cg != NULL) {
279 assert(speculative_receiver_type == NULL, "shouldn't end up here if we used speculation");
280 trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1));
281 // We don't need to record dependency on a receiver here and below.
282 // Whenever we inline, the dependency is added by Parse::Parse().
283 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
284 }
|
244 // Look up second receiver.
245 CallGenerator* next_hit_cg = NULL;
246 ciMethod* next_receiver_method = NULL;
247 if (morphism == 2 && UseBimorphicInlining) {
248 next_receiver_method = callee->resolve_invoke(jvms->method()->holder(),
249 profile.receiver(1));
250 if (next_receiver_method != NULL) {
251 next_hit_cg = this->call_generator(next_receiver_method,
252 vtable_index, !call_does_dispatch, jvms,
253 allow_inline, prof_factor);
254 if (next_hit_cg != NULL && !next_hit_cg->is_inline() &&
255 have_major_receiver && UseOnlyInlinedBimorphic) {
256 // Skip if we can't inline second receiver's method
257 next_hit_cg = NULL;
258 }
259 }
260 }
261 CallGenerator* miss_cg;
262 Deoptimization::DeoptReason reason = morphism == 2 ?
263 Deoptimization::Reason_bimorphic :
264 (speculative_receiver_type == NULL ? Deoptimization::Reason_class_check : Deoptimization::Reason_speculate_class_check);
265 if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) &&
266 !too_many_traps(jvms->method(), jvms->bci(), reason)
267 ) {
268 // Generate uncommon trap for class check failure path
269 // in case of monomorphic or bimorphic virtual call site.
270 miss_cg = CallGenerator::for_uncommon_trap(callee, reason,
271 Deoptimization::Action_maybe_recompile);
272 } else {
273 // Generate virtual call for class check failure path
274 // in case of polymorphic virtual call site.
275 miss_cg = CallGenerator::for_virtual_call(callee, vtable_index);
276 }
277 if (miss_cg != NULL) {
278 if (next_hit_cg != NULL) {
279 assert(speculative_receiver_type == NULL, "shouldn't end up here if we used speculation");
280 trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1));
281 // We don't need to record dependency on a receiver here and below.
282 // Whenever we inline, the dependency is added by Parse::Parse().
283 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
284 }
|