Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/g1RemSet.cpp @ 4097:dc467e8b2c5e
7112743: G1: Reduce overhead of marking closure during evacuation pauses
Summary: Parallelize the serial code that was used to mark objects reachable from survivor objects in the collection set. Some minor improvments in the timers used to track the freeing of the collection set along with some tweaks to PrintGCDetails.
Reviewed-by: tonyp, brutisso
author | johnc |
---|---|
date | Thu, 17 Nov 2011 12:40:15 -0800 |
parents | bca17e38de00 |
children | 441e946dc1af |
comparison
equal
deleted
inserted
replaced
4096:00dd86e542eb | 4097:dc467e8b2c5e |
---|---|
207 } | 207 } |
208 size_t cards_done() { return _cards_done;} | 208 size_t cards_done() { return _cards_done;} |
209 size_t cards_looked_up() { return _cards;} | 209 size_t cards_looked_up() { return _cards;} |
210 }; | 210 }; |
211 | 211 |
212 // We want the parallel threads to start their scanning at | |
213 // different collection set regions to avoid contention. | |
214 // If we have: | |
215 // n collection set regions | |
216 // p threads | |
217 // Then thread t will start at region t * floor (n/p) | |
218 | |
219 HeapRegion* G1RemSet::calculateStartRegion(int worker_i) { | |
220 HeapRegion* result = _g1p->collection_set(); | |
221 if (G1CollectedHeap::use_parallel_gc_threads()) { | |
222 size_t cs_size = _g1p->cset_region_length(); | |
223 int n_workers = _g1->workers()->total_workers(); | |
224 size_t cs_spans = cs_size / n_workers; | |
225 size_t ind = cs_spans * worker_i; | |
226 for (size_t i = 0; i < ind; i++) | |
227 result = result->next_in_collection_set(); | |
228 } | |
229 return result; | |
230 } | |
231 | |
232 void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, int worker_i) { | 212 void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, int worker_i) { |
233 double rs_time_start = os::elapsedTime(); | 213 double rs_time_start = os::elapsedTime(); |
234 HeapRegion *startRegion = calculateStartRegion(worker_i); | 214 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i); |
235 | 215 |
236 ScanRSClosure scanRScl(oc, worker_i); | 216 ScanRSClosure scanRScl(oc, worker_i); |
237 | 217 |
238 _g1->collection_set_iterate_from(startRegion, &scanRScl); | 218 _g1->collection_set_iterate_from(startRegion, &scanRScl); |
239 scanRScl.set_try_claimed(); | 219 scanRScl.set_try_claimed(); |