37 #include "gc/g1/g1SATBCardTableModRefBS.hpp" |
37 #include "gc/g1/g1SATBCardTableModRefBS.hpp" |
38 #include "gc/g1/g1YCTypes.hpp" |
38 #include "gc/g1/g1YCTypes.hpp" |
39 #include "gc/g1/hSpaceCounters.hpp" |
39 #include "gc/g1/hSpaceCounters.hpp" |
40 #include "gc/g1/heapRegionManager.hpp" |
40 #include "gc/g1/heapRegionManager.hpp" |
41 #include "gc/g1/heapRegionSet.hpp" |
41 #include "gc/g1/heapRegionSet.hpp" |
|
42 #include "gc/g1/youngList.hpp" |
42 #include "gc/shared/barrierSet.hpp" |
43 #include "gc/shared/barrierSet.hpp" |
43 #include "gc/shared/collectedHeap.hpp" |
44 #include "gc/shared/collectedHeap.hpp" |
44 #include "gc/shared/plab.hpp" |
45 #include "gc/shared/plab.hpp" |
45 #include "memory/memRegion.hpp" |
46 #include "memory/memRegion.hpp" |
46 #include "utilities/stack.hpp" |
47 #include "utilities/stack.hpp" |
86 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet; |
87 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet; |
87 |
88 |
88 typedef int RegionIdx_t; // needs to hold [ 0..max_regions() ) |
89 typedef int RegionIdx_t; // needs to hold [ 0..max_regions() ) |
89 typedef int CardIdx_t; // needs to hold [ 0..CardsPerRegion ) |
90 typedef int CardIdx_t; // needs to hold [ 0..CardsPerRegion ) |
90 |
91 |
91 class YoungList : public CHeapObj<mtGC> { |
|
92 private: |
|
93 G1CollectedHeap* _g1h; |
|
94 |
|
95 HeapRegion* _head; |
|
96 |
|
97 HeapRegion* _survivor_head; |
|
98 HeapRegion* _survivor_tail; |
|
99 |
|
100 HeapRegion* _curr; |
|
101 |
|
102 uint _length; |
|
103 uint _survivor_length; |
|
104 |
|
105 size_t _last_sampled_rs_lengths; |
|
106 size_t _sampled_rs_lengths; |
|
107 |
|
108 void empty_list(HeapRegion* list); |
|
109 |
|
110 public: |
|
111 YoungList(G1CollectedHeap* g1h); |
|
112 |
|
113 void push_region(HeapRegion* hr); |
|
114 void add_survivor_region(HeapRegion* hr); |
|
115 |
|
116 void empty_list(); |
|
117 bool is_empty() { return _length == 0; } |
|
118 uint length() { return _length; } |
|
119 uint eden_length() { return length() - survivor_length(); } |
|
120 uint survivor_length() { return _survivor_length; } |
|
121 |
|
122 // Currently we do not keep track of the used byte sum for the |
|
123 // young list and the survivors and it'd be quite a lot of work to |
|
124 // do so. When we'll eventually replace the young list with |
|
125 // instances of HeapRegionLinkedList we'll get that for free. So, |
|
126 // we'll report the more accurate information then. |
|
127 size_t eden_used_bytes() { |
|
128 assert(length() >= survivor_length(), "invariant"); |
|
129 return (size_t) eden_length() * HeapRegion::GrainBytes; |
|
130 } |
|
131 size_t survivor_used_bytes() { |
|
132 return (size_t) survivor_length() * HeapRegion::GrainBytes; |
|
133 } |
|
134 |
|
135 void rs_length_sampling_init(); |
|
136 bool rs_length_sampling_more(); |
|
137 void rs_length_sampling_next(); |
|
138 |
|
139 void reset_sampled_info() { |
|
140 _last_sampled_rs_lengths = 0; |
|
141 } |
|
142 size_t sampled_rs_lengths() { return _last_sampled_rs_lengths; } |
|
143 |
|
144 // for development purposes |
|
145 void reset_auxilary_lists(); |
|
146 void clear() { _head = NULL; _length = 0; } |
|
147 |
|
148 void clear_survivors() { |
|
149 _survivor_head = NULL; |
|
150 _survivor_tail = NULL; |
|
151 _survivor_length = 0; |
|
152 } |
|
153 |
|
154 HeapRegion* first_region() { return _head; } |
|
155 HeapRegion* first_survivor_region() { return _survivor_head; } |
|
156 HeapRegion* last_survivor_region() { return _survivor_tail; } |
|
157 |
|
158 // debugging |
|
159 bool check_list_well_formed(); |
|
160 bool check_list_empty(bool check_sample = true); |
|
161 void print(); |
|
162 }; |
|
163 |
|
164 // The G1 STW is alive closure. |
92 // The G1 STW is alive closure. |
165 // An instance is embedded into the G1CH and used as the |
93 // An instance is embedded into the G1CH and used as the |
166 // (optional) _is_alive_non_header closure in the STW |
94 // (optional) _is_alive_non_header closure in the STW |
167 // reference processor. It is also extensively used during |
95 // reference processor. It is also extensively used during |
168 // reference processing during STW evacuation pauses. |
96 // reference processing during STW evacuation pauses. |