open Udiff src/hotspot/share/gc/shared/oopStorage.hpp (original) (raw)
rev 49824 : imported patch block_array rev 49826 : [mq]: active_array
@@ -169,10 +169,11 @@ // xlC on AIX can't compile test_oopStorage.cpp with following private // classes. C++03 introduced access for nested classes with DR45, but xlC // version 12 rejects it. NOT_AIX( private: ) class Block; // Forward decl; defined in .inline.hpp file. + class BlockArray; // Forward decl; defined in .inline.hpp file. class BlockList; // Forward decl for BlockEntry friend decl. class BlockEntry { friend class BlockList;
@@ -203,10 +204,11 @@ public: BlockList(const BlockEntry& (*get_entry)(const Block& block)); ~BlockList();
Block* head();
Block* tail(); const Block* chead() const; const Block* ctail() const;
Block* prev(Block& block); Block* next(Block& block);
@@ -217,30 +219,62 @@ void push_front(const Block& block); void push_back(const Block& block); 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;
- BlockList _active_list;
- BlockArray* _active_array; BlockList _allocate_list;
Block* volatile _active_head; Block* volatile _deferred_updates;
Mutex* _allocate_mutex; Mutex* _active_mutex;
// Counts are volatile for racy unlocked accesses.
- // Volatile for racy unlocked accesses. volatile size_t _allocation_count;
- volatile size_t _block_count;
// Protection for _active_array.
mutable ProtectActive _protect_active;
// mutable because this gets set even for const iteration. mutable bool _concurrent_iteration_active;
Block* find_block_or_null(const oop* ptr) const; void delete_empty_block(const Block& block); bool reduce_deferred_updates();
// Managing _active_array.
// Create a new, larger, active array with the same content as the
// current array, and then replace. Return true if the array was
// successfully expanded, false to indicate allocation failure.
bool expand_active_array();
// Atomically (wrto obtain_active_array) set _active_array to new_array.
// Increments new_array's refcount to account for the new reference.
void replace_active_array(BlockArray* new_array);
// Atomically (wrto replace_active_array) get the active array and
// increment its refcount.
BlockArray* obtain_active_array() const;
// Decrement refcount of array and destroy if refcount is zero.
void relinquish_block_array(BlockArray* array) const;
// RAII helper for active array access.
class WithActiveArray;
template<typename F, typename Storage> static bool iterate_impl(F f, Storage* storage);
// Implementation support for parallel iteration class BasicParState;