src/hotspot/share/gc/shared/oopStorage.hpp
changeset 51511 eb8d5aeabab3
parent 50954 f85092465b0c
child 52037 d2a6c3cbc110
equal deleted inserted replaced
51510:6b0012622443 51511:eb8d5aeabab3
    27 
    27 
    28 #include "memory/allocation.hpp"
    28 #include "memory/allocation.hpp"
    29 #include "oops/oop.hpp"
    29 #include "oops/oop.hpp"
    30 #include "utilities/globalDefinitions.hpp"
    30 #include "utilities/globalDefinitions.hpp"
    31 #include "utilities/macros.hpp"
    31 #include "utilities/macros.hpp"
       
    32 #include "utilities/singleWriterSynchronizer.hpp"
    32 
    33 
    33 class Mutex;
    34 class Mutex;
    34 class outputStream;
    35 class outputStream;
    35 
    36 
    36 // OopStorage supports management of off-heap references to objects allocated
    37 // OopStorage supports management of off-heap references to objects allocated
   201     void push_front(const Block& block);
   202     void push_front(const Block& block);
   202     void push_back(const Block& block);
   203     void push_back(const Block& block);
   203     void unlink(const Block& block);
   204     void unlink(const Block& block);
   204   };
   205   };
   205 
   206 
   206   // RCU-inspired protection of access to _active_array.
       
   207   class ProtectActive {
       
   208     volatile uint _enter;
       
   209     volatile uint _exit[2];
       
   210 
       
   211   public:
       
   212     ProtectActive();
       
   213 
       
   214     uint read_enter();
       
   215     void read_exit(uint enter_value);
       
   216     void write_synchronize();
       
   217   };
       
   218 
       
   219 private:
   207 private:
   220   const char* _name;
   208   const char* _name;
   221   ActiveArray* _active_array;
   209   ActiveArray* _active_array;
   222   AllocationList _allocation_list;
   210   AllocationList _allocation_list;
   223   Block* volatile _deferred_updates;
   211   Block* volatile _deferred_updates;
   227 
   215 
   228   // Volatile for racy unlocked accesses.
   216   // Volatile for racy unlocked accesses.
   229   volatile size_t _allocation_count;
   217   volatile size_t _allocation_count;
   230 
   218 
   231   // Protection for _active_array.
   219   // Protection for _active_array.
   232   mutable ProtectActive _protect_active;
   220   mutable SingleWriterSynchronizer _protect_active;
   233 
   221 
   234   // mutable because this gets set even for const iteration.
   222   // mutable because this gets set even for const iteration.
   235   mutable bool _concurrent_iteration_active;
   223   mutable bool _concurrent_iteration_active;
   236 
   224 
   237   Block* find_block_or_null(const oop* ptr) const;
   225   Block* find_block_or_null(const oop* ptr) const;