src/share/vm/gc_implementation/g1/heapRegion.hpp

Print this page
rev 6586 : 8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC
Reviewed-by:


  54 class HeapRegionSetBase;
  55 class nmethod;
  56 
  57 #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
  58 #define HR_FORMAT_PARAMS(_hr_) \
  59                 (_hr_)->hrs_index(), \
  60                 (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \
  61                 (_hr_)->startsHumongous() ? "HS" : \
  62                 (_hr_)->continuesHumongous() ? "HC" : \
  63                 !(_hr_)->is_empty() ? "O" : "F", \
  64                 p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
  65 
  66 // sentinel value for hrs_index
  67 #define G1_NULL_HRS_INDEX ((uint) -1)
  68 
  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
  71 // in the concurrent marker used by G1 to filter remembered
  72 // sets.
  73 
  74 class HeapRegionDCTOC : public ContiguousSpaceDCTOC {
  75 public:
  76   // Specification of possible DirtyCardToOopClosure filtering.
  77   enum FilterKind {
  78     NoFilterKind,
  79     IntoCSFilterKind,
  80     OutOfRegionFilterKind
  81   };
  82 
  83 protected:
  84   HeapRegion* _hr;
  85   FilterKind _fk;
  86   G1CollectedHeap* _g1;
  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
 113   // looking for objects and applying the oop closure (_cl) to
 114   // them. The base implementation of this treats the area as
 115   // blocks, where a block may or may not be an object. Sub-
 116   // classes should override this to provide more accurate
 117   // or possibly more efficient walking.
 118   void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top) {
 119     Filtering_DCTOC::walk_mem_region(mr, bottom, top);
 120   }
 121 
 122 public:
 123   HeapRegionDCTOC(G1CollectedHeap* g1,
 124                   HeapRegion* hr, ExtendedOopClosure* cl,
 125                   CardTableModRefBS::PrecisionStyle precision,
 126                   FilterKind fk);
 127 };
 128 
 129 // The complicating factor is that BlockOffsetTable diverged
 130 // significantly, and we need functionality that is only in the G1 version.
 131 // So I copied that code, which led to an alternate G1 version of
 132 // OffsetTableContigSpace.  If the two versions of BlockOffsetTable could
 133 // be reconciled, then G1OffsetTableContigSpace could go away.
 134 
 135 // The idea behind time stamps is the following. Doing a save_marks on
 136 // all regions at every GC pause is time consuming (if I remember
 137 // well, 10ms or so). So, we would like to do that only for regions
 138 // that are GC alloc regions. To achieve this, we use time
 139 // stamps. For every evacuation pause, G1CollectedHeap generates a
 140 // unique time stamp (essentially a counter that gets




  54 class HeapRegionSetBase;
  55 class nmethod;
  56 
  57 #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
  58 #define HR_FORMAT_PARAMS(_hr_) \
  59                 (_hr_)->hrs_index(), \
  60                 (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \
  61                 (_hr_)->startsHumongous() ? "HS" : \
  62                 (_hr_)->continuesHumongous() ? "HC" : \
  63                 !(_hr_)->is_empty() ? "O" : "F", \
  64                 p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
  65 
  66 // sentinel value for hrs_index
  67 #define G1_NULL_HRS_INDEX ((uint) -1)
  68 
  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
  71 // in the concurrent marker used by G1 to filter remembered
  72 // sets.
  73 
  74 class HeapRegionDCTOC : public DirtyCardToOopClosure {
  75 public:
  76   // Specification of possible DirtyCardToOopClosure filtering.
  77   enum FilterKind {
  78     NoFilterKind,
  79     IntoCSFilterKind,
  80     OutOfRegionFilterKind
  81   };
  82 
  83 protected:
  84   HeapRegion* _hr;
  85   FilterKind _fk;
  86   G1CollectedHeap* _g1;
  87 
























  88   // Walk the given memory region from bottom to (actual) top
  89   // looking for objects and applying the oop closure (_cl) to
  90   // them. The base implementation of this treats the area as
  91   // blocks, where a block may or may not be an object. Sub-
  92   // classes should override this to provide more accurate
  93   // or possibly more efficient walking.
  94   void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);


  95 
  96 public:
  97   HeapRegionDCTOC(G1CollectedHeap* g1,
  98                   HeapRegion* hr, ExtendedOopClosure* cl,
  99                   CardTableModRefBS::PrecisionStyle precision,
 100                   FilterKind fk);
 101 };
 102 
 103 // The complicating factor is that BlockOffsetTable diverged
 104 // significantly, and we need functionality that is only in the G1 version.
 105 // So I copied that code, which led to an alternate G1 version of
 106 // OffsetTableContigSpace.  If the two versions of BlockOffsetTable could
 107 // be reconciled, then G1OffsetTableContigSpace could go away.
 108 
 109 // The idea behind time stamps is the following. Doing a save_marks on
 110 // all regions at every GC pause is time consuming (if I remember
 111 // well, 10ms or so). So, we would like to do that only for regions
 112 // that are GC alloc regions. To achieve this, we use time
 113 // stamps. For every evacuation pause, G1CollectedHeap generates a
 114 // unique time stamp (essentially a counter that gets