src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/code/nmethod.cpp	Thu Jan 21 15:37:32 2010
--- new/src/share/vm/code/nmethod.cpp	Thu Jan 21 15:37:32 2010

*** 1111,1121 **** --- 1111,1120 ---- // OSR methods point to the methodOop, but the methodOop does not // point back! if (_method->code() == this) { _method->clear_code(); // Break a cycle } inc_decompile_count(); // Last chance to make a mark on the MDO _method = NULL; // Clear the method of this dead nmethod } // Make the class unloaded - i.e., change state and notify sweeper check_safepoint(); if (is_in_use()) {
*** 1171,1189 **** --- 1170,1190 ---- // Common functionality for both make_not_entrant and make_zombie bool nmethod::make_not_entrant_or_zombie(unsigned int state) { assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); // If the method is already zombie there is nothing to do if (is_zombie()) { return false; } + bool was_alive = false; // Make sure the nmethod is not flushed in case of a safepoint in code below. nmethodLocker nml(this); { + // If the method is already zombie there is nothing to do + if (is_zombie()) { + return false; + } + // invalidate osr nmethod before acquiring the patching lock since // they both acquire leaf locks and we don't want a deadlock. // This logic is equivalent to the logic below for patching the // verified entry point of regular methods. if (is_osr_method()) {
*** 1217,1226 **** --- 1218,1229 ---- flush_dependencies(NULL); } else { assert(state == not_entrant, "other cases may need to be handled differently"); } + was_alive = is_in_use(); // Read state under lock + // Change state flags.state = state; // Log the transition once log_state_change();
*** 1243,1254 **** --- 1246,1260 ---- // not_entrant only stuff if (state == not_entrant) { mark_as_seen_on_stack(); } + if (was_alive) { // It's a true state change, so mark the method as decompiled. + // Do it only for transition from alive. inc_decompile_count(); + } // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event // and it hasn't already been reported for this nmethod then report it now. // (the event may have been reported earilier if the GC marked it for unloading). if (state == zombie) {

src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File