src/share/vm/code/nmethod.cpp
Print this page
rev 4802 : imported patch optimize-nmethod-scanning
@@ -685,10 +685,11 @@
_pc_desc_cache.reset_to(NULL);
code_buffer->copy_values_to(this);
if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
CodeCache::add_scavenge_root_nmethod(this);
+ Universe::heap()->register_nmethod(this);
}
debug_only(verify_scavenge_root_oops());
CodeCache::commit(this);
}
@@ -879,10 +880,11 @@
code_buffer->copy_values_to(this);
debug_info->copy_to(this);
dependencies->copy_to(this);
if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
CodeCache::add_scavenge_root_nmethod(this);
+ Universe::heap()->register_nmethod(this);
}
debug_only(verify_scavenge_root_oops());
CodeCache::commit(this);
@@ -1335,10 +1337,16 @@
// It's a true state change, so mark the method as decompiled.
// Do it only for transition from alive.
inc_decompile_count();
}
+ // If the state is becoming a zombie, unregister the nmethod with heap
+ // This nmethod may have already been unloaded during a full GC.
+ if ((state == zombie) && !is_unloaded()) {
+ Universe::heap()->unregister_nmethod(this);
+ }
+
// Change state
_state = state;
// Log the transition once
log_state_change();