< prev index next >

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Print this page

 524 
 525     Thread* thread = Thread::current();
 526 
 527     methodHandle method(thread, jvmci_env()->asMethod(jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code)));
 528     jint entry_bci = jvmci_env()->get_HotSpotCompiledNmethod_entryBCI(compiled_code);
 529     bool has_unsafe_access = jvmci_env()->get_HotSpotCompiledNmethod_hasUnsafeAccess(compiled_code) == JNI_TRUE;
 530     jint id = jvmci_env()->get_HotSpotCompiledNmethod_id(compiled_code);
 531     if (id == -1) {
 532       // Make sure a valid compile_id is associated with every compile
 533       id = CompileBroker::assign_compile_id_unlocked(thread, method, entry_bci);
 534       jvmci_env()->set_HotSpotCompiledNmethod_id(compiled_code, id);
 535     }
 536     if (!jvmci_env()->isa_HotSpotNmethod(installed_code)) {
 537       JVMCI_THROW_MSG_(IllegalArgumentException, "InstalledCode object must be a HotSpotNmethod when installing a HotSpotCompiledNmethod", JVMCI::ok);
 538     }
 539 
 540     JVMCIObject mirror = installed_code;
 541     result = runtime()->register_method(jvmci_env(), method, nmethod_handle, entry_bci, &_offsets, _orig_pc_offset, &buffer,
 542                                         stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table,
 543                                         compiler, _debug_recorder, _dependencies, id,
 544                                         has_unsafe_access, _has_wide_vector, compiled_code, mirror,
 545                                         failed_speculations, speculations, speculations_len);
 546     if (result == JVMCI::ok) {
 547       nmethod* nm = nmethod_handle.code()->as_nmethod_or_null();
 548       cb = nm;
 549       if (compile_state == NULL) {
 550         // This compile didn't come through the CompileBroker so perform the printing here
 551         DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler);
 552         nm->maybe_print_nmethod(directive);
 553         DirectivesStack::release(directive);
 554       }
 555     }
 556   }
 557 
 558   if (cb != NULL) {
 559     // Make sure the pre-calculated constants section size was correct.
 560     guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size);
 561   }
 562   return result;
 563 }
 564 

 986     if (bci < 0){
 987        reexecute = false;
 988     } else {
 989       Bytecodes::Code code = Bytecodes::java_code_at(method(), method->bcp_from(bci));
 990       reexecute = bytecode_should_reexecute(code);
 991       if (frame.is_non_null()) {
 992         reexecute = (jvmci_env()->get_BytecodeFrame_duringCall(frame) == JNI_FALSE);
 993       }
 994     }
 995   }
 996 
 997   DebugToken* locals_token = NULL;
 998   DebugToken* expressions_token = NULL;
 999   DebugToken* monitors_token = NULL;
