106 107 // Special case the handling of certain common, profitable library 108 // methods. If these methods are replaced with specialized code, 109 // then we return it as the inlined version of the call. 110 // We do this before the strict f.p. check below because the 111 // intrinsics handle strict f.p. correctly. 112 if (allow_inline) { 113 cg = find_intrinsic(call_method, call_is_virtual); 114 if (cg != NULL) return cg; 115 } 116 117 // Do MethodHandle calls. 118 // NOTE: This must happen before normal inlining logic below since 119 // MethodHandle.invoke* are native methods which obviously don't 120 // have bytecodes and so normal inlining fails. 121 if (call_method->is_method_handle_invoke()) { 122 if (bytecode != Bytecodes::_invokedynamic) { 123 GraphKit kit(jvms); 124 Node* n = kit.argument(0); 125 126 if (n->Opcode() == Op_ConP) { 127 const TypeOopPtr* oop_ptr = n->bottom_type()->is_oopptr(); 128 ciObject* const_oop = oop_ptr->const_oop(); 129 ciMethodHandle* method_handle = const_oop->as_method_handle(); 130 131 // Set the callee to have access to the class and signature in 132 // the MethodHandleCompiler. 133 method_handle->set_callee(call_method); 134 method_handle->set_caller(caller); 135 method_handle->set_call_profile(&profile); 136 137 // Get an adapter for the MethodHandle. 138 ciMethod* target_method = method_handle->get_method_handle_adapter(); 139 if (target_method != NULL) { 140 CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 141 if (hit_cg != NULL && hit_cg->is_inline()) 142 return hit_cg; 143 } 144 } 145 146 return CallGenerator::for_direct_call(call_method); 147 } 148 else { 149 // Get the MethodHandle from the CallSite. 150 ciMethod* caller_method = jvms->method(); 151 ciBytecodeStream str(caller_method); 152 str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 153 ciCallSite* call_site = str.get_call_site(); 154 ciMethodHandle* method_handle = call_site->get_target(); 155 156 // Set the callee to have access to the class and signature in 157 // the MethodHandleCompiler. 158 method_handle->set_callee(call_method); 159 method_handle->set_caller(caller); 160 method_handle->set_call_profile(&profile); 161 162 // Get an adapter for the MethodHandle. 163 ciMethod* target_method = method_handle->get_invokedynamic_adapter(); 164 if (target_method != NULL) { 165 CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 166 if (hit_cg != NULL && hit_cg->is_inline()) { 167 CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); 168 return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); 169 } 170 } 171 172 // If something failed, generate a normal dynamic call. 173 return CallGenerator::for_dynamic_call(call_method); 174 } 175 } 176 177 // Do not inline strict fp into non-strict code, or the reverse 178 bool caller_method_is_strict = jvms->method()->is_strict(); 179 if( caller_method_is_strict ^ call_method->is_strict() ) { 180 allow_inline = false; | 106 107 // Special case the handling of certain common, profitable library 108 // methods. If these methods are replaced with specialized code, 109 // then we return it as the inlined version of the call. 110 // We do this before the strict f.p. check below because the 111 // intrinsics handle strict f.p. correctly. 112 if (allow_inline) { 113 cg = find_intrinsic(call_method, call_is_virtual); 114 if (cg != NULL) return cg; 115 } 116 117 // Do MethodHandle calls. 118 // NOTE: This must happen before normal inlining logic below since 119 // MethodHandle.invoke* are native methods which obviously don't 120 // have bytecodes and so normal inlining fails. 121 if (call_method->is_method_handle_invoke()) { 122 if (bytecode != Bytecodes::_invokedynamic) { 123 GraphKit kit(jvms); 124 Node* n = kit.argument(0); 125 126 CallGenerator* cg = CallGenerator::for_method_handle_inline(n, jvms, caller, call_method, profile); 127 if (cg != NULL) { 128 return cg; 129 } 130 131 return CallGenerator::for_direct_call(call_method); 132 } 133 else { 134 // Get the MethodHandle from the CallSite. 135 ciMethod* caller_method = jvms->method(); 136 ciBytecodeStream str(caller_method); 137 str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 138 ciCallSite* call_site = str.get_call_site(); 139 ciMethodHandle* method_handle = call_site->get_target(); 140 141 // Set the callee to have access to the class and signature in 142 // the MethodHandleCompiler. 143 method_handle->set_callee(call_method); 144 method_handle->set_caller(caller); 145 method_handle->set_call_profile(profile); 146 147 // Get an adapter for the MethodHandle. 148 ciMethod* target_method = method_handle->get_invokedynamic_adapter(); 149 if (target_method != NULL) { 150 CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 151 if (hit_cg != NULL && hit_cg->is_inline()) { 152 CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); 153 return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); 154 } 155 } 156 157 // If something failed, generate a normal dynamic call. 158 return CallGenerator::for_dynamic_call(call_method); 159 } 160 } 161 162 // Do not inline strict fp into non-strict code, or the reverse 163 bool caller_method_is_strict = jvms->method()->is_strict(); 164 if( caller_method_is_strict ^ call_method->is_strict() ) { 165 allow_inline = false; |