< prev index next >

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Print this page




 623     }
 624 
 625     methodHandle method = jvmci_env()->asMethod(jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code));
 626     jint entry_bci = jvmci_env()->get_HotSpotCompiledNmethod_entryBCI(compiled_code);
 627     bool has_unsafe_access = jvmci_env()->get_HotSpotCompiledNmethod_hasUnsafeAccess(compiled_code) == JNI_TRUE;
 628     jint id = jvmci_env()->get_HotSpotCompiledNmethod_id(compiled_code);
 629     if (id == -1) {
 630       // Make sure a valid compile_id is associated with every compile
 631       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
 632       jvmci_env()->set_HotSpotCompiledNmethod_id(compiled_code, id);
 633     }
 634     if (!jvmci_env()->isa_HotSpotNmethod(installed_code)) {
 635       JVMCI_THROW_MSG_(IllegalArgumentException, "InstalledCode object must be a HotSpotNmethod when installing a HotSpotCompiledNmethod", JVMCI::ok);
 636     }
 637 
 638     JVMCIObject mirror = installed_code;
 639     nmethod* nm = NULL;
 640     result = runtime()->register_method(jvmci_env(), method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer,
 641                                         stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table,
 642                                         compiler, _debug_recorder, _dependencies, id,
 643                                         has_unsafe_access, _has_wide_vector, compiled_code, mirror,
 644                                         failed_speculations, speculations, speculations_len);
 645     cb = nm->as_codeblob_or_null();
 646     if (nm != NULL && compile_state == NULL) {
 647       DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler);
 648       bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption;
 649       if (!printnmethods && (PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers)) {
 650         nm->print_nmethod(printnmethods);
 651       }
 652       DirectivesStack::release(directive);
 653     }
 654   }
 655 
 656   if (cb != NULL) {
 657     // Make sure the pre-calculated constants section size was correct.
 658     guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size);
 659   }
 660   return result;
 661 }
 662 
 663 void CodeInstaller::initialize_fields(JVMCIObject target, JVMCIObject compiled_code, JVMCI_TRAPS) {


1081     if (bci < 0){
1082        reexecute = false;
1083     } else {
1084       Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
1085       reexecute = bytecode_should_reexecute(code);
1086       if (frame.is_non_null()) {
1087         reexecute = (jvmci_env()->get_BytecodeFrame_duringCall(frame) == JNI_FALSE);
1088       }
1089     }
1090   }
1091 
1092   DebugToken* locals_token = NULL;
1093   DebugToken* expressions_token = NULL;
1094   DebugToken* monitors_token = NULL;
1095   bool throw_exception = false;
1096 
1097   if (frame.is_non_null()) {
1098     jint local_count = jvmci_env()->get_BytecodeFrame_numLocals(frame);
1099     jint expression_count = jvmci_env()->get_BytecodeFrame_numStack(frame);
1100     jint monitor_count = jvmci_env()->get_BytecodeFrame_numLocks(frame);



1101     JVMCIObjectArray values = jvmci_env()->get_BytecodeFrame_values(frame);
1102     JVMCIObjectArray slotKinds = jvmci_env()->get_BytecodeFrame_slotKinds(frame);
1103 
1104     if (values.is_null() || slotKinds.is_null()) {
1105       JVMCI_THROW(NullPointerException);
1106     }
1107     if (local_count + expression_count + monitor_count != JVMCIENV->get_length(values)) {
1108       JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", JVMCIENV->get_length(values), local_count, expression_count, monitor_count);
1109     }
1110     if (local_count + expression_count != JVMCIENV->get_length(slotKinds)) {
1111       JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", JVMCIENV->get_length(slotKinds), local_count, expression_count);
1112     }
1113 
1114     GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
1115     GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
1116     GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
1117 
1118     TRACE_jvmci_2("Scope at bci %d with %d values", bci, JVMCIENV->get_length(values));
1119     TRACE_jvmci_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
1120 




 623     }
 624 
 625     methodHandle method = jvmci_env()->asMethod(jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code));
 626     jint entry_bci = jvmci_env()->get_HotSpotCompiledNmethod_entryBCI(compiled_code);
 627     bool has_unsafe_access = jvmci_env()->get_HotSpotCompiledNmethod_hasUnsafeAccess(compiled_code) == JNI_TRUE;
 628     jint id = jvmci_env()->get_HotSpotCompiledNmethod_id(compiled_code);
 629     if (id == -1) {
 630       // Make sure a valid compile_id is associated with every compile
 631       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
 632       jvmci_env()->set_HotSpotCompiledNmethod_id(compiled_code, id);
 633     }
 634     if (!jvmci_env()->isa_HotSpotNmethod(installed_code)) {
 635       JVMCI_THROW_MSG_(IllegalArgumentException, "InstalledCode object must be a HotSpotNmethod when installing a HotSpotCompiledNmethod", JVMCI::ok);
 636     }
 637 
 638     JVMCIObject mirror = installed_code;
 639     nmethod* nm = NULL;
 640     result = runtime()->register_method(jvmci_env(), method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer,
 641                                         stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table,
 642                                         compiler, _debug_recorder, _dependencies, id,
 643                                         _has_monitors, has_unsafe_access, _has_wide_vector, compiled_code, mirror,
 644                                         failed_speculations, speculations, speculations_len);
 645     cb = nm->as_codeblob_or_null();
 646     if (nm != NULL && compile_state == NULL) {
 647       DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler);
 648       bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption;
 649       if (!printnmethods && (PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers)) {
 650         nm->print_nmethod(printnmethods);
 651       }
 652       DirectivesStack::release(directive);
 653     }
 654   }
 655 
 656   if (cb != NULL) {
 657     // Make sure the pre-calculated constants section size was correct.
 658     guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size);
 659   }
 660   return result;
 661 }
 662 
 663 void CodeInstaller::initialize_fields(JVMCIObject target, JVMCIObject compiled_code, JVMCI_TRAPS) {


1081     if (bci < 0){
1082        reexecute = false;
1083     } else {
1084       Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
1085       reexecute = bytecode_should_reexecute(code);
1086       if (frame.is_non_null()) {
1087         reexecute = (jvmci_env()->get_BytecodeFrame_duringCall(frame) == JNI_FALSE);
1088       }
1089     }
1090   }
1091 
1092   DebugToken* locals_token = NULL;
1093   DebugToken* expressions_token = NULL;
1094   DebugToken* monitors_token = NULL;
1095   bool throw_exception = false;
1096 
1097   if (frame.is_non_null()) {
1098     jint local_count = jvmci_env()->get_BytecodeFrame_numLocals(frame);
1099     jint expression_count = jvmci_env()->get_BytecodeFrame_numStack(frame);
1100     jint monitor_count = jvmci_env()->get_BytecodeFrame_numLocks(frame);
1101     if (monitor_count > 0 && !_has_monitors) {
1102       _has_monitors = true;
1103     }
1104     JVMCIObjectArray values = jvmci_env()->get_BytecodeFrame_values(frame);
1105     JVMCIObjectArray slotKinds = jvmci_env()->get_BytecodeFrame_slotKinds(frame);
1106 
1107     if (values.is_null() || slotKinds.is_null()) {
1108       JVMCI_THROW(NullPointerException);
1109     }
1110     if (local_count + expression_count + monitor_count != JVMCIENV->get_length(values)) {
1111       JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", JVMCIENV->get_length(values), local_count, expression_count, monitor_count);
1112     }
1113     if (local_count + expression_count != JVMCIENV->get_length(slotKinds)) {
1114       JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", JVMCIENV->get_length(slotKinds), local_count, expression_count);
1115     }
1116 
1117     GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
1118     GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
1119     GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
1120 
1121     TRACE_jvmci_2("Scope at bci %d with %d values", bci, JVMCIENV->get_length(values));
1122     TRACE_jvmci_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
1123 


< prev index next >