< prev index next >

src/hotspot/share/jvmci/jvmciRuntime.cpp

Print this page




1417   }
1418 }
1419 
1420 
1421 // ------------------------------------------------------------------
1422 JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
1423                                 const methodHandle& method,
1424                                 nmethod*& nm,
1425                                 int entry_bci,
1426                                 CodeOffsets* offsets,
1427                                 int orig_pc_offset,
1428                                 CodeBuffer* code_buffer,
1429                                 int frame_words,
1430                                 OopMapSet* oop_map_set,
1431                                 ExceptionHandlerTable* handler_table,
1432                                 ImplicitExceptionTable* implicit_exception_table,
1433                                 AbstractCompiler* compiler,
1434                                 DebugInformationRecorder* debug_info,
1435                                 Dependencies* dependencies,
1436                                 int compile_id,

1437                                 bool has_unsafe_access,
1438                                 bool has_wide_vector,
1439                                 JVMCIObject compiled_code,
1440                                 JVMCIObject nmethod_mirror,
1441                                 FailedSpeculation** failed_speculations,
1442                                 char* speculations,
1443                                 int speculations_len) {
1444   JVMCI_EXCEPTION_CONTEXT;
1445   nm = NULL;
1446   int comp_level = CompLevel_full_optimization;
1447   char* failure_detail = NULL;
1448 
1449   bool install_default = JVMCIENV->get_HotSpotNmethod_isDefault(nmethod_mirror) != 0;
1450   assert(JVMCIENV->isa_HotSpotNmethod(nmethod_mirror), "must be");
1451   JVMCIObject name = JVMCIENV->get_InstalledCode_name(nmethod_mirror);
1452   const char* nmethod_mirror_name = name.is_null() ? NULL : JVMCIENV->as_utf8_string(name);
1453   int nmethod_mirror_index;
1454   if (!install_default) {
1455     // Reserve or initialize mirror slot in the oops table.
1456     OopRecorder* oop_recorder = debug_info->oop_recorder();


1506                                  orig_pc_offset,
1507                                  debug_info, dependencies, code_buffer,
1508                                  frame_words, oop_map_set,
1509                                  handler_table, implicit_exception_table,
1510                                  compiler, comp_level,
1511                                  speculations, speculations_len,
1512                                  nmethod_mirror_index, nmethod_mirror_name, failed_speculations);
1513 
1514 
1515       // Free codeBlobs
1516       if (nm == NULL) {
1517         // The CodeCache is full.  Print out warning and disable compilation.
1518         {
1519           MutexUnlocker ml(Compile_lock);
1520           MutexUnlocker locker(MethodCompileQueue_lock);
1521           CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
1522         }
1523       } else {
1524         nm->set_has_unsafe_access(has_unsafe_access);
1525         nm->set_has_wide_vectors(has_wide_vector);

1526 
1527         // Record successful registration.
1528         // (Put nm into the task handle *before* publishing to the Java heap.)
1529         if (JVMCIENV->compile_state() != NULL) {
1530           JVMCIENV->compile_state()->task()->set_code(nm);
1531         }
1532 
1533         JVMCINMethodData* data = nm->jvmci_nmethod_data();
1534         assert(data != NULL, "must be");
1535         if (install_default) {
1536           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == NULL, "must be");
1537           if (entry_bci == InvocationEntryBci) {
1538             if (TieredCompilation) {
1539               // If there is an old version we're done with it
1540               CompiledMethod* old = method->code();
1541               if (TraceMethodReplacement && old != NULL) {
1542                 ResourceMark rm;
1543                 char *method_name = method->name_and_sig_as_C_string();
1544                 tty->print_cr("Replacing method %s", method_name);
1545               }




1417   }
1418 }
1419 
1420 
1421 // ------------------------------------------------------------------
1422 JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
1423                                 const methodHandle& method,
1424                                 nmethod*& nm,
1425                                 int entry_bci,
1426                                 CodeOffsets* offsets,
1427                                 int orig_pc_offset,
1428                                 CodeBuffer* code_buffer,
1429                                 int frame_words,
1430                                 OopMapSet* oop_map_set,
1431                                 ExceptionHandlerTable* handler_table,
1432                                 ImplicitExceptionTable* implicit_exception_table,
1433                                 AbstractCompiler* compiler,
1434                                 DebugInformationRecorder* debug_info,
1435                                 Dependencies* dependencies,
1436                                 int compile_id,
1437                                 bool has_monitors,
1438                                 bool has_unsafe_access,
1439                                 bool has_wide_vector,
1440                                 JVMCIObject compiled_code,
1441                                 JVMCIObject nmethod_mirror,
1442                                 FailedSpeculation** failed_speculations,
1443                                 char* speculations,
1444                                 int speculations_len) {
1445   JVMCI_EXCEPTION_CONTEXT;
1446   nm = NULL;
1447   int comp_level = CompLevel_full_optimization;
1448   char* failure_detail = NULL;
1449 
1450   bool install_default = JVMCIENV->get_HotSpotNmethod_isDefault(nmethod_mirror) != 0;
1451   assert(JVMCIENV->isa_HotSpotNmethod(nmethod_mirror), "must be");
1452   JVMCIObject name = JVMCIENV->get_InstalledCode_name(nmethod_mirror);
1453   const char* nmethod_mirror_name = name.is_null() ? NULL : JVMCIENV->as_utf8_string(name);
1454   int nmethod_mirror_index;
1455   if (!install_default) {
1456     // Reserve or initialize mirror slot in the oops table.
1457     OopRecorder* oop_recorder = debug_info->oop_recorder();


1507                                  orig_pc_offset,
1508                                  debug_info, dependencies, code_buffer,
1509                                  frame_words, oop_map_set,
1510                                  handler_table, implicit_exception_table,
1511                                  compiler, comp_level,
1512                                  speculations, speculations_len,
1513                                  nmethod_mirror_index, nmethod_mirror_name, failed_speculations);
1514 
1515 
1516       // Free codeBlobs
1517       if (nm == NULL) {
1518         // The CodeCache is full.  Print out warning and disable compilation.
1519         {
1520           MutexUnlocker ml(Compile_lock);
1521           MutexUnlocker locker(MethodCompileQueue_lock);
1522           CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
1523         }
1524       } else {
1525         nm->set_has_unsafe_access(has_unsafe_access);
1526         nm->set_has_wide_vectors(has_wide_vector);
1527         nm->set_has_monitors(has_monitors);
1528 
1529         // Record successful registration.
1530         // (Put nm into the task handle *before* publishing to the Java heap.)
1531         if (JVMCIENV->compile_state() != NULL) {
1532           JVMCIENV->compile_state()->task()->set_code(nm);
1533         }
1534 
1535         JVMCINMethodData* data = nm->jvmci_nmethod_data();
1536         assert(data != NULL, "must be");
1537         if (install_default) {
1538           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == NULL, "must be");
1539           if (entry_bci == InvocationEntryBci) {
1540             if (TieredCompilation) {
1541               // If there is an old version we're done with it
1542               CompiledMethod* old = method->code();
1543               if (TraceMethodReplacement && old != NULL) {
1544                 ResourceMark rm;
1545                 char *method_name = method->name_and_sig_as_C_string();
1546                 tty->print_cr("Replacing method %s", method_name);
1547               }


< prev index next >