< prev index next >

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Print this page




 617 JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) {
 618   CodeBuffer buffer("JVMCI Compiler CodeBuffer");
 619   jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
 620   OopRecorder* recorder = new OopRecorder(&_arena, true);
 621   initialize_dependencies(JNIHandles::resolve(compiled_code_obj), recorder, CHECK_OK);
 622 
 623   // Get instructions and constants CodeSections early because we need it.
 624   _instructions = buffer.insts();
 625   _constants = buffer.consts();
 626 
 627   initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
 628   JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, true, CHECK_OK);
 629   if (result != JVMCIEnv::ok) {
 630     return result;
 631   }
 632 
 633   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
 634 
 635   if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
 636     oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
 637     if (oopDesc::is_null(stubName)) {
 638       JVMCI_ERROR_OK("stub should have a name");
 639     }
 640     char* name = strdup(java_lang_String::as_utf8_string(stubName));
 641     cb = RuntimeStub::new_runtime_stub(name,
 642                                        &buffer,
 643                                        CodeOffsets::frame_never_safe,
 644                                        stack_slots,
 645                                        _debug_recorder->_oopmaps,
 646                                        false);
 647     result = JVMCIEnv::ok;
 648   } else {
 649     nmethod* nm = NULL;
 650     methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
 651     jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
 652     jint id = HotSpotCompiledNmethod::id(compiled_code);
 653     bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE;
 654     JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code);
 655     if (id == -1) {
 656       // Make sure a valid compile_id is associated with every compile
 657       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);




 617 JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) {
 618   CodeBuffer buffer("JVMCI Compiler CodeBuffer");
 619   jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
 620   OopRecorder* recorder = new OopRecorder(&_arena, true);
 621   initialize_dependencies(JNIHandles::resolve(compiled_code_obj), recorder, CHECK_OK);
 622 
 623   // Get instructions and constants CodeSections early because we need it.
 624   _instructions = buffer.insts();
 625   _constants = buffer.consts();
 626 
 627   initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
 628   JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, true, CHECK_OK);
 629   if (result != JVMCIEnv::ok) {
 630     return result;
 631   }
 632 
 633   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
 634 
 635   if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
 636     oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
 637     if (stubName == NULL) {
 638       JVMCI_ERROR_OK("stub should have a name");
 639     }
 640     char* name = strdup(java_lang_String::as_utf8_string(stubName));
 641     cb = RuntimeStub::new_runtime_stub(name,
 642                                        &buffer,
 643                                        CodeOffsets::frame_never_safe,
 644                                        stack_slots,
 645                                        _debug_recorder->_oopmaps,
 646                                        false);
 647     result = JVMCIEnv::ok;
 648   } else {
 649     nmethod* nm = NULL;
 650     methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
 651     jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
 652     jint id = HotSpotCompiledNmethod::id(compiled_code);
 653     bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE;
 654     JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code);
 655     if (id == -1) {
 656       // Make sure a valid compile_id is associated with every compile
 657       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);


< prev index next >