58 // created during a cycle and its SATB queue needs to be activated
59 // before the thread starts running, we'll need to set its active
60 // field to true. This is done in JavaThread::initialize_queues().
61 PtrQueue(qset, perm, false /* active */) { }
62
63 // Process queue entries and free resources.
64 void flush();
65
66 // Overrides PtrQueue::should_enqueue_buffer(). See the method's
67 // definition for more information.
68 virtual bool should_enqueue_buffer();
69
70 #ifndef PRODUCT
71 // Helpful for debugging
72 void print(const char* name);
73 static void print(const char* name, void** buf, size_t index, size_t sz);
74 #endif // PRODUCT
75 };
76
77 class SATBMarkQueueSet: public PtrQueueSet {
78 ObjectClosure** _closures; // One per ParGCThread.
79
80 ObjPtrQueue _shared_satb_queue;
81
82 #ifdef ASSERT
83 void dump_active_states(bool expected_active);
84 void verify_active_states(bool expected_active);
85 #endif // ASSERT
86
87 public:
88 SATBMarkQueueSet();
89
90 void initialize(Monitor* cbl_mon, Mutex* fl_lock,
91 int process_completed_threshold,
92 Mutex* lock);
93
94 static void handle_zero_index_for_thread(JavaThread* t);
95
96 // Apply "set_active(active)" to all SATB queues in the set. It should be
97 // called only with the world stopped. The method will assert that the
98 // SATB queues of all threads it visits, as well as the SATB queue
99 // set itself, has an active value same as expected_active.
100 void set_active_all_threads(bool active, bool expected_active);
101
102 // Filter all the currently-active SATB buffers.
103 void filter_thread_buffers();
104
105 // Register closure for the given worker thread. The "apply_closure_to_completed_buffer"
106 // method will apply this closure to a completed buffer, and "iterate_closure_all_threads"
107 // applies it to partially-filled buffers (the latter should only be done
108 // with the world stopped).
109 void set_closure(uint worker, ObjectClosure* closure);
110
111 // If there exists some completed buffer, pop it, then apply the
112 // registered closure to all its elements, and return true. If no
113 // completed buffers exist, return false.
114 bool apply_closure_to_completed_buffer(uint worker);
115
116 // Apply the given closure on enqueued and currently-active buffers
117 // respectively. Both methods are read-only, i.e., they do not
118 // modify any of the buffers.
119 void iterate_completed_buffers_read_only(ObjectClosure* cl);
120 void iterate_thread_buffers_read_only(ObjectClosure* cl);
121
122 #ifndef PRODUCT
123 // Helpful for debugging
124 void print_all(const char* msg);
125 #endif // PRODUCT
126
127 ObjPtrQueue* shared_satb_queue() { return &_shared_satb_queue; }
128
129 // If a marking is being abandoned, reset any unprocessed log buffers.
130 void abandon_partial_marking();
131 };
132
133 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_SATBQUEUE_HPP
|
58 // created during a cycle and its SATB queue needs to be activated
59 // before the thread starts running, we'll need to set its active
60 // field to true. This is done in JavaThread::initialize_queues().
61 PtrQueue(qset, perm, false /* active */) { }
62
63 // Process queue entries and free resources.
64 void flush();
65
66 // Overrides PtrQueue::should_enqueue_buffer(). See the method's
67 // definition for more information.
68 virtual bool should_enqueue_buffer();
69
70 #ifndef PRODUCT
71 // Helpful for debugging
72 void print(const char* name);
73 static void print(const char* name, void** buf, size_t index, size_t sz);
74 #endif // PRODUCT
75 };
76
77 class SATBMarkQueueSet: public PtrQueueSet {
78 ObjPtrQueue _shared_satb_queue;
79
80 #ifdef ASSERT
81 void dump_active_states(bool expected_active);
82 void verify_active_states(bool expected_active);
83 #endif // ASSERT
84
85 public:
86 SATBMarkQueueSet();
87
88 void initialize(Monitor* cbl_mon, Mutex* fl_lock,
89 int process_completed_threshold,
90 Mutex* lock);
91
92 static void handle_zero_index_for_thread(JavaThread* t);
93
94 // Apply "set_active(active)" to all SATB queues in the set. It should be
95 // called only with the world stopped. The method will assert that the
96 // SATB queues of all threads it visits, as well as the SATB queue
97 // set itself, has an active value same as expected_active.
98 void set_active_all_threads(bool active, bool expected_active);
99
100 // Filter all the currently-active SATB buffers.
101 void filter_thread_buffers();
102
103 // If there exists some completed buffer, pop it, then apply the
104 // closure to all its elements, and return true. If no
105 // completed buffers exist, return false.
106 bool apply_closure_to_completed_buffer(ObjectClosure* closure);
107
108 // Apply the given closure on enqueued and currently-active buffers
109 // respectively. Both methods are read-only, i.e., they do not
110 // modify any of the buffers.
111 void iterate_completed_buffers_read_only(ObjectClosure* cl);
112 void iterate_thread_buffers_read_only(ObjectClosure* cl);
113
114 #ifndef PRODUCT
115 // Helpful for debugging
116 void print_all(const char* msg);
117 #endif // PRODUCT
118
119 ObjPtrQueue* shared_satb_queue() { return &_shared_satb_queue; }
120
121 // If a marking is being abandoned, reset any unprocessed log buffers.
122 void abandon_partial_marking();
123 };
124
125 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_SATBQUEUE_HPP
|