mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-28 11:10:26 +00:00
8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC
Reviewed-by: stefank, tschatzl
This commit is contained in:
parent
c3148bb6cb
commit
5b7c529bb2
@ -49,7 +49,7 @@ HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1,
|
||||
HeapRegion* hr, ExtendedOopClosure* cl,
|
||||
CardTableModRefBS::PrecisionStyle precision,
|
||||
FilterKind fk) :
|
||||
ContiguousSpaceDCTOC(hr, cl, precision, NULL),
|
||||
DirtyCardToOopClosure(hr, cl, precision, NULL),
|
||||
_hr(hr), _fk(fk), _g1(g1) { }
|
||||
|
||||
FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r,
|
||||
@ -78,19 +78,18 @@ HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h,
|
||||
return cur;
|
||||
}
|
||||
|
||||
void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
|
||||
HeapWord* bottom,
|
||||
HeapWord* top,
|
||||
ExtendedOopClosure* cl) {
|
||||
void HeapRegionDCTOC::walk_mem_region(MemRegion mr,
|
||||
HeapWord* bottom,
|
||||
HeapWord* top) {
|
||||
G1CollectedHeap* g1h = _g1;
|
||||
int oop_size;
|
||||
ExtendedOopClosure* cl2 = NULL;
|
||||
|
||||
FilterIntoCSClosure intoCSFilt(this, g1h, cl);
|
||||
FilterOutOfRegionClosure outOfRegionFilt(_hr, cl);
|
||||
FilterIntoCSClosure intoCSFilt(this, g1h, _cl);
|
||||
FilterOutOfRegionClosure outOfRegionFilt(_hr, _cl);
|
||||
|
||||
switch (_fk) {
|
||||
case NoFilterKind: cl2 = cl; break;
|
||||
case NoFilterKind: cl2 = _cl; break;
|
||||
case IntoCSFilterKind: cl2 = &intoCSFilt; break;
|
||||
case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break;
|
||||
default: ShouldNotReachHere();
|
||||
@ -112,17 +111,17 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
|
||||
// We replicate the loop below for several kinds of possible filters.
|
||||
switch (_fk) {
|
||||
case NoFilterKind:
|
||||
bottom = walk_mem_region_loop(cl, g1h, _hr, bottom, top);
|
||||
bottom = walk_mem_region_loop(_cl, g1h, _hr, bottom, top);
|
||||
break;
|
||||
|
||||
case IntoCSFilterKind: {
|
||||
FilterIntoCSClosure filt(this, g1h, cl);
|
||||
FilterIntoCSClosure filt(this, g1h, _cl);
|
||||
bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
|
||||
break;
|
||||
}
|
||||
|
||||
case OutOfRegionFilterKind: {
|
||||
FilterOutOfRegionClosure filt(_hr, cl);
|
||||
FilterOutOfRegionClosure filt(_hr, _cl);
|
||||
bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ class nmethod;
|
||||
// in the concurrent marker used by G1 to filter remembered
|
||||
// sets.
|
||||
|
||||
class HeapRegionDCTOC : public ContiguousSpaceDCTOC {
|
||||
class HeapRegionDCTOC : public DirtyCardToOopClosure {
|
||||
public:
|
||||
// Specification of possible DirtyCardToOopClosure filtering.
|
||||
enum FilterKind {
|
||||
@ -85,39 +85,13 @@ protected:
|
||||
FilterKind _fk;
|
||||
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
|
||||
// looking for objects and applying the oop closure (_cl) to
|
||||
// them. The base implementation of this treats the area as
|
||||
// blocks, where a block may or may not be an object. Sub-
|
||||
// classes should override this to provide more accurate
|
||||
// or possibly more efficient walking.
|
||||
void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top) {
|
||||
Filtering_DCTOC::walk_mem_region(mr, bottom, top);
|
||||
}
|
||||
void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
|
||||
|
||||
public:
|
||||
HeapRegionDCTOC(G1CollectedHeap* g1,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user