< prev index next >

src/hotspot/share/jvmci/jvmciRuntime.cpp

Print this page
rev 56252 : imported patch 8226705-v2


1503               // If there is an old version we're done with it
1504               CompiledMethod* old = method->code();
1505               if (TraceMethodReplacement && old != NULL) {
1506                 ResourceMark rm;
1507                 char *method_name = method->name_and_sig_as_C_string();
1508                 tty->print_cr("Replacing method %s", method_name);
1509               }
1510               if (old != NULL ) {
1511                 old->make_not_entrant();
1512               }
1513             }
1514 
1515             LogTarget(Info, nmethod, install) lt;
1516             if (lt.is_enabled()) {
1517               ResourceMark rm;
1518               char *method_name = method->name_and_sig_as_C_string();
1519               lt.print("Installing method (%d) %s [entry point: %p]",
1520                         comp_level, method_name, nm->entry_point());
1521             }
1522             // Allow the code to be executed


1523             method->set_code(method, nm);

1524           } else {
1525             LogTarget(Info, nmethod, install) lt;
1526             if (lt.is_enabled()) {
1527               ResourceMark rm;
1528               char *method_name = method->name_and_sig_as_C_string();
1529               lt.print("Installing osr method (%d) %s @ %d",
1530                         comp_level, method_name, entry_bci);
1531             }


1532             InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
1533           }

1534         } else {
1535           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
1536         }
1537         nm->make_in_use();
1538       }
1539       result = nm != NULL ? JVMCI::ok :JVMCI::cache_full;
1540     }
1541   }
1542 
1543   // String creation must be done outside lock
1544   if (failure_detail != NULL) {
1545     // A failure to allocate the string is silently ignored.
1546     JVMCIObject message = JVMCIENV->create_string(failure_detail, JVMCIENV);
1547     JVMCIENV->set_HotSpotCompiledNmethod_installationFailureMessage(compiled_code, message);
1548   }
1549 
1550   // JVMTI -- compiled method notification (must be done outside lock)
1551   if (nm != NULL) {
1552     nm->post_compiled_method_load_event();
1553   }
1554 
1555   return result;
1556 }


1503               // If there is an old version we're done with it
1504               CompiledMethod* old = method->code();
1505               if (TraceMethodReplacement && old != NULL) {
1506                 ResourceMark rm;
1507                 char *method_name = method->name_and_sig_as_C_string();
1508                 tty->print_cr("Replacing method %s", method_name);
1509               }
1510               if (old != NULL ) {
1511                 old->make_not_entrant();
1512               }
1513             }
1514 
1515             LogTarget(Info, nmethod, install) lt;
1516             if (lt.is_enabled()) {
1517               ResourceMark rm;
1518               char *method_name = method->name_and_sig_as_C_string();
1519               lt.print("Installing method (%d) %s [entry point: %p]",
1520                         comp_level, method_name, nm->entry_point());
1521             }
1522             // Allow the code to be executed
1523             MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
1524             if (nm->make_in_use()) {
1525               method->set_code(method, nm);
1526             }
1527           } else {
1528             LogTarget(Info, nmethod, install) lt;
1529             if (lt.is_enabled()) {
1530               ResourceMark rm;
1531               char *method_name = method->name_and_sig_as_C_string();
1532               lt.print("Installing osr method (%d) %s @ %d",
1533                         comp_level, method_name, entry_bci);
1534             }
1535             MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
1536             if (nm->make_in_use()) {
1537               InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
1538             }
1539           }
1540         } else {
1541           assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
1542         }

1543       }
1544       result = nm != NULL ? JVMCI::ok :JVMCI::cache_full;
1545     }
1546   }
1547 
1548   // String creation must be done outside lock
1549   if (failure_detail != NULL) {
1550     // A failure to allocate the string is silently ignored.
1551     JVMCIObject message = JVMCIENV->create_string(failure_detail, JVMCIENV);
1552     JVMCIENV->set_HotSpotCompiledNmethod_installationFailureMessage(compiled_code, message);
1553   }
1554 
1555   // JVMTI -- compiled method notification (must be done outside lock)
1556   if (nm != NULL) {
1557     nm->post_compiled_method_load_event();
1558   }
1559 
1560   return result;
1561 }
< prev index next >