comparison src/share/vm/gc_implementation/g1/heapRegion.hpp @ 20272:e635a728f9da

8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC Reviewed-by: stefank, tschatzl
author mgerdin
date Wed, 25 Jun 2014 10:55:10 +0200
parents 78bbf4d43a14
children 9441d22e429a
comparison
equal deleted inserted replaced
20271:c64b6b0c40c8 20272:e635a728f9da
69 // A dirty card to oop closure for heap regions. It 69 // A dirty card to oop closure for heap regions. It
70 // knows how to get the G1 heap and how to use the bitmap 70 // knows how to get the G1 heap and how to use the bitmap
71 // in the concurrent marker used by G1 to filter remembered 71 // in the concurrent marker used by G1 to filter remembered
72 // sets. 72 // sets.
73 73
74 class HeapRegionDCTOC : public ContiguousSpaceDCTOC { 74 class HeapRegionDCTOC : public DirtyCardToOopClosure {
75 public: 75 public:
76 // Specification of possible DirtyCardToOopClosure filtering. 76 // Specification of possible DirtyCardToOopClosure filtering.
77 enum FilterKind { 77 enum FilterKind {
78 NoFilterKind, 78 NoFilterKind,
79 IntoCSFilterKind, 79 IntoCSFilterKind,
83 protected: 83 protected:
84 HeapRegion* _hr; 84 HeapRegion* _hr;
85 FilterKind _fk; 85 FilterKind _fk;
86 G1CollectedHeap* _g1; 86 G1CollectedHeap* _g1;
87 87
88 void walk_mem_region_with_cl(MemRegion mr,
89 HeapWord* bottom, HeapWord* top,
90 ExtendedOopClosure* cl);
91
92 // We don't specialize this for FilteringClosure; filtering is handled by
93 // the "FilterKind" mechanism. But we provide this to avoid a compiler
94 // warning.
95 void walk_mem_region_with_cl(MemRegion mr,
96 HeapWord* bottom, HeapWord* top,
97 FilteringClosure* cl) {
98 HeapRegionDCTOC::walk_mem_region_with_cl(mr, bottom, top,
99 (ExtendedOopClosure*)cl);
100 }
101
102 // Get the actual top of the area on which the closure will
103 // operate, given where the top is assumed to be (the end of the
104 // memory region passed to do_MemRegion) and where the object
105 // at the top is assumed to start. For example, an object may
106 // start at the top but actually extend past the assumed top,
107 // in which case the top becomes the end of the object.
108 HeapWord* get_actual_top(HeapWord* top, HeapWord* top_obj) {
109 return ContiguousSpaceDCTOC::get_actual_top(top, top_obj);
110 }
111
112 // Walk the given memory region from bottom to (actual) top 88 // Walk the given memory region from bottom to (actual) top
113 // looking for objects and applying the oop closure (_cl) to 89 // looking for objects and applying the oop closure (_cl) to
114 // them. The base implementation of this treats the area as 90 // them. The base implementation of this treats the area as
115 // blocks, where a block may or may not be an object. Sub- 91 // blocks, where a block may or may not be an object. Sub-
116 // classes should override this to provide more accurate 92 // classes should override this to provide more accurate
117 // or possibly more efficient walking. 93 // or possibly more efficient walking.
118 void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top) { 94 void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
119 Filtering_DCTOC::walk_mem_region(mr, bottom, top);
120 }
121 95
122 public: 96 public:
123 HeapRegionDCTOC(G1CollectedHeap* g1, 97 HeapRegionDCTOC(G1CollectedHeap* g1,
124 HeapRegion* hr, ExtendedOopClosure* cl, 98 HeapRegion* hr, ExtendedOopClosure* cl,
125 CardTableModRefBS::PrecisionStyle precision, 99 CardTableModRefBS::PrecisionStyle precision,