47
48 bool DirtyCardQueue::apply_closure_to_buffer(CardTableEntryClosure* cl,
49 void** buf,
50 size_t index, size_t sz,
51 bool consume,
52 uint worker_i) {
53 if (cl == NULL) return true;
54 for (size_t i = index; i < sz; i += oopSize) {
55 int ind = byte_index_to_index((int)i);
56 jbyte* card_ptr = (jbyte*)buf[ind];
57 if (card_ptr != NULL) {
58 // Set the entry to null, so we don't do it again (via the test
59 // above) if we reconsider this buffer.
60 if (consume) buf[ind] = NULL;
61 if (!cl->do_card_ptr(card_ptr, worker_i)) return false;
62 }
63 }
64 return true;
65 }
66
67 #ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away
68 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
69 #endif // _MSC_VER
70
71 DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
72 PtrQueueSet(notify_when_complete),
73 _mut_process_closure(NULL),
74 _shared_dirty_card_queue(this, true /*perm*/),
75 _free_ids(NULL),
76 _processed_buffers_mut(0), _processed_buffers_rs_thread(0)
77 {
78 _all_active = true;
79 }
80
81 // Determines how many mutator threads can process the buffers in parallel.
82 uint DirtyCardQueueSet::num_par_ids() {
83 return (uint)os::processor_count();
84 }
85
86 void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
87 int process_completed_threshold,
88 int max_completed_queue,
89 Mutex* lock, PtrQueueSet* fl_owner) {
90 _mut_process_closure = cl;
91 PtrQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold,
92 max_completed_queue, fl_owner);
93 set_buffer_size(G1UpdateBufferSize);
94 _shared_dirty_card_queue.set_lock(lock);
95 _free_ids = new FreeIdSet((int) num_par_ids(), _cbl_mon);
96 }
97
|
47
48 bool DirtyCardQueue::apply_closure_to_buffer(CardTableEntryClosure* cl,
49 void** buf,
50 size_t index, size_t sz,
51 bool consume,
52 uint worker_i) {
53 if (cl == NULL) return true;
54 for (size_t i = index; i < sz; i += oopSize) {
55 int ind = byte_index_to_index((int)i);
56 jbyte* card_ptr = (jbyte*)buf[ind];
57 if (card_ptr != NULL) {
58 // Set the entry to null, so we don't do it again (via the test
59 // above) if we reconsider this buffer.
60 if (consume) buf[ind] = NULL;
61 if (!cl->do_card_ptr(card_ptr, worker_i)) return false;
62 }
63 }
64 return true;
65 }
66
67 DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
68 PtrQueueSet(notify_when_complete),
69 _mut_process_closure(NULL),
70 _free_ids(NULL),
71 _processed_buffers_mut(0), _processed_buffers_rs_thread(0)
72 {
73 _shared_dirty_card_queue = DirtyCardQueue(this, true /*perm*/);
74 _all_active = true;
75 }
76
77 // Determines how many mutator threads can process the buffers in parallel.
78 uint DirtyCardQueueSet::num_par_ids() {
79 return (uint)os::processor_count();
80 }
81
82 void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
83 int process_completed_threshold,
84 int max_completed_queue,
85 Mutex* lock, PtrQueueSet* fl_owner) {
86 _mut_process_closure = cl;
87 PtrQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold,
88 max_completed_queue, fl_owner);
89 set_buffer_size(G1UpdateBufferSize);
90 _shared_dirty_card_queue.set_lock(lock);
91 _free_ids = new FreeIdSet((int) num_par_ids(), _cbl_mon);
92 }
93
|