1.1 --- a/src/share/vm/opto/doCall.cpp Mon May 09 19:45:52 2011 -0700 1.2 +++ b/src/share/vm/opto/doCall.cpp Tue May 10 00:45:03 2011 -0700 1.3 @@ -73,7 +73,8 @@ 1.4 // Note: When we get profiling during stage-1 compiles, we want to pull 1.5 // from more specific profile data which pertains to this inlining. 1.6 // Right now, ignore the information in jvms->caller(), and do method[bci]. 1.7 - ciCallProfile profile = jvms->method()->call_profile_at_bci(jvms->bci()); 1.8 + ciCallProfile profile = jvms->method()->call_profile_at_bci(jvms->bci()); 1.9 + Bytecodes::Code bytecode = jvms->method()->java_code_at_bci(jvms->bci()); 1.10 1.11 // See how many times this site has been invoked. 1.12 int site_count = profile.count(); 1.13 @@ -116,7 +117,7 @@ 1.14 // MethodHandle.invoke* are native methods which obviously don't 1.15 // have bytecodes and so normal inlining fails. 1.16 if (call_method->is_method_handle_invoke()) { 1.17 - if (jvms->method()->java_code_at_bci(jvms->bci()) != Bytecodes::_invokedynamic) { 1.18 + if (bytecode != Bytecodes::_invokedynamic) { 1.19 GraphKit kit(jvms); 1.20 Node* n = kit.argument(0); 1.21 1.22 @@ -128,14 +129,15 @@ 1.23 // Set the actually called method to have access to the class 1.24 // and signature in the MethodHandleCompiler. 1.25 method_handle->set_callee(call_method); 1.26 + method_handle->set_call_profile(&profile); 1.27 1.28 // Get an adapter for the MethodHandle. 1.29 ciMethod* target_method = method_handle->get_method_handle_adapter(); 1.30 - CallGenerator* hit_cg = NULL; 1.31 - if (target_method != NULL) 1.32 - hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 1.33 - if (hit_cg != NULL && hit_cg->is_inline()) 1.34 - return hit_cg; 1.35 + if (target_method != NULL) { 1.36 + CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 1.37 + if (hit_cg != NULL && hit_cg->is_inline()) 1.38 + return hit_cg; 1.39 + } 1.40 } 1.41 1.42 return CallGenerator::for_direct_call(call_method); 1.43 @@ -151,15 +153,16 @@ 1.44 // Set the actually called method to have access to the class 1.45 // and signature in the MethodHandleCompiler. 1.46 method_handle->set_callee(call_method); 1.47 + method_handle->set_call_profile(&profile); 1.48 1.49 // Get an adapter for the MethodHandle. 1.50 ciMethod* target_method = method_handle->get_invokedynamic_adapter(); 1.51 - CallGenerator* hit_cg = NULL; 1.52 - if (target_method != NULL) 1.53 - hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 1.54 - if (hit_cg != NULL && hit_cg->is_inline()) { 1.55 - CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); 1.56 - return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); 1.57 + if (target_method != NULL) { 1.58 + CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 1.59 + if (hit_cg != NULL && hit_cg->is_inline()) { 1.60 + CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); 1.61 + return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); 1.62 + } 1.63 } 1.64 1.65 // If something failed, generate a normal dynamic call.