165 vtable_index, !call_is_virtual, jvms, allow_inline, prof_factor); 166 if (hit_cg != NULL) { 167 // Look up second receiver. 168 CallGenerator* next_hit_cg = NULL; 169 ciMethod* next_receiver_method = NULL; 170 if (profile.morphism() == 2 && UseBimorphicInlining) { 171 next_receiver_method = call_method->resolve_invoke(jvms->method()->holder(), 172 profile.receiver(1)); 173 if (next_receiver_method != NULL) { 174 next_hit_cg = this->call_generator(next_receiver_method, 175 vtable_index, !call_is_virtual, jvms, 176 allow_inline, prof_factor); 177 if (next_hit_cg != NULL && !next_hit_cg->is_inline() && 178 have_major_receiver && UseOnlyInlinedBimorphic) { 179 // Skip if we can't inline second receiver's method 180 next_hit_cg = NULL; 181 } 182 } 183 } 184 CallGenerator* miss_cg; 185 if (( profile.morphism() == 1 || 186 (profile.morphism() == 2 && next_hit_cg != NULL) ) && 187 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 ) { 201 // Generate uncommon trap for class check failure path 202 // in case of monomorphic or bimorphic virtual call site. 203 miss_cg = CallGenerator::for_uncommon_trap(call_method, 204 Deoptimization::Reason_class_check, 205 Deoptimization::Action_maybe_recompile); 206 } else { 207 // Generate virtual call for class check failure path 208 // in case of polymorphic virtual call site. 209 miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index); 210 } 211 if (miss_cg != NULL) { 212 if (next_hit_cg != NULL) { 213 NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1))); 214 // We don't need to record dependency on a receiver here and below. 215 // Whenever we inline, the dependency is added by Parse::Parse(). 216 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); 217 } 218 if (miss_cg != NULL) { 219 NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count)); 220 cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); 221 if (cg != NULL) return cg; 222 } 223 } 224 } | 165 vtable_index, !call_is_virtual, jvms, allow_inline, prof_factor); 166 if (hit_cg != NULL) { 167 // Look up second receiver. 168 CallGenerator* next_hit_cg = NULL; 169 ciMethod* next_receiver_method = NULL; 170 if (profile.morphism() == 2 && UseBimorphicInlining) { 171 next_receiver_method = call_method->resolve_invoke(jvms->method()->holder(), 172 profile.receiver(1)); 173 if (next_receiver_method != NULL) { 174 next_hit_cg = this->call_generator(next_receiver_method, 175 vtable_index, !call_is_virtual, jvms, 176 allow_inline, prof_factor); 177 if (next_hit_cg != NULL && !next_hit_cg->is_inline() && 178 have_major_receiver && UseOnlyInlinedBimorphic) { 179 // Skip if we can't inline second receiver's method 180 next_hit_cg = NULL; 181 } 182 } 183 } 184 CallGenerator* miss_cg; 185 Deoptimization::DeoptReason reason = (profile.morphism() == 2) ? 186 Deoptimization::Reason_bimorphic : 187 Deoptimization::Reason_class_check; 188 if (( profile.morphism() == 1 || 189 (profile.morphism() == 2 && next_hit_cg != NULL) ) && 190 !too_many_traps(jvms->method(), jvms->bci(), reason) 191 ) { 192 // Generate uncommon trap for class check failure path 193 // in case of monomorphic or bimorphic virtual call site. 194 miss_cg = CallGenerator::for_uncommon_trap(call_method, reason, 195 Deoptimization::Action_maybe_recompile); 196 } else { 197 // Generate virtual call for class check failure path 198 // in case of polymorphic virtual call site. 199 miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index); 200 } 201 if (miss_cg != NULL) { 202 if (next_hit_cg != NULL) { 203 NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1))); 204 // We don't need to record dependency on a receiver here and below. 205 // Whenever we inline, the dependency is added by Parse::Parse(). 206 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); 207 } 208 if (miss_cg != NULL) { 209 NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count)); 210 cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); 211 if (cg != NULL) return cg; 212 } 213 } 214 } |