src/hotspot/share/gc/shared/oopStorage.hpp
changeset 51511 eb8d5aeabab3
parent 50954 f85092465b0c
child 52037 d2a6c3cbc110
--- a/src/hotspot/share/gc/shared/oopStorage.hpp	Thu Aug 23 12:57:40 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.hpp	Thu Aug 23 18:14:53 2018 -0400
@@ -29,6 +29,7 @@
 #include "oops/oop.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
+#include "utilities/singleWriterSynchronizer.hpp"
 
 class Mutex;
 class outputStream;
@@ -203,19 +204,6 @@
     void unlink(const Block& block);
   };
 
-  // RCU-inspired protection of access to _active_array.
-  class ProtectActive {
-    volatile uint _enter;
-    volatile uint _exit[2];
-
-  public:
-    ProtectActive();
-
-    uint read_enter();
-    void read_exit(uint enter_value);
-    void write_synchronize();
-  };
-
 private:
   const char* _name;
   ActiveArray* _active_array;
@@ -229,7 +217,7 @@
   volatile size_t _allocation_count;
 
   // Protection for _active_array.
-  mutable ProtectActive _protect_active;
+  mutable SingleWriterSynchronizer _protect_active;
 
   // mutable because this gets set even for const iteration.
   mutable bool _concurrent_iteration_active;