< prev index next >

src/hotspot/share/jvmci/jvmciRuntime.cpp

Print this page

1645   }
1646   return JVMCIENV->call_HotSpotJVMCIRuntime_isGCSupported(receiver, (int) name);
1647 }
1648 
1649 // ------------------------------------------------------------------
1650 JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
1651                                 const methodHandle& method,
1652                                 nmethodLocker& code_handle,
1653                                 int entry_bci,
1654                                 CodeOffsets* offsets,
1655                                 int orig_pc_offset,
1656                                 CodeBuffer* code_buffer,
1657                                 int frame_words,
1658                                 OopMapSet* oop_map_set,
1659                                 ExceptionHandlerTable* handler_table,
1660                                 ImplicitExceptionTable* implicit_exception_table,
1661                                 AbstractCompiler* compiler,
1662                                 DebugInformationRecorder* debug_info,
1663                                 Dependencies* dependencies,
1664                                 int compile_id,

1665                                 bool has_unsafe_access,
1666                                 bool has_wide_vector,
1667                                 JVMCIObject compiled_code,
1668                                 JVMCIObject nmethod_mirror,
1669                                 FailedSpeculation** failed_speculations,
1670                                 char* speculations,
1671                                 int speculations_len) {
1672   JVMCI_EXCEPTION_CONTEXT;
1673   nmethod* nm = NULL;
1674   int comp_level = CompLevel_full_optimization;
1675   char* failure_detail = NULL;
1676 
1677   bool install_default = JVMCIENV->get_HotSpotNmethod_isDefault(nmethod_mirror) != 0;
1678   assert(JVMCIENV->isa_HotSpotNmethod(nmethod_mirror), "must be");
1679   JVMCIObject name = JVMCIENV->get_InstalledCode_name(nmethod_mirror);
1680   const char* nmethod_mirror_name = name.is_null() ? NULL : JVMCIENV->as_utf8_string(name);
1681   int nmethod_mirror_index;
1682   if (!install_default) {
1683     // Reserve or initialize mirror slot in the oops table.
1684     OopRecorder* oop_recorder = debug_info->oop_recorder();

1742                                  debug_info, dependencies, code_buffer,
1743                                  frame_words, oop_map_set,
1744                                  handler_table, implicit_exception_table,
1745                                  compiler, comp_level, GrowableArrayView<RuntimeStub*>::EMPTY,
1746                                  speculations, speculations_len,
1747                                  nmethod_mirror_index, nmethod_mirror_name, failed_speculations);
1748 
1749 
1750       // Free codeBlobs
1751       if (nm == NULL) {
1752         // The CodeCache is full.  Print out warning and disable compilation.
1753         {
1754           MutexUnlocker ml(Compile_lock);
1755           MutexUnlocker locker(MethodCompileQueue_lock);
1756           CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
1757         }
1758         result = JVMCI::cache_full;
1759       } else {
1760         nm->set_has_unsafe_access(has_unsafe_access);
1761         nm->set_has_wide_vectors(has_wide_vector);

1762 
1763         // Record successful registration.
1764         // (Put nm into the task handle *before* publishing to the Java heap.)
1765         if (JVMCIENV->compile_state() != NULL) {
1766           JVMCIENV->compile_state()->task()->set_code(nm);
1767         }
1768 
1769         JVMCINMethodData* data = nm->jvmci_nmethod_data();
1770         assert(data != NULL, "must be");
1771         if (install_default) {
1772           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == NULL, "must be");
1773           if (entry_bci == InvocationEntryBci) {
1774             // If there is an old version we're done with it
1775             CompiledMethod* old = method->code();
1776             if (TraceMethodReplacement && old != NULL) {
1777               ResourceMark rm;
1778               char *method_name = method->name_and_sig_as_C_string();
1779               tty->print_cr("Replacing method %s", method_name);
1780             }
1781             if (old != NULL ) {

1645   }
1646   return JVMCIENV->call_HotSpotJVMCIRuntime_isGCSupported(receiver, (int) name);
1647 }
1648 
1649 // ------------------------------------------------------------------
1650 JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
1651                                 const methodHandle& method,
1652                                 nmethodLocker& code_handle,
1653                                 int entry_bci,
1654                                 CodeOffsets* offsets,
1655                                 int orig_pc_offset,
1656                                 CodeBuffer* code_buffer,
1657                                 int frame_words,
1658                                 OopMapSet* oop_map_set,
1659                                 ExceptionHandlerTable* handler_table,
1660                                 ImplicitExceptionTable* implicit_exception_table,
1661                                 AbstractCompiler* compiler,
1662                                 DebugInformationRecorder* debug_info,
1663                                 Dependencies* dependencies,
1664                                 int compile_id,
1665                                 bool has_monitors,
1666                                 bool has_unsafe_access,
1667                                 bool has_wide_vector,
1668                                 JVMCIObject compiled_code,
1669                                 JVMCIObject nmethod_mirror,
1670                                 FailedSpeculation** failed_speculations,
1671                                 char* speculations,
1672                                 int speculations_len) {
1673   JVMCI_EXCEPTION_CONTEXT;
1674   nmethod* nm = NULL;
1675   int comp_level = CompLevel_full_optimization;
1676   char* failure_detail = NULL;
1677 
1678   bool install_default = JVMCIENV->get_HotSpotNmethod_isDefault(nmethod_mirror) != 0;
1679   assert(JVMCIENV->isa_HotSpotNmethod(nmethod_mirror), "must be");
1680   JVMCIObject name = JVMCIENV->get_InstalledCode_name(nmethod_mirror);
1681   const char* nmethod_mirror_name = name.is_null() ? NULL : JVMCIENV->as_utf8_string(name);
1682   int nmethod_mirror_index;
1683   if (!install_default) {
1684     // Reserve or initialize mirror slot in the oops table.
1685     OopRecorder* oop_recorder = debug_info->oop_recorder();

1743                                  debug_info, dependencies, code_buffer,
1744                                  frame_words, oop_map_set,
1745                                  handler_table, implicit_exception_table,
1746                                  compiler, comp_level, GrowableArrayView<RuntimeStub*>::EMPTY,
1747                                  speculations, speculations_len,
1748                                  nmethod_mirror_index, nmethod_mirror_name, failed_speculations);
1749 
1750 
1751       // Free codeBlobs
1752       if (nm == NULL) {
1753         // The CodeCache is full.  Print out warning and disable compilation.
1754         {
1755           MutexUnlocker ml(Compile_lock);
1756           MutexUnlocker locker(MethodCompileQueue_lock);
1757           CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
1758         }
1759         result = JVMCI::cache_full;
1760       } else {
1761         nm->set_has_unsafe_access(has_unsafe_access);
1762         nm->set_has_wide_vectors(has_wide_vector);
1763         nm->set_has_monitors(has_monitors);
1764 
1765         // Record successful registration.
1766         // (Put nm into the task handle *before* publishing to the Java heap.)
1767         if (JVMCIENV->compile_state() != NULL) {
1768           JVMCIENV->compile_state()->task()->set_code(nm);
1769         }
1770 
1771         JVMCINMethodData* data = nm->jvmci_nmethod_data();
1772         assert(data != NULL, "must be");
1773         if (install_default) {
1774           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == NULL, "must be");
1775           if (entry_bci == InvocationEntryBci) {
1776             // If there is an old version we're done with it
1777             CompiledMethod* old = method->code();
1778             if (TraceMethodReplacement && old != NULL) {
1779               ResourceMark rm;
1780               char *method_name = method->name_and_sig_as_C_string();
1781               tty->print_cr("Replacing method %s", method_name);
1782             }
1783             if (old != NULL ) {
< prev index next >