comparison src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp @ 795:215f81b4d9b3

6841831: G1: assert(contains_reference(from),"We just added it!") fires Summary: During parallel rset updating we have to make sure that the worker ids of the refinement threads do not intersect with the worker ids that can be claimed by the mutator threads. Reviewed-by: tonyp
author iveresov
date Mon, 18 May 2009 11:52:46 -0700
parents 315a5d70b295
children bd02caa94611 27f6a9b9c311
comparison
equal deleted inserted replaced
794:315a5d70b295 795:215f81b4d9b3
69 _processed_buffers_mut(0), _processed_buffers_rs_thread(0) 69 _processed_buffers_mut(0), _processed_buffers_rs_thread(0)
70 { 70 {
71 _all_active = true; 71 _all_active = true;
72 } 72 }
73 73
74 // Determines how many mutator threads can process the buffers in parallel.
74 size_t DirtyCardQueueSet::num_par_ids() { 75 size_t DirtyCardQueueSet::num_par_ids() {
75 return MAX2(ParallelGCThreads, (size_t)2); 76 return os::processor_count();
76 } 77 }
77
78 78
79 void DirtyCardQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock, 79 void DirtyCardQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
80 int max_completed_queue, 80 int max_completed_queue,
81 Mutex* lock, PtrQueueSet* fl_owner) { 81 Mutex* lock, PtrQueueSet* fl_owner) {
82 PtrQueueSet::initialize(cbl_mon, fl_lock, max_completed_queue, fl_owner); 82 PtrQueueSet::initialize(cbl_mon, fl_lock, max_completed_queue, fl_owner);
83 set_buffer_size(DCQBarrierQueueBufferSize); 83 set_buffer_size(DCQBarrierQueueBufferSize);
84 set_process_completed_threshold(DCQBarrierProcessCompletedThreshold); 84 set_process_completed_threshold(DCQBarrierProcessCompletedThreshold);
85 85
86 _shared_dirty_card_queue.set_lock(lock); 86 _shared_dirty_card_queue.set_lock(lock);
87 _free_ids = new FreeIdSet((int) num_par_ids(), _cbl_mon); 87 _free_ids = new FreeIdSet((int) num_par_ids(), _cbl_mon);
88 bool b = _free_ids->claim_perm_id(0);
89 guarantee(b, "Must reserve id zero for concurrent refinement thread.");
90 } 88 }
91 89
92 void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) { 90 void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
93 t->dirty_card_queue().handle_zero_index(); 91 t->dirty_card_queue().handle_zero_index();
94 } 92 }