431 _lock_count = 0; |
431 _lock_count = 0; |
432 _stack_traversal_mark = 0; |
432 _stack_traversal_mark = 0; |
433 _unload_reported = false; // jvmti state |
433 _unload_reported = false; // jvmti state |
434 |
434 |
435 NOT_PRODUCT(_has_debug_info = false); |
435 NOT_PRODUCT(_has_debug_info = false); |
|
436 #ifdef ASSERT |
|
437 _oops_are_stale = false; |
|
438 #endif |
|
439 |
436 _oops_do_mark_link = NULL; |
440 _oops_do_mark_link = NULL; |
437 _jmethod_id = NULL; |
441 _jmethod_id = NULL; |
438 _osr_link = NULL; |
442 _osr_link = NULL; |
439 _scavenge_root_link = NULL; |
443 _scavenge_root_link = NULL; |
440 _scavenge_root_state = 0; |
444 _scavenge_root_state = 0; |
1228 |
1232 |
1229 // Common functionality for both make_not_entrant and make_zombie |
1233 // Common functionality for both make_not_entrant and make_zombie |
1230 bool nmethod::make_not_entrant_or_zombie(unsigned int state) { |
1234 bool nmethod::make_not_entrant_or_zombie(unsigned int state) { |
1231 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); |
1235 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); |
1232 |
1236 |
1233 bool was_alive = false; |
|
1234 |
|
1235 // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below. |
1237 // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below. |
1236 nmethodLocker nml(this); |
1238 nmethodLocker nml(this); |
1237 methodHandle the_method(method()); |
1239 methodHandle the_method(method()); |
|
1240 No_Safepoint_Verifier nsv; |
1238 |
1241 |
1239 { |
1242 { |
1240 // If the method is already zombie there is nothing to do |
1243 // If the method is already zombie there is nothing to do |
1241 if (is_zombie()) { |
1244 if (is_zombie()) { |
1242 return false; |
1245 return false; |
1301 // When the nmethod becomes zombie it is no longer alive so the |
1304 // When the nmethod becomes zombie it is no longer alive so the |
1302 // dependencies must be flushed. nmethods in the not_entrant |
1305 // dependencies must be flushed. nmethods in the not_entrant |
1303 // state will be flushed later when the transition to zombie |
1306 // state will be flushed later when the transition to zombie |
1304 // happens or they get unloaded. |
1307 // happens or they get unloaded. |
1305 if (state == zombie) { |
1308 if (state == zombie) { |
1306 // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event |
1309 { |
1307 // and it hasn't already been reported for this nmethod then report it now. |
1310 // Flushing dependecies must be done before any possible |
1308 // (the event may have been reported earilier if the GC marked it for unloading). |
1311 // safepoint can sneak in, otherwise the oops used by the |
1309 post_compiled_method_unload(); |
1312 // dependency logic could have become stale. |
1310 |
1313 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
1311 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
1314 flush_dependencies(NULL); |
1312 flush_dependencies(NULL); |
1315 } |
|
1316 |
|
1317 { |
|
1318 // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event |
|
1319 // and it hasn't already been reported for this nmethod then report it now. |
|
1320 // (the event may have been reported earilier if the GC marked it for unloading). |
|
1321 Pause_No_Safepoint_Verifier pnsv(&nsv); |
|
1322 post_compiled_method_unload(); |
|
1323 } |
|
1324 |
|
1325 #ifdef ASSERT |
|
1326 // It's no longer safe to access the oops section since zombie |
|
1327 // nmethods aren't scanned for GC. |
|
1328 _oops_are_stale = true; |
|
1329 #endif |
1313 } else { |
1330 } else { |
1314 assert(state == not_entrant, "other cases may need to be handled differently"); |
1331 assert(state == not_entrant, "other cases may need to be handled differently"); |
1315 } |
1332 } |
1316 |
1333 |
1317 if (TraceCreateZombies) { |
1334 if (TraceCreateZombies) { |