src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/share/jvmci

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Print this page




 583 JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) {
 584   CodeBuffer buffer("JVMCI Compiler CodeBuffer");
 585   jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
 586   OopRecorder* recorder = new OopRecorder(&_arena, true);
 587   initialize_dependencies(JNIHandles::resolve(compiled_code_obj), recorder, CHECK_OK);
 588 
 589   // Get instructions and constants CodeSections early because we need it.
 590   _instructions = buffer.insts();
 591   _constants = buffer.consts();
 592 
 593   initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
 594   JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, true, CHECK_OK);
 595   if (result != JVMCIEnv::ok) {
 596     return result;
 597   }
 598 
 599   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
 600 
 601   if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
 602     oop stubName = HotSpotCompiledCode::name(compiled_code_obj);



 603     char* name = strdup(java_lang_String::as_utf8_string(stubName));
 604     cb = RuntimeStub::new_runtime_stub(name,
 605                                        &buffer,
 606                                        CodeOffsets::frame_never_safe,
 607                                        stack_slots,
 608                                        _debug_recorder->_oopmaps,
 609                                        false);
 610     result = JVMCIEnv::ok;
 611   } else {
 612     nmethod* nm = NULL;
 613     methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
 614     jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
 615     jint id = HotSpotCompiledNmethod::id(compiled_code);
 616     bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE;
 617     JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code);
 618     if (id == -1) {
 619       // Make sure a valid compile_id is associated with every compile
 620       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
 621     }
 622     result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer,




 583 JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) {
 584   CodeBuffer buffer("JVMCI Compiler CodeBuffer");
 585   jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
 586   OopRecorder* recorder = new OopRecorder(&_arena, true);
 587   initialize_dependencies(JNIHandles::resolve(compiled_code_obj), recorder, CHECK_OK);
 588 
 589   // Get instructions and constants CodeSections early because we need it.
 590   _instructions = buffer.insts();
 591   _constants = buffer.consts();
 592 
 593   initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
 594   JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, true, CHECK_OK);
 595   if (result != JVMCIEnv::ok) {
 596     return result;
 597   }
 598 
 599   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
 600 
 601   if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
 602     oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
 603     if (oopDesc::is_null(stubName)) {
 604       JVMCI_ERROR_OK("stub should have a name");
 605     }
 606     char* name = strdup(java_lang_String::as_utf8_string(stubName));
 607     cb = RuntimeStub::new_runtime_stub(name,
 608                                        &buffer,
 609                                        CodeOffsets::frame_never_safe,
 610                                        stack_slots,
 611                                        _debug_recorder->_oopmaps,
 612                                        false);
 613     result = JVMCIEnv::ok;
 614   } else {
 615     nmethod* nm = NULL;
 616     methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
 617     jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
 618     jint id = HotSpotCompiledNmethod::id(compiled_code);
 619     bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE;
 620     JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code);
 621     if (id == -1) {
 622       // Make sure a valid compile_id is associated with every compile
 623       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
 624     }
 625     result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer,


src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File