diff -r 87e40b34bc2b -r f44782f04dd4 src/share/vm/gc_implementation/g1/g1AllocRegion.hpp --- a/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp Thu Aug 11 11:36:29 2011 -0700 +++ b/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp Fri Aug 12 11:31:06 2011 -0400 @@ -36,7 +36,7 @@ // A class that holds a region that is active in satisfying allocation // requests, potentially issued in parallel. When the active region is -// full it will be retired it replaced with a new one. The +// full it will be retired and replaced with a new one. The // implementation assumes that fast-path allocations will be lock-free // and a lock will need to be taken when the active region needs to be // replaced. @@ -57,13 +57,22 @@ // correct use of init() and release()). HeapRegion* _alloc_region; + // It keeps track of the distinct number of regions that are used + // for allocation in the active interval of this object, i.e., + // between a call to init() and a call to release(). The count + // mostly includes regions that are freshly allocated, as well as + // the region that is re-used using the set() method. This count can + // be used in any heuristics that might want to bound how many + // distinct regions this object can used during an active interval. + size_t _count; + // When we set up a new active region we save its used bytes in this // field so that, when we retire it, we can calculate how much space // we allocated in it. size_t _used_bytes_before; - // Specifies whether the allocate calls will do BOT updates or not. - bool _bot_updates; + // When true, indicates that allocate calls should do BOT updates. + const bool _bot_updates; // Useful for debugging and tracing. const char* _name; @@ -127,6 +136,8 @@ return (_alloc_region == _dummy_region) ? NULL : _alloc_region; } + size_t count() { return _count; } + // The following two are the building blocks for the allocation method. // First-level allocation: Should be called without holding a @@ -153,6 +164,12 @@ // Should be called before we start using this object. void init(); + // This can be used to set the active region to a specific + // region. (Use Example: we try to retain the last old GC alloc + // region that we've used during a GC and we can use set() to + // re-instate it at the beginning of the next GC.) + void set(HeapRegion* alloc_region); + // Should be called when we want to release the active region which // is returned after it's been retired. HeapRegion* release();