changeset 59338:22887fc44d67

8245233: ZGC: Load volatile oops using Atomic::load() Reviewed-by: stefank, kbarrett, smonteith
author pliden
date Tue, 19 May 2020 08:34:13 +0200
parents 62d97ec739db
children 5f659a149bae
files src/hotspot/share/gc/z/zBarrier.inline.hpp src/hotspot/share/gc/z/zReferenceProcessor.cpp
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/z/zBarrier.inline.hpp	Tue May 19 04:05:03 2020 +0000
+++ b/src/hotspot/share/gc/z/zBarrier.inline.hpp	Tue May 19 08:34:13 2020 +0200
@@ -228,7 +228,7 @@
 }
 
 inline oop ZBarrier::load_barrier_on_oop_field(volatile oop* p) {
-  const oop o = *p;
+  const oop o = Atomic::load(p);
   return load_barrier_on_oop_field_preloaded(p, o);
 }
 
@@ -282,7 +282,7 @@
 //
 inline oop ZBarrier::weak_load_barrier_on_oop_field(volatile oop* p) {
   assert(!ZResurrection::is_blocked(), "Should not be called during resurrection blocked phase");
-  const oop o = *p;
+  const oop o = Atomic::load(p);
   return weak_load_barrier_on_oop_field_preloaded(p, o);
 }
 
@@ -295,7 +295,7 @@
 }
 
 inline oop ZBarrier::weak_load_barrier_on_weak_oop_field(volatile oop* p) {
-  const oop o = *p;
+  const oop o = Atomic::load(p);
   return weak_load_barrier_on_weak_oop_field_preloaded(p, o);
 }
 
@@ -314,7 +314,7 @@
 }
 
 inline oop ZBarrier::weak_load_barrier_on_phantom_oop_field(volatile oop* p) {
-  const oop o = *p;
+  const oop o = Atomic::load(p);
   return weak_load_barrier_on_phantom_oop_field_preloaded(p, o);
 }
 
@@ -349,14 +349,14 @@
 inline void ZBarrier::keep_alive_barrier_on_weak_oop_field(volatile oop* p) {
   // This operation is only valid when resurrection is blocked.
   assert(ZResurrection::is_blocked(), "Invalid phase");
-  const oop o = *p;
+  const oop o = Atomic::load(p);
   barrier<is_good_or_null_fast_path, keep_alive_barrier_on_weak_oop_slow_path>(p, o);
 }
 
 inline void ZBarrier::keep_alive_barrier_on_phantom_oop_field(volatile oop* p) {
   // This operation is only valid when resurrection is blocked.
   assert(ZResurrection::is_blocked(), "Invalid phase");
-  const oop o = *p;
+  const oop o = Atomic::load(p);
   barrier<is_good_or_null_fast_path, keep_alive_barrier_on_phantom_oop_slow_path>(p, o);
 }
 
@@ -380,7 +380,7 @@
 // Mark barrier
 //
 inline void ZBarrier::mark_barrier_on_oop_field(volatile oop* p, bool finalizable) {
-  const oop o = *p;
+  const oop o = Atomic::load(p);
 
   if (finalizable) {
     barrier<is_marked_or_null_fast_path, mark_barrier_on_finalizable_oop_slow_path>(p, o);
--- a/src/hotspot/share/gc/z/zReferenceProcessor.cpp	Tue May 19 04:05:03 2020 +0000
+++ b/src/hotspot/share/gc/z/zReferenceProcessor.cpp	Tue May 19 08:34:13 2020 +0200
@@ -70,7 +70,7 @@
 }
 
 static oop reference_referent(oop reference) {
-  return *reference_referent_addr(reference);
+  return Atomic::load(reference_referent_addr(reference));
 }
 
 static void reference_set_referent(oop reference, oop referent) {