1000   bool throw_exception = false;
1001 
1002   if (frame.is_non_null()) {
1003     jint local_count = jvmci_env()->get_BytecodeFrame_numLocals(frame);
1004     jint expression_count = jvmci_env()->get_BytecodeFrame_numStack(frame);
1005     jint monitor_count = jvmci_env()->get_BytecodeFrame_numLocks(frame);



1006     JVMCIObjectArray values = jvmci_env()->get_BytecodeFrame_values(frame);
1007     JVMCIObjectArray slotKinds = jvmci_env()->get_BytecodeFrame_slotKinds(frame);
1008 
1009     if (values.is_null() || slotKinds.is_null()) {
1010       JVMCI_THROW(NullPointerException);
1011     }
1012     if (local_count + expression_count + monitor_count != JVMCIENV->get_length(values)) {
1013       JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", JVMCIENV->get_length(values), local_count, expression_count, monitor_count);
1014     }
1015     if (local_count + expression_count != JVMCIENV->get_length(slotKinds)) {
1016       JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", JVMCIENV->get_length(slotKinds), local_count, expression_count);
1017     }
1018 
1019     GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
1020     GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
1021     GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
1022 
1023     JVMCI_event_2("Scope at bci %d with %d values", bci, JVMCIENV->get_length(values));
1024     JVMCI_event_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
1025 

 524 
 525     Thread* thread = Thread::current();
 526 
 527     methodHandle method(thread, jvmci_env()->asMethod(jvmci_env()->get_HotSpotCompiledNmethod_method(compiled_code)));
 528     jint entry_bci = jvmci_env()->get_HotSpotCompiledNmethod_entryBCI(compiled_code);
 529     bool has_unsafe_access = jvmci_env()->get_HotSpotCompiledNmethod_hasUnsafeAccess(compiled_code) == JNI_TRUE;
 530     jint id = jvmci_env()->get_HotSpotCompiledNmethod_id(compiled_code);
 531     if (id == -1) {
 532       // Make sure a valid compile_id is associated with every compile
 533       id = CompileBroker::assign_compile_id_unlocked(thread, method, entry_bci);
 534       jvmci_env()->set_HotSpotCompiledNmethod_id(compiled_code, id);
 535     }
 536     if (!jvmci_env()->isa_HotSpotNmethod(installed_code)) {
 537       JVMCI_THROW_MSG_(IllegalArgumentException, "InstalledCode object must be a HotSpotNmethod when installing a HotSpotCompiledNmethod", JVMCI::ok);
 538     }
 539 
 540     JVMCIObject mirror = installed_code;
 541     result = runtime()->register_method(jvmci_env(), method, nmethod_handle, entry_bci, &_offsets, _orig_pc_offset, &buffer,
 542                                         stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table,
 543                                         compiler, _debug_recorder, _dependencies, id,
 544                                         _has_monitors, has_unsafe_access, _has_wide_vector, compiled_code, mirror,
 545                                         failed_speculations, speculations, speculations_len);
 546     if (result == JVMCI::ok) {
 547       nmethod* nm = nmethod_handle.code()->as_nmethod_or_null();
 548       cb = nm;
 549       if (compile_state == NULL) {
 550         // This compile didn't come through the CompileBroker so perform the printing here
 551         DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler);
 552         nm->maybe_print_nmethod(directive);
 553         DirectivesStack::release(directive);
 554       }
 555     }
 556   }
 557 
 558   if (cb != NULL) {
 559     // Make sure the pre-calculated constants section size was correct.
 560     guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size);
 561   }
 562   return result;
 563 }
 564 

 986     if (bci < 0){
 987        reexecute = false;
 988     } else {
 989       Bytecodes::Code code = Bytecodes::java_code_at(method(), method->bcp_from(bci));
 990       reexecute = bytecode_should_reexecute(code);
 991       if (frame.is_non_null()) {
 992         reexecute = (jvmci_env()->get_BytecodeFrame_duringCall(frame) == JNI_FALSE);
 993       }
 994     }
 995   }
 996 
 997   DebugToken* locals_token = NULL;
 998   DebugToken* expressions_token = NULL;
 999   DebugToken* monitors_token = NULL;
1000   bool throw_exception = false;
1001 
1002   if (frame.is_non_null()) {
1003     jint local_count = jvmci_env()->get_BytecodeFrame_numLocals(frame);
1004     jint expression_count = jvmci_env()->get_BytecodeFrame_numStack(frame);
1005     jint monitor_count = jvmci_env()->get_BytecodeFrame_numLocks(frame);
1006     if (monitor_count > 0 && !_has_monitors) {
1007       _has_monitors = true;
1008     }
1009     JVMCIObjectArray values = jvmci_env()->get_BytecodeFrame_values(frame);
1010     JVMCIObjectArray slotKinds = jvmci_env()->get_BytecodeFrame_slotKinds(frame);
1011 
1012     if (values.is_null() || slotKinds.is_null()) {
1013       JVMCI_THROW(NullPointerException);
1014     }
1015     if (local_count + expression_count + monitor_count != JVMCIENV->get_length(values)) {
1016       JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", JVMCIENV->get_length(values), local_count, expression_count, monitor_count);
1017     }
1018     if (local_count + expression_count != JVMCIENV->get_length(slotKinds)) {
1019       JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", JVMCIENV->get_length(slotKinds), local_count, expression_count);
1020     }
1021 
1022     GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
1023     GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
1024     GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
1025 
1026     JVMCI_event_2("Scope at bci %d with %d values", bci, JVMCIENV->get_length(values));
1027     JVMCI_event_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
1028 
< prev index next >