--- a/hotspot/src/share/vm/code/nmethod.cpp Fri Apr 18 14:30:58 2014 -0400
+++ b/hotspot/src/share/vm/code/nmethod.cpp Mon Apr 28 12:39:12 2014 +0200
@@ -750,7 +750,11 @@
_hotness_counter = NMethodSweeper::hotness_counter_reset_val();
code_buffer->copy_values_to(this);
- debug_only(verify_scavenge_root_oops());
+ 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);
}