1.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp Mon Feb 02 10:38:39 2015 +0100 1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp Mon Dec 08 18:57:33 2014 +0100 1.3 @@ -47,93 +47,55 @@ 1.4 size_t HeapRegion::CardsPerRegion = 0; 1.5 1.6 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, 1.7 - HeapRegion* hr, ExtendedOopClosure* cl, 1.8 - CardTableModRefBS::PrecisionStyle precision, 1.9 - FilterKind fk) : 1.10 + HeapRegion* hr, 1.11 + G1ParPushHeapRSClosure* cl, 1.12 + CardTableModRefBS::PrecisionStyle precision) : 1.13 DirtyCardToOopClosure(hr, cl, precision, NULL), 1.14 - _hr(hr), _fk(fk), _g1(g1) { } 1.15 + _hr(hr), _rs_scan(cl), _g1(g1) { } 1.16 1.17 FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r, 1.18 OopClosure* oc) : 1.19 _r_bottom(r->bottom()), _r_end(r->end()), _oc(oc) { } 1.20 1.21 -template<class ClosureType> 1.22 -HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h, 1.23 - HeapRegion* hr, 1.24 - HeapWord* cur, HeapWord* top) { 1.25 - oop cur_oop = oop(cur); 1.26 - size_t oop_size = hr->block_size(cur); 1.27 - HeapWord* next_obj = cur + oop_size; 1.28 - while (next_obj < top) { 1.29 - // Keep filtering the remembered set. 1.30 - if (!g1h->is_obj_dead(cur_oop, hr)) { 1.31 - // Bottom lies entirely below top, so we can call the 1.32 - // non-memRegion version of oop_iterate below. 1.33 - cur_oop->oop_iterate(cl); 1.34 - } 1.35 - cur = next_obj; 1.36 - cur_oop = oop(cur); 1.37 - oop_size = hr->block_size(cur); 1.38 - next_obj = cur + oop_size; 1.39 - } 1.40 - return cur; 1.41 -} 1.42 - 1.43 void HeapRegionDCTOC::walk_mem_region(MemRegion mr, 1.44 HeapWord* bottom, 1.45 HeapWord* top) { 1.46 G1CollectedHeap* g1h = _g1; 1.47 size_t oop_size; 1.48 - ExtendedOopClosure* cl2 = NULL; 1.49 - 1.50 - FilterIntoCSClosure intoCSFilt(this, g1h, _cl); 1.51 - FilterOutOfRegionClosure outOfRegionFilt(_hr, _cl); 1.52 - 1.53 - switch (_fk) { 1.54 - case NoFilterKind: cl2 = _cl; break; 1.55 - case IntoCSFilterKind: cl2 = &intoCSFilt; break; 1.56 - case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break; 1.57 - default: ShouldNotReachHere(); 1.58 - } 1.59 + HeapWord* cur = bottom; 1.60 1.61 // Start filtering what we add to the remembered set. If the object is 1.62 // not considered dead, either because it is marked (in the mark bitmap) 1.63 // or it was allocated after marking finished, then we add it. Otherwise 1.64 // we can safely ignore the object. 1.65 - if (!g1h->is_obj_dead(oop(bottom), _hr)) { 1.66 - oop_size = oop(bottom)->oop_iterate(cl2, mr); 1.67 + if (!g1h->is_obj_dead(oop(cur), _hr)) { 1.68 + oop_size = oop(cur)->oop_iterate(_rs_scan, mr); 1.69 } else { 1.70 - oop_size = _hr->block_size(bottom); 1.71 + oop_size = _hr->block_size(cur); 1.72 } 1.73 1.74 - bottom += oop_size; 1.75 + cur += oop_size; 1.76 1.77 - if (bottom < top) { 1.78 - // We replicate the loop below for several kinds of possible filters. 1.79 - switch (_fk) { 1.80 - case NoFilterKind: 1.81 - bottom = walk_mem_region_loop(_cl, g1h, _hr, bottom, top); 1.82 - break; 1.83 - 1.84 - case IntoCSFilterKind: { 1.85 - FilterIntoCSClosure filt(this, g1h, _cl); 1.86 - bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); 1.87 - break; 1.88 - } 1.89 - 1.90 - case OutOfRegionFilterKind: { 1.91 - FilterOutOfRegionClosure filt(_hr, _cl); 1.92 - bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); 1.93 - break; 1.94 - } 1.95 - 1.96 - default: 1.97 - ShouldNotReachHere(); 1.98 + if (cur < top) { 1.99 + oop cur_oop = oop(cur); 1.100 + oop_size = _hr->block_size(cur); 1.101 + HeapWord* next_obj = cur + oop_size; 1.102 + while (next_obj < top) { 1.103 + // Keep filtering the remembered set. 1.104 + if (!g1h->is_obj_dead(cur_oop, _hr)) { 1.105 + // Bottom lies entirely below top, so we can call the 1.106 + // non-memRegion version of oop_iterate below. 1.107 + cur_oop->oop_iterate(_rs_scan); 1.108 + } 1.109 + cur = next_obj; 1.110 + cur_oop = oop(cur); 1.111 + oop_size = _hr->block_size(cur); 1.112 + next_obj = cur + oop_size; 1.113 } 1.114 1.115 // Last object. Need to do dead-obj filtering here too. 1.116 - if (!g1h->is_obj_dead(oop(bottom), _hr)) { 1.117 - oop(bottom)->oop_iterate(cl2, mr); 1.118 + if (!g1h->is_obj_dead(oop(cur), _hr)) { 1.119 + oop(cur)->oop_iterate(_rs_scan, mr); 1.120 } 1.121 } 1.122 }