< prev index next >

src/hotspot/share/gc/shared/oopStorageParState.hpp

8211718: Supporting multiple concurrent OopStorage iterators
 #include "utilities/macros.hpp"
 
 //////////////////////////////////////////////////////////////////////////////
 // Support for parallel and optionally concurrent state iteration.
 //
-// Parallel iteration is for the exclusive use of the GC.  Other iteration
-// clients must use serial iteration.
-//
 // Concurrent Iteration
 //
 // Iteration involves the _active_array (an ActiveArray), which contains all
 // of the blocks owned by a storage object.
 //
-// At most one concurrent ParState can exist at a time for a given storage
-// object.
-//
-// A concurrent ParState sets the associated storage's
-// _concurrent_iteration_active flag true when the state is constructed, and
-// sets it false when the state is destroyed.  These assignments are made with
+// A concurrent ParState increments the associated storage's
+// _concurrent_iteration_active count when the state is constructed, and
+// decrements it when the state is destroyed.  These assignments are made with
 // _active_mutex locked.  Meanwhile, empty block deletion is not done while
-// _concurrent_iteration_active is true.  The flag check and the dependent
+// _concurrent_iteration_active is non-zero.  The counter check and the dependent
 // removal of a block from the _active_array is performed with _active_mutex
 // locked.  This prevents concurrent iteration and empty block deletion from
 // interfering with with each other.
 //
 // Both allocate() and delete_empty_blocks_concurrent() lock the

@@ -81,21 +75,20 // the start of a concurrent iteration over the _active_mutex. Since both are // under GC control, that potential contention can be eliminated by never // scheduling both operations to run at the same time. // // ParState<concurrent, is_const> -// concurrent must be true if iteration is concurrent with the -// mutator, false if iteration is at a safepoint. +// concurrent must be true if iteration may be concurrent with the +// mutators. // // is_const must be true if the iteration is over a constant storage // object, false if the iteration may modify the storage object. // // ParState([const] OopStorage* storage) // Construct an object for managing an iteration over storage. For a // concurrent ParState, empty block deletion for the associated storage -// is inhibited for the life of the ParState. There can be no more -// than one live concurrent ParState at a time for a given storage object. +// is inhibited for the life of the ParState. // // template<typename F> void iterate(F f) // Repeatedly claims a block from the associated storage that has // not been processed by this iteration (possibly by other threads), // and applies f to each entry in the claimed block. Assume p is of
@@ -150,11 +143,11 BasicParState(const BasicParState&); BasicParState& operator=(const BasicParState&); struct IterationData; - void update_iteration_state(bool value); + void update_iteration_state(int value); bool claim_next_segment(IterationData* data); bool finish_iteration(const IterationData* data) const; // Wrapper for iteration handler; ignore handler result and return true. template<typename F> class AlwaysTrueFn;
< prev index next >