1.1 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Wed Mar 25 10:36:08 2009 -0400 1.2 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Wed Mar 25 13:10:54 2009 -0700 1.3 @@ -157,7 +157,6 @@ 1.4 class G1PrepareCompactClosure: public HeapRegionClosure { 1.5 ModRefBarrierSet* _mrbs; 1.6 CompactPoint _cp; 1.7 - bool _popular_only; 1.8 1.9 void free_humongous_region(HeapRegion* hr) { 1.10 HeapWord* bot = hr->bottom(); 1.11 @@ -172,17 +171,11 @@ 1.12 } 1.13 1.14 public: 1.15 - G1PrepareCompactClosure(CompactibleSpace* cs, bool popular_only) : 1.16 + G1PrepareCompactClosure(CompactibleSpace* cs) : 1.17 _cp(NULL, cs, cs->initialize_threshold()), 1.18 - _mrbs(G1CollectedHeap::heap()->mr_bs()), 1.19 - _popular_only(popular_only) 1.20 + _mrbs(G1CollectedHeap::heap()->mr_bs()) 1.21 {} 1.22 bool doHeapRegion(HeapRegion* hr) { 1.23 - if (_popular_only && !hr->popular()) 1.24 - return true; // terminate early 1.25 - else if (!_popular_only && hr->popular()) 1.26 - return false; // skip this one. 1.27 - 1.28 if (hr->isHumongous()) { 1.29 if (hr->startsHumongous()) { 1.30 oop obj = oop(hr->bottom()); 1.31 @@ -203,20 +196,15 @@ 1.32 return false; 1.33 } 1.34 }; 1.35 -// Stolen verbatim from g1CollectedHeap.cpp 1.36 + 1.37 +// Finds the first HeapRegion. 1.38 class FindFirstRegionClosure: public HeapRegionClosure { 1.39 HeapRegion* _a_region; 1.40 - bool _find_popular; 1.41 public: 1.42 - FindFirstRegionClosure(bool find_popular) : 1.43 - _a_region(NULL), _find_popular(find_popular) {} 1.44 + FindFirstRegionClosure() : _a_region(NULL) {} 1.45 bool doHeapRegion(HeapRegion* r) { 1.46 - if (r->popular() == _find_popular) { 1.47 - _a_region = r; 1.48 - return true; 1.49 - } else { 1.50 - return false; 1.51 - } 1.52 + _a_region = r; 1.53 + return true; 1.54 } 1.55 HeapRegion* result() { return _a_region; } 1.56 }; 1.57 @@ -242,30 +230,15 @@ 1.58 TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty); 1.59 GenMarkSweep::trace("2"); 1.60 1.61 - // First we compact the popular regions. 1.62 - if (G1NumPopularRegions > 0) { 1.63 - CompactibleSpace* sp = g1h->first_compactible_space(); 1.64 - FindFirstRegionClosure cl(true /*find_popular*/); 1.65 - g1h->heap_region_iterate(&cl); 1.66 - HeapRegion *r = cl.result(); 1.67 - assert(r->popular(), "should have found a popular region."); 1.68 - assert(r == sp, "first popular heap region should " 1.69 - "== first compactible space"); 1.70 - G1PrepareCompactClosure blk(sp, true/*popular_only*/); 1.71 - g1h->heap_region_iterate(&blk); 1.72 - } 1.73 - 1.74 - // Now we do the regular regions. 1.75 - FindFirstRegionClosure cl(false /*find_popular*/); 1.76 + FindFirstRegionClosure cl; 1.77 g1h->heap_region_iterate(&cl); 1.78 HeapRegion *r = cl.result(); 1.79 - assert(!r->popular(), "should have founda non-popular region."); 1.80 CompactibleSpace* sp = r; 1.81 if (r->isHumongous() && oop(r->bottom())->is_gc_marked()) { 1.82 sp = r->next_compaction_space(); 1.83 } 1.84 1.85 - G1PrepareCompactClosure blk(sp, false/*popular_only*/); 1.86 + G1PrepareCompactClosure blk(sp); 1.87 g1h->heap_region_iterate(&blk); 1.88 1.89 CompactPoint perm_cp(pg, NULL, NULL);