Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 6254:a2f7274eb6ef
7114678: G1: various small fixes, code cleanup, and refactoring
Summary: Various cleanups as a prelude to introducing iterators for HeapRegions.
Reviewed-by: johnc, brutisso
author | tonyp |
---|---|
date | Thu, 19 Jul 2012 15:15:54 -0700 |
parents | b632e80fc9dc |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
6253:db823a892a55 | 6254:a2f7274eb6ef |
---|---|
260 } | 260 } |
261 return false; | 261 return false; |
262 } | 262 } |
263 }; | 263 }; |
264 | 264 |
265 // Finds the first HeapRegion. | |
266 class FindFirstRegionClosure: public HeapRegionClosure { | |
267 HeapRegion* _a_region; | |
268 public: | |
269 FindFirstRegionClosure() : _a_region(NULL) {} | |
270 bool doHeapRegion(HeapRegion* r) { | |
271 _a_region = r; | |
272 return true; | |
273 } | |
274 HeapRegion* result() { return _a_region; } | |
275 }; | |
276 | |
277 void G1MarkSweep::mark_sweep_phase2() { | 265 void G1MarkSweep::mark_sweep_phase2() { |
278 // Now all live objects are marked, compute the new object addresses. | 266 // Now all live objects are marked, compute the new object addresses. |
279 | 267 |
280 // It is imperative that we traverse perm_gen LAST. If dead space is | 268 // It is imperative that we traverse perm_gen LAST. If dead space is |
281 // allowed a range of dead object may get overwritten by a dead int | 269 // allowed a range of dead object may get overwritten by a dead int |
292 Generation* pg = g1h->perm_gen(); | 280 Generation* pg = g1h->perm_gen(); |
293 | 281 |
294 TraceTime tm("phase 2", G1Log::fine() && Verbose, true, gclog_or_tty); | 282 TraceTime tm("phase 2", G1Log::fine() && Verbose, true, gclog_or_tty); |
295 GenMarkSweep::trace("2"); | 283 GenMarkSweep::trace("2"); |
296 | 284 |
297 FindFirstRegionClosure cl; | 285 // find the first region |
298 g1h->heap_region_iterate(&cl); | 286 HeapRegion* r = g1h->region_at(0); |
299 HeapRegion *r = cl.result(); | |
300 CompactibleSpace* sp = r; | 287 CompactibleSpace* sp = r; |
301 if (r->isHumongous() && oop(r->bottom())->is_gc_marked()) { | 288 if (r->isHumongous() && oop(r->bottom())->is_gc_marked()) { |
302 sp = r->next_compaction_space(); | 289 sp = r->next_compaction_space(); |
303 } | 290 } |
304 | 291 |
406 | 393 |
407 G1SpaceCompactClosure blk; | 394 G1SpaceCompactClosure blk; |
408 g1h->heap_region_iterate(&blk); | 395 g1h->heap_region_iterate(&blk); |
409 | 396 |
410 } | 397 } |
411 | |
412 // Local Variables: *** | |
413 // c-indentation-style: gnu *** | |
414 // End: *** |