1.1 --- a/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp Mon May 11 16:30:56 2009 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp Mon May 18 11:52:46 2009 -0700 1.3 @@ -33,12 +33,13 @@ 1.4 _threads(NULL), _n_threads(0) 1.5 { 1.6 if (G1ConcRefine) { 1.7 - _n_threads = (G1ParallelRSetThreads > 0) ? G1ParallelRSetThreads : ParallelGCThreads; 1.8 + _n_threads = (int)thread_num(); 1.9 if (_n_threads > 0) { 1.10 _threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads); 1.11 + int worker_id_offset = (int)DirtyCardQueueSet::num_par_ids(); 1.12 ConcurrentG1RefineThread *next = NULL; 1.13 for (int i = _n_threads - 1; i >= 0; i--) { 1.14 - ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, i); 1.15 + ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i); 1.16 assert(t != NULL, "Conc refine should have been created"); 1.17 assert(t->cg1r() == this, "Conc refine thread should refer to this"); 1.18 _threads[i] = t; 1.19 @@ -48,6 +49,13 @@ 1.20 } 1.21 } 1.22 1.23 +size_t ConcurrentG1Refine::thread_num() { 1.24 + if (G1ConcRefine) { 1.25 + return (G1ParallelRSetThreads > 0) ? G1ParallelRSetThreads : ParallelGCThreads; 1.26 + } 1.27 + return 0; 1.28 +} 1.29 + 1.30 void ConcurrentG1Refine::init() { 1.31 if (G1ConcRSLogCacheSize > 0 || G1ConcRSCountTraversals) { 1.32 G1CollectedHeap* g1h = G1CollectedHeap::heap();