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

changeset 3028
f44782f04dd4
parent 2715
abdfc822206f
child 3713
720b6a76dd9d
     1.1 --- a/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Thu Aug 11 11:36:29 2011 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Fri Aug 12 11:31:06 2011 -0400
     1.3 @@ -36,7 +36,7 @@
     1.4  
     1.5  // A class that holds a region that is active in satisfying allocation
     1.6  // requests, potentially issued in parallel. When the active region is
     1.7 -// full it will be retired it replaced with a new one. The
     1.8 +// full it will be retired and replaced with a new one. The
     1.9  // implementation assumes that fast-path allocations will be lock-free
    1.10  // and a lock will need to be taken when the active region needs to be
    1.11  // replaced.
    1.12 @@ -57,13 +57,22 @@
    1.13    // correct use of init() and release()).
    1.14    HeapRegion* _alloc_region;
    1.15  
    1.16 +  // It keeps track of the distinct number of regions that are used
    1.17 +  // for allocation in the active interval of this object, i.e.,
    1.18 +  // between a call to init() and a call to release(). The count
    1.19 +  // mostly includes regions that are freshly allocated, as well as
    1.20 +  // the region that is re-used using the set() method. This count can
    1.21 +  // be used in any heuristics that might want to bound how many
    1.22 +  // distinct regions this object can used during an active interval.
    1.23 +  size_t _count;
    1.24 +
    1.25    // When we set up a new active region we save its used bytes in this
    1.26    // field so that, when we retire it, we can calculate how much space
    1.27    // we allocated in it.
    1.28    size_t _used_bytes_before;
    1.29  
    1.30 -  // Specifies whether the allocate calls will do BOT updates or not.
    1.31 -  bool _bot_updates;
    1.32 +  // When true, indicates that allocate calls should do BOT updates.
    1.33 +  const bool _bot_updates;
    1.34  
    1.35    // Useful for debugging and tracing.
    1.36    const char* _name;
    1.37 @@ -127,6 +136,8 @@
    1.38      return (_alloc_region == _dummy_region) ? NULL : _alloc_region;
    1.39    }
    1.40  
    1.41 +  size_t count() { return _count; }
    1.42 +
    1.43    // The following two are the building blocks for the allocation method.
    1.44  
    1.45    // First-level allocation: Should be called without holding a
    1.46 @@ -153,6 +164,12 @@
    1.47    // Should be called before we start using this object.
    1.48    void init();
    1.49  
    1.50 +  // This can be used to set the active region to a specific
    1.51 +  // region. (Use Example: we try to retain the last old GC alloc
    1.52 +  // region that we've used during a GC and we can use set() to
    1.53 +  // re-instate it at the beginning of the next GC.)
    1.54 +  void set(HeapRegion* alloc_region);
    1.55 +
    1.56    // Should be called when we want to release the active region which
    1.57    // is returned after it's been retired.
    1.58    HeapRegion* release();

mercurial