< prev index next >

src/share/vm/code/nmethod.cpp

Print this page
rev 12906 : [mq]: gc_interface

@@ -39,10 +39,11 @@
 #include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/methodData.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
+#include "runtime/access.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/sweeper.hpp"

@@ -407,15 +408,12 @@
 #endif
 
   _oops_do_mark_link       = NULL;
   _jmethod_id              = NULL;
   _osr_link                = NULL;
-  if (UseG1GC) {
     _unloading_next        = NULL;
-  } else {
     _scavenge_root_link    = NULL;
-  }
   _scavenge_root_state     = 0;
 #if INCLUDE_RTM_OPT
   _rtm_state               = NoRTM;
 #endif
 #if INCLUDE_JVMCI

@@ -595,16 +593,13 @@
     _deopt_mh_handler_begin = (address) this + deoptimize_mh_offset;
 
     code_buffer->copy_code_and_locs_to(this);
     code_buffer->copy_values_to(this);
     if (ScavengeRootsInCode) {
-      if (detect_scavenge_root_oops()) {
-        CodeCache::add_scavenge_root_nmethod(this);
-      }
       Universe::heap()->register_nmethod(this);
     }
-    debug_only(verify_scavenge_root_oops());
+    debug_only(Universe::heap()->verify_nmethod_roots(this));
     CodeCache::commit(this);
   }
 
   if (PrintNativeNMethods || PrintDebugInfo || PrintRelocations || PrintDependencies) {
     ttyLocker ttyl;  // keep the following output all in one block

@@ -750,16 +745,13 @@
     // Copy contents of ScopeDescRecorder to nmethod
     code_buffer->copy_values_to(this);
     debug_info->copy_to(this);
     dependencies->copy_to(this);
     if (ScavengeRootsInCode) {
-      if (detect_scavenge_root_oops()) {
-        CodeCache::add_scavenge_root_nmethod(this);
-      }
       Universe::heap()->register_nmethod(this);
     }
-    debug_only(verify_scavenge_root_oops());
+    debug_only(Universe::heap()->verify_nmethod_roots(this));
 
     CodeCache::commit(this);
 
     // Copy contents of ExceptionHandlerTable to nmethod
     handler_table->copy_to(this);

@@ -1525,11 +1517,10 @@
 
 #if INCLUDE_JVMCI
 bool nmethod::do_unloading_jvmci(BoolObjectClosure* is_alive, bool unloading_occurred) {
   bool is_unloaded = false;
   // Follow JVMCI method
-  BarrierSet* bs = Universe::heap()->barrier_set();
   if (_jvmci_installed_code != NULL) {
     if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
       if (!is_alive->do_object_b(_jvmci_installed_code)) {
         clear_jvmci_installed_code();
       }

@@ -1540,13 +1531,11 @@
     }
   }
 
   if (_speculation_log != NULL) {
     if (!is_alive->do_object_b(_speculation_log)) {
-      bs->write_ref_nmethod_pre(&_speculation_log, this);
-      _speculation_log = NULL;
-      bs->write_ref_nmethod_post(&_speculation_log, this);
+      NMethodAccess<>::oop_store_at(this, in_bytes(byte_offset_of(nmethod, _speculation_log)), NULL);
     }
   }
   return is_unloaded;
 }
 #endif

@@ -2136,11 +2125,11 @@
   }
 
   VerifyOopsClosure voc(this);
   oops_do(&voc);
   assert(voc.ok(), "embedded oops must be OK");
-  verify_scavenge_root_oops();
+  Universe::heap()->verify_nmethod_roots(this);
 
   verify_scopes();
 }
 
 

@@ -2226,14 +2215,10 @@
   }
   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
 };
 
 void nmethod::verify_scavenge_root_oops() {
-  if (UseG1GC) {
-    return;
-  }
-
   if (!on_scavenge_root_list()) {
     // Actually look inside, to verify the claim that it's clean.
     DebugScavengeRoot debug_scavenge_root(this);
     oops_do(&debug_scavenge_root);
     if (!debug_scavenge_root.ok())

@@ -2912,14 +2897,11 @@
   // safepoint or while holding the CodeCache_lock
   assert(CodeCache_lock->is_locked() ||
          SafepointSynchronize::is_at_safepoint(), "should be performed under a lock for consistency");
   if (_jvmci_installed_code != NULL) {
     // This must be done carefully to maintain nmethod remembered sets properly
-    BarrierSet* bs = Universe::heap()->barrier_set();
-    bs->write_ref_nmethod_pre(&_jvmci_installed_code, this);
-    _jvmci_installed_code = NULL;
-    bs->write_ref_nmethod_post(&_jvmci_installed_code, this);
+    NMethodAccess<>::oop_store_at(this, in_bytes(byte_offset_of(nmethod, _jvmci_installed_code)), NULL);
   }
 }
 
 void nmethod::maybe_invalidate_installed_code() {
   assert(Patching_lock->is_locked() ||

@@ -3004,6 +2986,5 @@
   }
   jio_snprintf(buf, buflen, "noInstalledCode");
   return buf;
 }
 #endif
-
< prev index next >