src/share/vm/opto/doCall.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893268 Sdiff src/share/vm/opto

src/share/vm/opto/doCall.cpp

Print this page
rev 1081 : imported patch indy-cleanup-6893081.patch
rev 1082 : imported patch indy.compiler.patch
rev 1083 : [mq]: indy.compiler.inline.patch


 207             miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index);
 208           }
 209           if (miss_cg != NULL) {
 210             if (next_hit_cg != NULL) {
 211               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
 212               // We don't need to record dependency on a receiver here and below.
 213               // Whenever we inline, the dependency is added by Parse::Parse().
 214               miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
 215             }
 216             if (miss_cg != NULL) {
 217               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
 218               cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
 219               if (cg != NULL)  return cg;
 220             }
 221           }
 222         }
 223       }
 224     }
 225   }
 226 



















































 227   // There was no special inlining tactic, or it bailed out.
 228   // Use a more generic tactic, like a simple call.
 229   if (call_is_virtual) {
 230     return CallGenerator::for_virtual_call(call_method, vtable_index);
 231   } else if (call_method->is_method_handle_invoke()) {
 232     if (jvms->method()->java_code_at_bci(jvms->bci()) == Bytecodes::_invokedynamic)
 233       return CallGenerator::for_dynamic_call(call_method);
 234     else
 235       // %%% if the target MH is a compile-time constant, we should try to inline it
 236       return CallGenerator::for_direct_call(call_method);
 237   } else {
 238     // Class Hierarchy Analysis or Type Profile reveals a unique target,
 239     // or it is a static or special call.
 240     return CallGenerator::for_direct_call(call_method, should_delay_inlining(call_method, jvms));
 241   }
 242 }
 243 
 244 // Return true for methods that shouldn't be inlined early so that
 245 // they are easier to analyze and optimize as intrinsics.
 246 bool Compile::should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
 247   if (has_stringbuilder()) {
 248 
 249     if ((call_method->holder() == C->env()->StringBuilder_klass() ||
 250          call_method->holder() == C->env()->StringBuffer_klass()) &&
 251         (jvms->method()->holder() == C->env()->StringBuilder_klass() ||
 252          jvms->method()->holder() == C->env()->StringBuffer_klass())) {
 253       // Delay SB calls only when called from non-SB code
 254       return false;
 255     }
 256 




 207             miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index);
 208           }
 209           if (miss_cg != NULL) {
 210             if (next_hit_cg != NULL) {
 211               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
 212               // We don't need to record dependency on a receiver here and below.
 213               // Whenever we inline, the dependency is added by Parse::Parse().
 214               miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
 215             }
 216             if (miss_cg != NULL) {
 217               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
 218               cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
 219               if (cg != NULL)  return cg;
 220             }
 221           }
 222         }
 223       }
 224     }
 225   }
 226 
 227   // Do MethodHandle calls.
 228   if (call_method->is_method_handle_invoke()) {
 229     if (jvms->method()->java_code_at_bci(jvms->bci()) != Bytecodes::_invokedynamic) {
 230       GraphKit kit(jvms);
 231       Node* n = kit.argument(0);
 232 
 233       if (n->Opcode() == Op_ConP) {
 234         const TypeOopPtr* oop_ptr = n->bottom_type()->is_oopptr();
 235         ciObject* const_oop = oop_ptr->const_oop();
 236         ciMethodHandle* method_handle = const_oop->as_method_handle();
 237 
 238         // Set the actually called method to have access to the class
 239         // and signature in the MethodHandleCompiler.
 240         method_handle->set_callee(call_method);
 241 
 242         // Get an adapter for the MethodHandle.
 243         ciMethod* target_method = method_handle->get_method_handle_adapter();
 244 
 245         CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
 246         if (hit_cg != NULL && hit_cg->is_inline())
 247           return hit_cg;
 248       }
 249 
 250       return CallGenerator::for_direct_call(call_method);
 251     }
 252     else {
 253       // Get the MethodHandle from the CallSite.
 254       ciMethod* caller_method = jvms->method();
 255       ciBytecodeStream str(caller_method);
 256       str.force_bci(jvms->bci());  // Set the stream to the invokedynamic bci.
 257       ciCallSite*     call_site     = str.get_call_site();
 258       ciMethodHandle* method_handle = call_site->get_target();
 259 
 260       // Set the actually called method to have access to the class
 261       // and signature in the MethodHandleCompiler.
 262       method_handle->set_callee(call_method);
 263 
 264       // Get an adapter for the MethodHandle.
 265       ciMethod* target_method = method_handle->get_invokedynamic_adapter();
 266 
 267       CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
 268       if (hit_cg != NULL && hit_cg->is_inline()) {
 269         CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method);
 270         return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor);
 271       }
 272 
 273       // If something failed, generate a normal dynamic call.
 274       return CallGenerator::for_dynamic_call(call_method);
 275     }
 276   }
 277 
 278   // There was no special inlining tactic, or it bailed out.
 279   // Use a more generic tactic, like a simple call.
 280   if (call_is_virtual) {
 281     return CallGenerator::for_virtual_call(call_method, vtable_index);






 282   } else {
 283     // Class Hierarchy Analysis or Type Profile reveals a unique target,
 284     // or it is a static or special call.
 285     return CallGenerator::for_direct_call(call_method, should_delay_inlining(call_method, jvms));
 286   }
 287 }
 288 
 289 // Return true for methods that shouldn't be inlined early so that
 290 // they are easier to analyze and optimize as intrinsics.
 291 bool Compile::should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
 292   if (has_stringbuilder()) {
 293 
 294     if ((call_method->holder() == C->env()->StringBuilder_klass() ||
 295          call_method->holder() == C->env()->StringBuffer_klass()) &&
 296         (jvms->method()->holder() == C->env()->StringBuilder_klass() ||
 297          jvms->method()->holder() == C->env()->StringBuffer_klass())) {
 298       // Delay SB calls only when called from non-SB code
 299       return false;
 300     }
 301 


src/share/vm/opto/doCall.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File