21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1ALLOCREGION_HPP
26 #define SHARE_VM_GC_G1_G1ALLOCREGION_HPP
27
28 #include "gc/g1/heapRegion.hpp"
29 #include "gc/g1/g1EvacStats.hpp"
30 #include "gc/g1/g1InCSetState.hpp"
31
32 class G1CollectedHeap;
33
34 // A class that holds a region that is active in satisfying allocation
35 // requests, potentially issued in parallel. When the active region is
36 // full it will be retired and replaced with a new one. The
37 // implementation assumes that fast-path allocations will be lock-free
38 // and a lock will need to be taken when the active region needs to be
39 // replaced.
40
41 class G1AllocRegion VALUE_OBJ_CLASS_SPEC {
42
43 private:
44 // The active allocating region we are currently allocating out
45 // of. The invariant is that if this object is initialized (i.e.,
46 // init() has been called and release() has not) then _alloc_region
47 // is either an active allocating region or the dummy region (i.e.,
48 // it can never be NULL) and this object can be used to satisfy
49 // allocation requests. If this object is not initialized
50 // (i.e. init() has not been called or release() has been called)
51 // then _alloc_region is NULL and this object should not be used to
52 // satisfy allocation requests (it was done this way to force the
53 // correct use of init() and release()).
54 HeapRegion* volatile _alloc_region;
55
56 // It keeps track of the distinct number of regions that are used
57 // for allocation in the active interval of this object, i.e.,
58 // between a call to init() and a call to release(). The count
59 // mostly includes regions that are freshly allocated, as well as
60 // the region that is re-used using the set() method. This count can
61 // be used in any heuristics that might want to bound how many
|
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1ALLOCREGION_HPP
26 #define SHARE_VM_GC_G1_G1ALLOCREGION_HPP
27
28 #include "gc/g1/heapRegion.hpp"
29 #include "gc/g1/g1EvacStats.hpp"
30 #include "gc/g1/g1InCSetState.hpp"
31
32 class G1CollectedHeap;
33
34 // A class that holds a region that is active in satisfying allocation
35 // requests, potentially issued in parallel. When the active region is
36 // full it will be retired and replaced with a new one. The
37 // implementation assumes that fast-path allocations will be lock-free
38 // and a lock will need to be taken when the active region needs to be
39 // replaced.
40
41 class G1AllocRegion {
42
43 private:
44 // The active allocating region we are currently allocating out
45 // of. The invariant is that if this object is initialized (i.e.,
46 // init() has been called and release() has not) then _alloc_region
47 // is either an active allocating region or the dummy region (i.e.,
48 // it can never be NULL) and this object can be used to satisfy
49 // allocation requests. If this object is not initialized
50 // (i.e. init() has not been called or release() has been called)
51 // then _alloc_region is NULL and this object should not be used to
52 // satisfy allocation requests (it was done this way to force the
53 // correct use of init() and release()).
54 HeapRegion* volatile _alloc_region;
55
56 // It keeps track of the distinct number of regions that are used
57 // for allocation in the active interval of this object, i.e.,
58 // between a call to init() and a call to release(). The count
59 // mostly includes regions that are freshly allocated, as well as
60 // the region that is re-used using the set() method. This count can
61 // be used in any heuristics that might want to bound how many
|