< prev index next >

src/share/vm/oops/klass.cpp

Print this page
rev 14282 : Factor out keep-alive barrier from usual pre-barrier implementations.

@@ -41,13 +41,10 @@
 #include "runtime/atomic.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "trace/traceMacros.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/stack.inline.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
 
 bool Klass::is_cloneable() const {
   return _access_flags.is_cloneable_fast() ||
          is_subtype_of(SystemDictionary::Cloneable_klass());
 }

@@ -448,15 +445,13 @@
 // This barrier is used by G1 to remember the old oop values, so
 // that we don't forget any objects that were live at the snapshot at
 // the beginning. This function is only used when we write oops into Klasses.
 void Klass::klass_update_barrier_set_pre(oop* p, oop v) {
 #if INCLUDE_ALL_GCS
-  if (UseG1GC || (UseShenandoahGC && ShenandoahSATBBarrier)) {
-    oop obj = *p;
-    if (obj != NULL) {
-      G1SATBCardTableModRefBS::enqueue(obj);
-    }
+  oop obj = oopDesc::load_heap_oop(p);
+  if (! oopDesc::is_null(obj)) {
+    oopDesc::bs()->keep_alive_barrier(obj);
   }
 #endif
 }
 
 void Klass::klass_oop_store(oop* p, oop v) {
< prev index next >