src/share/vm/code/nmethod.cpp

Print this page
rev 6559 : 8046231: G1: Code root location ... from nmethod ... not in strong code roots for region
Reviewed-by:

@@ -666,12 +666,14 @@
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(NULL);
     _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     code_buffer->copy_values_to(this);
-    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
+    if (ScavengeRootsInCode) {
+      if (detect_scavenge_root_oops()) {
       CodeCache::add_scavenge_root_nmethod(this);
+      }
       Universe::heap()->register_nmethod(this);
     }
     debug_only(verify_scavenge_root_oops());
     CodeCache::commit(this);
   }

@@ -751,12 +753,14 @@
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(NULL);
     _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     code_buffer->copy_values_to(this);
-    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
+    if (ScavengeRootsInCode) {
+      if (detect_scavenge_root_oops()) {
       CodeCache::add_scavenge_root_nmethod(this);
+      }
       Universe::heap()->register_nmethod(this);
     }
     DEBUG_ONLY(verify_scavenge_root_oops();)
     CodeCache::commit(this);
   }

@@ -867,12 +871,14 @@
 
     // Copy contents of ScopeDescRecorder to nmethod
     code_buffer->copy_values_to(this);
     debug_info->copy_to(this);
     dependencies->copy_to(this);
-    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
+    if (ScavengeRootsInCode) {
+      if (detect_scavenge_root_oops()) {
       CodeCache::add_scavenge_root_nmethod(this);
+      }
       Universe::heap()->register_nmethod(this);
     }
     debug_only(verify_scavenge_root_oops());
 
     CodeCache::commit(this);