8234010: ZGC: Change ZResurrection to use Atomic::load/store
authorstefank
Mon, 25 Nov 2019 14:56:15 +0100
changeset 59253 1647ed87bf1e
parent 59252 623722a6aeb9
child 59254 58f842703bc5
8234010: ZGC: Change ZResurrection to use Atomic::load/store Reviewed-by: pliden, eosterlund
src/hotspot/share/gc/z/zResurrection.cpp
src/hotspot/share/gc/z/zResurrection.inline.hpp
--- a/src/hotspot/share/gc/z/zResurrection.cpp	Mon Nov 25 12:33:15 2019 +0100
+++ b/src/hotspot/share/gc/z/zResurrection.cpp	Mon Nov 25 14:56:15 2019 +0100
@@ -23,7 +23,7 @@
 
 #include "precompiled.hpp"
 #include "gc/z/zResurrection.hpp"
-#include "runtime/orderAccess.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/safepoint.hpp"
 #include "utilities/debug.hpp"
 
@@ -35,8 +35,8 @@
 }
 
 void ZResurrection::unblock() {
-  // We use a storestore barrier to make sure all healed
-  // oops are visible before we unblock resurrection.
-  OrderAccess::storestore();
-  _blocked = false;
+  // No need for anything stronger than a relaxed store here.
+  // The preceeding handshake makes sure that all non-strong
+  // oops have already been healed at this point.
+  Atomic::store(&_blocked, false);
 }
--- a/src/hotspot/share/gc/z/zResurrection.inline.hpp	Mon Nov 25 12:33:15 2019 +0100
+++ b/src/hotspot/share/gc/z/zResurrection.inline.hpp	Mon Nov 25 14:56:15 2019 +0100
@@ -25,14 +25,10 @@
 #define SHARE_GC_Z_ZRESURRECTION_INLINE_HPP
 
 #include "gc/z/zResurrection.hpp"
-#include "runtime/orderAccess.hpp"
+#include "runtime/atomic.hpp"
 
 inline bool ZResurrection::is_blocked() {
-  // We use a loadload barrier to make sure we are not
-  // seeing oops from a time when resurrection was blocked.
-  const bool blocked = _blocked;
-  OrderAccess::loadload();
-  return blocked;
+  return Atomic::load(&_blocked);
 }
 
 #endif // SHARE_GC_Z_ZRESURRECTION_INLINE_HPP