hotspot/src/share/vm/gc_implementation/g1/satbQueue.hpp
changeset 5082 19e725a3d2eb
parent 4481 de92ec484f5e
child 5547 f4b087cbb361
equal deleted inserted replaced
5081:41cf61730680 5082:19e725a3d2eb
    27 
    27 
    28 // A ptrQueue whose elements are "oops", pointers to object heads.
    28 // A ptrQueue whose elements are "oops", pointers to object heads.
    29 class ObjPtrQueue: public PtrQueue {
    29 class ObjPtrQueue: public PtrQueue {
    30 public:
    30 public:
    31   ObjPtrQueue(PtrQueueSet* qset_, bool perm = false) :
    31   ObjPtrQueue(PtrQueueSet* qset_, bool perm = false) :
    32     PtrQueue(qset_, perm)
    32     PtrQueue(qset_, perm, qset_->is_active()) { }
    33   {}
       
    34   // Apply the closure to all elements, and reset the index to make the
    33   // Apply the closure to all elements, and reset the index to make the
    35   // buffer empty.
    34   // buffer empty.
    36   void apply_closure(ObjectClosure* cl);
    35   void apply_closure(ObjectClosure* cl);
    37 
    36 
    38   // Apply the closure to all elements of "buf", down to "index" (inclusive.)
    37   // Apply the closure to all elements of "buf", down to "index" (inclusive.)
    53   // Utility function to support sequential and parallel versions.  If
    52   // Utility function to support sequential and parallel versions.  If
    54   // "par" is true, then "worker" is the par thread id; if "false", worker
    53   // "par" is true, then "worker" is the par thread id; if "false", worker
    55   // is ignored.
    54   // is ignored.
    56   bool apply_closure_to_completed_buffer_work(bool par, int worker);
    55   bool apply_closure_to_completed_buffer_work(bool par, int worker);
    57 
    56 
       
    57 #ifdef ASSERT
       
    58   void dump_active_values(JavaThread* first, bool expected_active);
       
    59 #endif // ASSERT
    58 
    60 
    59 public:
    61 public:
    60   SATBMarkQueueSet();
    62   SATBMarkQueueSet();
    61 
    63 
    62   void initialize(Monitor* cbl_mon, Mutex* fl_lock,
    64   void initialize(Monitor* cbl_mon, Mutex* fl_lock,
    63                   int process_completed_threshold,
    65                   int process_completed_threshold,
    64                   Mutex* lock);
    66                   Mutex* lock);
    65 
    67 
    66   static void handle_zero_index_for_thread(JavaThread* t);
    68   static void handle_zero_index_for_thread(JavaThread* t);
    67 
    69 
    68   // Apply "set_active(b)" to all thread tloq's.  Should be called only
    70   // Apply "set_active(b)" to all Java threads' SATB queues. It should be
    69   // with the world stopped.
    71   // called only with the world stopped. The method will assert that the
    70   void set_active_all_threads(bool b);
    72   // SATB queues of all threads it visits, as well as the SATB queue
       
    73   // set itself, has an active value same as expected_active.
       
    74   void set_active_all_threads(bool b, bool expected_active);
    71 
    75 
    72   // Register "blk" as "the closure" for all queues.  Only one such closure
    76   // Register "blk" as "the closure" for all queues.  Only one such closure
    73   // is allowed.  The "apply_closure_to_completed_buffer" method will apply
    77   // is allowed.  The "apply_closure_to_completed_buffer" method will apply
    74   // this closure to a completed buffer, and "iterate_closure_all_threads"
    78   // this closure to a completed buffer, and "iterate_closure_all_threads"
    75   // applies it to partially-filled buffers (the latter should only be done
    79   // applies it to partially-filled buffers (the latter should only be done