201 if (h->is_klass()) { |
201 if (h->is_klass()) { |
202 klass = (Klass*) h; |
202 klass = (Klass*) h; |
203 result = JVMCIENV->get_jvmci_type(klass, JVMCI_CATCH); |
203 result = JVMCIENV->get_jvmci_type(klass, JVMCI_CATCH); |
204 } else if (h->is_method()) { |
204 } else if (h->is_method()) { |
205 Method* method = (Method*) h; |
205 Method* method = (Method*) h; |
206 methodHandle mh(method); |
206 methodHandle mh(THREAD, method); |
207 result = JVMCIENV->get_jvmci_method(method, JVMCI_CATCH); |
207 result = JVMCIENV->get_jvmci_method(mh, JVMCI_CATCH); |
208 } |
208 } |
209 jobject ref = JVMCIENV->get_jobject(result); |
209 jobject ref = JVMCIENV->get_jobject(result); |
210 record_meta_ref(ref, index); |
210 record_meta_ref(ref, index); |
211 |
211 |
212 return index; |
212 return index; |
499 JVMCIObjectArray methods = jvmci_env()->get_HotSpotCompiledCode_methods(compiled_code); |
499 JVMCIObjectArray methods = jvmci_env()->get_HotSpotCompiledCode_methods(compiled_code); |
500 if (methods.is_non_null()) { |
500 if (methods.is_non_null()) { |
501 int length = JVMCIENV->get_length(methods); |
501 int length = JVMCIENV->get_length(methods); |
502 for (int i = 0; i < length; ++i) { |
502 for (int i = 0; i < length; ++i) { |
503 JVMCIObject method_handle = JVMCIENV->get_object_at(methods, i); |
503 JVMCIObject method_handle = JVMCIENV->get_object_at(methods, i); |
504 methodHandle method = jvmci_env()->asMethod(method_handle); |
504 Method* method = jvmci_env()->asMethod(method_handle); |
505 _dependencies->assert_evol_method(method()); |
505 _dependencies->assert_evol_method(method); |
506 } |
506 } |
507 } |
507 } |
508 } |
508 } |
509 } |
509 } |
510 |
510 |
618 JVMCICompileState* compile_state = (JVMCICompileState*) (address) jvmci_env()->get_HotSpotCompiledNmethod_compileState(compiled_code); |
618 JVMCICompileState* compile_state = (JVMCICompileState*) (address) jvmci_env()->get_HotSpotCompiledNmethod_compileState(compiled_code); |
619 if (compile_state != NULL) { |
619 if (compile_state != NULL) { |
620 jvmci_env()->set_compile_state(compile_state); |
620 jvmci_env()->set_compile_state(compile_state); |
621 } |
621 } |
622 |
622 |
623 methodHandle method = jvmci_env()->asMethod(jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code)); |
623 Thread* thread = Thread::current(); |
|
624 |
|
625 methodHandle method(thread, jvmci_env()->asMethod(jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code))); |
624 jint entry_bci = jvmci_env()->get_HotSpotCompiledNmethod_entryBCI(compiled_code); |
626 jint entry_bci = jvmci_env()->get_HotSpotCompiledNmethod_entryBCI(compiled_code); |
625 bool has_unsafe_access = jvmci_env()->get_HotSpotCompiledNmethod_hasUnsafeAccess(compiled_code) == JNI_TRUE; |
627 bool has_unsafe_access = jvmci_env()->get_HotSpotCompiledNmethod_hasUnsafeAccess(compiled_code) == JNI_TRUE; |
626 jint id = jvmci_env()->get_HotSpotCompiledNmethod_id(compiled_code); |
628 jint id = jvmci_env()->get_HotSpotCompiledNmethod_id(compiled_code); |
627 if (id == -1) { |
629 if (id == -1) { |
628 // Make sure a valid compile_id is associated with every compile |
630 // Make sure a valid compile_id is associated with every compile |
629 id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci); |
631 id = CompileBroker::assign_compile_id_unlocked(thread, method, entry_bci); |
630 jvmci_env()->set_HotSpotCompiledNmethod_id(compiled_code, id); |
632 jvmci_env()->set_HotSpotCompiledNmethod_id(compiled_code, id); |
631 } |
633 } |
632 if (!jvmci_env()->isa_HotSpotNmethod(installed_code)) { |
634 if (!jvmci_env()->isa_HotSpotNmethod(installed_code)) { |
633 JVMCI_THROW_MSG_(IllegalArgumentException, "InstalledCode object must be a HotSpotNmethod when installing a HotSpotCompiledNmethod", JVMCI::ok); |
635 JVMCI_THROW_MSG_(IllegalArgumentException, "InstalledCode object must be a HotSpotNmethod when installing a HotSpotCompiledNmethod", JVMCI::ok); |
634 } |
636 } |
657 } |
659 } |
658 |
660 |
659 void CodeInstaller::initialize_fields(JVMCIObject target, JVMCIObject compiled_code, JVMCI_TRAPS) { |
661 void CodeInstaller::initialize_fields(JVMCIObject target, JVMCIObject compiled_code, JVMCI_TRAPS) { |
660 if (jvmci_env()->isa_HotSpotCompiledNmethod(compiled_code)) { |
662 if (jvmci_env()->isa_HotSpotCompiledNmethod(compiled_code)) { |
661 JVMCIObject hotspotJavaMethod = jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code); |
663 JVMCIObject hotspotJavaMethod = jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code); |
662 methodHandle method = jvmci_env()->asMethod(hotspotJavaMethod); |
664 Thread* thread = Thread::current(); |
|
665 methodHandle method(thread, jvmci_env()->asMethod(hotspotJavaMethod)); |
663 _parameter_count = method->size_of_parameters(); |
666 _parameter_count = method->size_of_parameters(); |
664 TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string()); |
667 TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string()); |
665 } else { |
668 } else { |
666 // Must be a HotSpotCompiledRuntimeStub. |
669 // Must be a HotSpotCompiledRuntimeStub. |
667 // Only used in OopMap constructor for non-product builds |
670 // Only used in OopMap constructor for non-product builds |
935 |
938 |
936 void CodeInstaller::assumption_ConcreteMethod(JVMCIObject assumption) { |
939 void CodeInstaller::assumption_ConcreteMethod(JVMCIObject assumption) { |
937 JVMCIObject impl_handle = jvmci_env()->get_Assumptions_ConcreteMethod_impl(assumption); |
940 JVMCIObject impl_handle = jvmci_env()->get_Assumptions_ConcreteMethod_impl(assumption); |
938 JVMCIObject context_handle = jvmci_env()->get_Assumptions_ConcreteMethod_context(assumption); |
941 JVMCIObject context_handle = jvmci_env()->get_Assumptions_ConcreteMethod_context(assumption); |
939 |
942 |
940 methodHandle impl = jvmci_env()->asMethod(impl_handle); |
943 Method* impl = jvmci_env()->asMethod(impl_handle); |
941 Klass* context = jvmci_env()->asKlass(context_handle); |
944 Klass* context = jvmci_env()->asKlass(context_handle); |
942 |
945 |
943 _dependencies->assert_unique_concrete_method(context, impl()); |
946 _dependencies->assert_unique_concrete_method(context, impl); |
944 } |
947 } |
945 |
948 |
946 void CodeInstaller::assumption_CallSiteTargetValue(JVMCIObject assumption, JVMCI_TRAPS) { |
949 void CodeInstaller::assumption_CallSiteTargetValue(JVMCIObject assumption, JVMCI_TRAPS) { |
947 JVMCIObject callSiteConstant = jvmci_env()->get_Assumptions_CallSiteTargetValue_callSite(assumption); |
950 JVMCIObject callSiteConstant = jvmci_env()->get_Assumptions_CallSiteTargetValue_callSite(assumption); |
948 Handle callSite = jvmci_env()->asConstant(callSiteConstant, JVMCI_CHECK); |
951 Handle callSite = jvmci_env()->asConstant(callSiteConstant, JVMCI_CHECK); |
1062 if (caller_frame.is_non_null()) { |
1065 if (caller_frame.is_non_null()) { |
1063 record_scope(pc_offset, caller_frame, scope_mode, objects, return_oop, JVMCI_CHECK); |
1066 record_scope(pc_offset, caller_frame, scope_mode, objects, return_oop, JVMCI_CHECK); |
1064 } |
1067 } |
1065 |
1068 |
1066 JVMCIObject hotspot_method = jvmci_env()->get_BytecodePosition_method(position); |
1069 JVMCIObject hotspot_method = jvmci_env()->get_BytecodePosition_method(position); |
1067 Method* method = jvmci_env()->asMethod(hotspot_method); |
1070 Thread* thread = Thread::current(); |
|
1071 methodHandle method(thread, jvmci_env()->asMethod(hotspot_method)); |
1068 jint bci = map_jvmci_bci(jvmci_env()->get_BytecodePosition_bci(position)); |
1072 jint bci = map_jvmci_bci(jvmci_env()->get_BytecodePosition_bci(position)); |
1069 if (bci == jvmci_env()->get_BytecodeFrame_BEFORE_BCI()) { |
1073 if (bci == jvmci_env()->get_BytecodeFrame_BEFORE_BCI()) { |
1070 bci = SynchronizationEntryBCI; |
1074 bci = SynchronizationEntryBCI; |
1071 } |
1075 } |
1072 |
1076 |
1075 bool reexecute = false; |
1079 bool reexecute = false; |
1076 if (frame.is_non_null()) { |
1080 if (frame.is_non_null()) { |
1077 if (bci < 0){ |
1081 if (bci < 0){ |
1078 reexecute = false; |
1082 reexecute = false; |
1079 } else { |
1083 } else { |
1080 Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci)); |
1084 Bytecodes::Code code = Bytecodes::java_code_at(method(), method->bcp_from(bci)); |
1081 reexecute = bytecode_should_reexecute(code); |
1085 reexecute = bytecode_should_reexecute(code); |
1082 if (frame.is_non_null()) { |
1086 if (frame.is_non_null()) { |
1083 reexecute = (jvmci_env()->get_BytecodeFrame_duringCall(frame) == JNI_FALSE); |
1087 reexecute = (jvmci_env()->get_BytecodeFrame_duringCall(frame) == JNI_FALSE); |
1084 } |
1088 } |
1085 } |
1089 } |