< prev index next >

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

Print this page
rev 12906 : [mq]: gc_interface


  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_HEAPREGION_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGION_HPP
  27 
  28 #include "gc/g1/g1AllocationContext.hpp"
  29 #include "gc/g1/g1BlockOffsetTable.hpp"
  30 #include "gc/g1/g1HeapRegionTraceType.hpp"
  31 #include "gc/g1/heapRegionTracer.hpp"
  32 #include "gc/g1/heapRegionType.hpp"
  33 #include "gc/g1/survRateGroup.hpp"
  34 #include "gc/shared/ageTable.hpp"

  35 #include "gc/shared/spaceDecorator.hpp"
  36 #include "utilities/macros.hpp"
  37 
  38 // A HeapRegion is the smallest piece of a G1CollectedHeap that
  39 // can be collected independently.
  40 
  41 // NOTE: Although a HeapRegion is a Space, its
  42 // Space::initDirtyCardClosure method must not be called.
  43 // The problem is that the existence of this method breaks
  44 // the independence of barrier sets from remembered sets.
  45 // The solution is to remove this method from the definition
  46 // of a Space.
  47 
  48 // Each heap region is self contained. top() and end() can never
  49 // be set beyond the end of the region. For humongous objects,
  50 // the first region is a StartsHumongous region. If the humongous
  51 // object is larger than a heap region, the following regions will
  52 // be of type ContinuesHumongous. In this case the top() of the
  53 // StartHumongous region and all ContinuesHumongous regions except
  54 // the last will point to their own end. The last ContinuesHumongous


  77 // sets.
  78 
  79 class HeapRegionDCTOC : public DirtyCardToOopClosure {
  80 private:
  81   HeapRegion* _hr;
  82   G1ParPushHeapRSClosure* _rs_scan;
  83   G1CollectedHeap* _g1;
  84 
  85   // Walk the given memory region from bottom to (actual) top
  86   // looking for objects and applying the oop closure (_cl) to
  87   // them. The base implementation of this treats the area as
  88   // blocks, where a block may or may not be an object. Sub-
  89   // classes should override this to provide more accurate
  90   // or possibly more efficient walking.
  91   void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
  92 
  93 public:
  94   HeapRegionDCTOC(G1CollectedHeap* g1,
  95                   HeapRegion* hr,
  96                   G1ParPushHeapRSClosure* cl,
  97                   CardTableModRefBS::PrecisionStyle precision);
  98 };
  99 
 100 // The complicating factor is that BlockOffsetTable diverged
 101 // significantly, and we need functionality that is only in the G1 version.
 102 // So I copied that code, which led to an alternate G1 version of
 103 // OffsetTableContigSpace.  If the two versions of BlockOffsetTable could
 104 // be reconciled, then G1OffsetTableContigSpace could go away.
 105 
 106 // The idea behind time stamps is the following. We want to keep track of
 107 // the highest address where it's safe to scan objects for each region.
 108 // This is only relevant for current GC alloc regions so we keep a time stamp
 109 // per region to determine if the region has been allocated during the current
 110 // GC or not. If the time stamp is current we report a scan_top value which
 111 // was saved at the end of the previous GC for retained alloc regions and which is
 112 // equal to the bottom for all other regions.
 113 // There is a race between card scanners and allocating gc workers where we must ensure
 114 // that card scanners do not read the memory allocated by the gc workers.
 115 // In order to enforce that, we must not return a value of _top which is more recent than the
 116 // time stamp. This is due to the fact that a region may become a gc alloc region at
 117 // some point after we've read the timestamp value as being < the current time stamp.




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_HEAPREGION_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGION_HPP
  27 
  28 #include "gc/g1/g1AllocationContext.hpp"
  29 #include "gc/g1/g1BlockOffsetTable.hpp"
  30 #include "gc/g1/g1HeapRegionTraceType.hpp"
  31 #include "gc/g1/heapRegionTracer.hpp"
  32 #include "gc/g1/heapRegionType.hpp"
  33 #include "gc/g1/survRateGroup.hpp"
  34 #include "gc/shared/ageTable.hpp"
  35 #include "gc/shared/cardTable.hpp"
  36 #include "gc/shared/spaceDecorator.hpp"
  37 #include "utilities/macros.hpp"
  38 
  39 // A HeapRegion is the smallest piece of a G1CollectedHeap that
  40 // can be collected independently.
  41 
  42 // NOTE: Although a HeapRegion is a Space, its
  43 // Space::initDirtyCardClosure method must not be called.
  44 // The problem is that the existence of this method breaks
  45 // the independence of barrier sets from remembered sets.
  46 // The solution is to remove this method from the definition
  47 // of a Space.
  48 
  49 // Each heap region is self contained. top() and end() can never
  50 // be set beyond the end of the region. For humongous objects,
  51 // the first region is a StartsHumongous region. If the humongous
  52 // object is larger than a heap region, the following regions will
  53 // be of type ContinuesHumongous. In this case the top() of the
  54 // StartHumongous region and all ContinuesHumongous regions except
  55 // the last will point to their own end. The last ContinuesHumongous


  78 // sets.
  79 
  80 class HeapRegionDCTOC : public DirtyCardToOopClosure {
  81 private:
  82   HeapRegion* _hr;
  83   G1ParPushHeapRSClosure* _rs_scan;
  84   G1CollectedHeap* _g1;
  85 
  86   // Walk the given memory region from bottom to (actual) top
  87   // looking for objects and applying the oop closure (_cl) to
  88   // them. The base implementation of this treats the area as
  89   // blocks, where a block may or may not be an object. Sub-
  90   // classes should override this to provide more accurate
  91   // or possibly more efficient walking.
  92   void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
  93 
  94 public:
  95   HeapRegionDCTOC(G1CollectedHeap* g1,
  96                   HeapRegion* hr,
  97                   G1ParPushHeapRSClosure* cl,
  98                   CardTable::PrecisionStyle precision);
  99 };
 100 
 101 // The complicating factor is that BlockOffsetTable diverged
 102 // significantly, and we need functionality that is only in the G1 version.
 103 // So I copied that code, which led to an alternate G1 version of
 104 // OffsetTableContigSpace.  If the two versions of BlockOffsetTable could
 105 // be reconciled, then G1OffsetTableContigSpace could go away.
 106 
 107 // The idea behind time stamps is the following. We want to keep track of
 108 // the highest address where it's safe to scan objects for each region.
 109 // This is only relevant for current GC alloc regions so we keep a time stamp
 110 // per region to determine if the region has been allocated during the current
 111 // GC or not. If the time stamp is current we report a scan_top value which
 112 // was saved at the end of the previous GC for retained alloc regions and which is
 113 // equal to the bottom for all other regions.
 114 // There is a race between card scanners and allocating gc workers where we must ensure
 115 // that card scanners do not read the memory allocated by the gc workers.
 116 // In order to enforce that, we must not return a value of _top which is more recent than the
 117 // time stamp. This is due to the fact that a region may become a gc alloc region at
 118 // some point after we've read the timestamp value as being < the current time stamp.


< prev index next >