< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp

Print this page

        

@@ -253,11 +253,15 @@
     }
   }
 }
 
 oop ShenandoahBarrierSet::read_barrier(oop src) {
-  if (ShenandoahReadBarrier) {
+  // Check for forwarded objects, because on Full GC path we might deal with
+  // non-trivial fwdptrs that contain Full GC specific metadata. We could check
+  // for is_full_gc_in_progress(), but this also covers the case of stable heap,
+  // which provides a bit of performance improvement.
+  if (ShenandoahReadBarrier && _heap->has_forwarded_objects()) {
     return ShenandoahBarrierSet::resolve_forwarded(src);
   } else {
     return src;
   }
 }
< prev index next >