提交 8f3fa589 编写于 作者: M mgerdin

8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC

Reviewed-by: stefank, tschatzl
上级 35663fc8
...@@ -48,7 +48,7 @@ HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, ...@@ -48,7 +48,7 @@ HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1,
HeapRegion* hr, ExtendedOopClosure* cl, HeapRegion* hr, ExtendedOopClosure* cl,
CardTableModRefBS::PrecisionStyle precision, CardTableModRefBS::PrecisionStyle precision,
FilterKind fk) : FilterKind fk) :
ContiguousSpaceDCTOC(hr, cl, precision, NULL), DirtyCardToOopClosure(hr, cl, precision, NULL),
_hr(hr), _fk(fk), _g1(g1) { } _hr(hr), _fk(fk), _g1(g1) { }
FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r, FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r,
...@@ -77,19 +77,18 @@ HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h, ...@@ -77,19 +77,18 @@ HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h,
return cur; return cur;
} }
void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, void HeapRegionDCTOC::walk_mem_region(MemRegion mr,
HeapWord* bottom, HeapWord* bottom,
HeapWord* top, HeapWord* top) {
ExtendedOopClosure* cl) {
G1CollectedHeap* g1h = _g1; G1CollectedHeap* g1h = _g1;
int oop_size; int oop_size;
ExtendedOopClosure* cl2 = NULL; ExtendedOopClosure* cl2 = NULL;
FilterIntoCSClosure intoCSFilt(this, g1h, cl); FilterIntoCSClosure intoCSFilt(this, g1h, _cl);
FilterOutOfRegionClosure outOfRegionFilt(_hr, cl); FilterOutOfRegionClosure outOfRegionFilt(_hr, _cl);
switch (_fk) { switch (_fk) {
case NoFilterKind: cl2 = cl; break; case NoFilterKind: cl2 = _cl; break;
case IntoCSFilterKind: cl2 = &intoCSFilt; break; case IntoCSFilterKind: cl2 = &intoCSFilt; break;
case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break; case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break;
default: ShouldNotReachHere(); default: ShouldNotReachHere();
...@@ -111,17 +110,17 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, ...@@ -111,17 +110,17 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
// We replicate the loop below for several kinds of possible filters. // We replicate the loop below for several kinds of possible filters.
switch (_fk) { switch (_fk) {
case NoFilterKind: case NoFilterKind:
bottom = walk_mem_region_loop(cl, g1h, _hr, bottom, top); bottom = walk_mem_region_loop(_cl, g1h, _hr, bottom, top);
break; break;
case IntoCSFilterKind: { case IntoCSFilterKind: {
FilterIntoCSClosure filt(this, g1h, cl); FilterIntoCSClosure filt(this, g1h, _cl);
bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
break; break;
} }
case OutOfRegionFilterKind: { case OutOfRegionFilterKind: {
FilterOutOfRegionClosure filt(_hr, cl); FilterOutOfRegionClosure filt(_hr, _cl);
bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
break; break;
} }
......
...@@ -71,7 +71,7 @@ class nmethod; ...@@ -71,7 +71,7 @@ class nmethod;
// in the concurrent marker used by G1 to filter remembered // in the concurrent marker used by G1 to filter remembered
// sets. // sets.
class HeapRegionDCTOC : public ContiguousSpaceDCTOC { class HeapRegionDCTOC : public DirtyCardToOopClosure {
public: public:
// Specification of possible DirtyCardToOopClosure filtering. // Specification of possible DirtyCardToOopClosure filtering.
enum FilterKind { enum FilterKind {
...@@ -85,39 +85,13 @@ protected: ...@@ -85,39 +85,13 @@ protected:
FilterKind _fk; FilterKind _fk;
G1CollectedHeap* _g1; G1CollectedHeap* _g1;
void walk_mem_region_with_cl(MemRegion mr,
HeapWord* bottom, HeapWord* top,
ExtendedOopClosure* cl);
// We don't specialize this for FilteringClosure; filtering is handled by
// the "FilterKind" mechanism. But we provide this to avoid a compiler
// warning.
void walk_mem_region_with_cl(MemRegion mr,
HeapWord* bottom, HeapWord* top,
FilteringClosure* cl) {
HeapRegionDCTOC::walk_mem_region_with_cl(mr, bottom, top,
(ExtendedOopClosure*)cl);
}
// Get the actual top of the area on which the closure will
// operate, given where the top is assumed to be (the end of the
// memory region passed to do_MemRegion) and where the object
// at the top is assumed to start. For example, an object may
// start at the top but actually extend past the assumed top,
// in which case the top becomes the end of the object.
HeapWord* get_actual_top(HeapWord* top, HeapWord* top_obj) {
return ContiguousSpaceDCTOC::get_actual_top(top, top_obj);
}
// Walk the given memory region from bottom to (actual) top // Walk the given memory region from bottom to (actual) top
// looking for objects and applying the oop closure (_cl) to // looking for objects and applying the oop closure (_cl) to
// them. The base implementation of this treats the area as // them. The base implementation of this treats the area as
// blocks, where a block may or may not be an object. Sub- // blocks, where a block may or may not be an object. Sub-
// classes should override this to provide more accurate // classes should override this to provide more accurate
// or possibly more efficient walking. // or possibly more efficient walking.
void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top) { void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
Filtering_DCTOC::walk_mem_region(mr, bottom, top);
}
public: public:
HeapRegionDCTOC(G1CollectedHeap* g1, HeapRegionDCTOC(G1CollectedHeap* g1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册