src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54687 df2b3565f343
child 58679 9c3209ff7550
--- a/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp	Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp	Thu Oct 17 20:53:35 2019 +0100
@@ -92,7 +92,7 @@
     if (_heap->in_collection_set(obj)) {
       shenandoah_assert_marked(p, obj);
       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      if (oopDesc::equals_raw(resolved, obj)) {
+      if (resolved == obj) {
         resolved = _heap->evacuate_object(obj, _thread);
       }
       RawAccess<IS_NOT_NULL>::oop_store(p, resolved);
@@ -107,6 +107,31 @@
   do_oop_work(p);
 }
 
+ShenandoahEvacUpdateOopStorageRootsClosure::ShenandoahEvacUpdateOopStorageRootsClosure() :
+  _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
+}
+
+void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
+  assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
+
+  oop obj = RawAccess<>::oop_load(p);
+  if (! CompressedOops::is_null(obj)) {
+    if (_heap->in_collection_set(obj)) {
+      shenandoah_assert_marked(p, obj);
+      oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
+      if (resolved == obj) {
+        resolved = _heap->evacuate_object(obj, _thread);
+      }
+
+      Atomic::cmpxchg(resolved, p, obj);
+    }
+  }
+}
+
+void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(narrowOop* p) {
+  ShouldNotReachHere();
+}
+
 #ifdef ASSERT
 template <class T>
 void ShenandoahAssertNotForwardedClosure::do_oop_work(T* p) {