95 // Determines how many mutator threads can process the buffers in parallel.
96 uint DirtyCardQueueSet::num_par_ids() {
97 return (uint)os::processor_count();
98 }
99
100 void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl,
101 Monitor* cbl_mon,
102 Mutex* fl_lock,
103 int process_completed_threshold,
104 int max_completed_queue,
105 Mutex* lock,
106 DirtyCardQueueSet* fl_owner) {
107 _mut_process_closure = cl;
108 PtrQueueSet::initialize(cbl_mon,
109 fl_lock,
110 process_completed_threshold,
111 max_completed_queue,
112 fl_owner);
113 set_buffer_size(G1UpdateBufferSize);
114 _shared_dirty_card_queue.set_lock(lock);
115 _free_ids = new FreeIdSet((int) num_par_ids(), _cbl_mon);
116 }
117
118 void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
119 t->dirty_card_queue().handle_zero_index();
120 }
121
122 void DirtyCardQueueSet::iterate_closure_all_threads(CardTableEntryClosure* cl,
123 bool consume,
124 uint worker_i) {
125 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
126 for (JavaThread* t = Threads::first(); t; t = t->next()) {
127 bool b = t->dirty_card_queue().apply_closure(cl, consume);
128 guarantee(b, "Should not be interrupted.");
129 }
130 bool b = shared_dirty_card_queue()->apply_closure(cl,
131 consume,
132 worker_i);
133 guarantee(b, "Should not be interrupted.");
134 }
135
|
95 // Determines how many mutator threads can process the buffers in parallel.
96 uint DirtyCardQueueSet::num_par_ids() {
97 return (uint)os::processor_count();
98 }
99
100 void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl,
101 Monitor* cbl_mon,
102 Mutex* fl_lock,
103 int process_completed_threshold,
104 int max_completed_queue,
105 Mutex* lock,
106 DirtyCardQueueSet* fl_owner) {
107 _mut_process_closure = cl;
108 PtrQueueSet::initialize(cbl_mon,
109 fl_lock,
110 process_completed_threshold,
111 max_completed_queue,
112 fl_owner);
113 set_buffer_size(G1UpdateBufferSize);
114 _shared_dirty_card_queue.set_lock(lock);
115 _free_ids = new FreeIdSet(num_par_ids(), _cbl_mon);
116 }
117
118 void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
119 t->dirty_card_queue().handle_zero_index();
120 }
121
122 void DirtyCardQueueSet::iterate_closure_all_threads(CardTableEntryClosure* cl,
123 bool consume,
124 uint worker_i) {
125 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
126 for (JavaThread* t = Threads::first(); t; t = t->next()) {
127 bool b = t->dirty_card_queue().apply_closure(cl, consume);
128 guarantee(b, "Should not be interrupted.");
129 }
130 bool b = shared_dirty_card_queue()->apply_closure(cl,
131 consume,
132 worker_i);
133 guarantee(b, "Should not be interrupted.");
134 }
135
|