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