46 friend class PSScavenge; |
46 friend class PSScavenge; |
47 friend class PSRefProcTaskExecutor; |
47 friend class PSRefProcTaskExecutor; |
48 private: |
48 private: |
49 static PSPromotionManager** _manager_array; |
49 static PSPromotionManager** _manager_array; |
50 static OopStarTaskQueueSet* _stack_array_depth; |
50 static OopStarTaskQueueSet* _stack_array_depth; |
51 static OopTaskQueueSet* _stack_array_breadth; |
|
52 static PSOldGen* _old_gen; |
51 static PSOldGen* _old_gen; |
53 static MutableSpace* _young_space; |
52 static MutableSpace* _young_space; |
54 |
53 |
55 #if TASKQUEUE_STATS |
54 #if TASKQUEUE_STATS |
56 size_t _masked_pushes; |
55 size_t _masked_pushes; |
67 |
66 |
68 PSYoungPromotionLAB _young_lab; |
67 PSYoungPromotionLAB _young_lab; |
69 PSOldPromotionLAB _old_lab; |
68 PSOldPromotionLAB _old_lab; |
70 bool _young_gen_is_full; |
69 bool _young_gen_is_full; |
71 bool _old_gen_is_full; |
70 bool _old_gen_is_full; |
72 PrefetchQueue _prefetch_queue; |
|
73 |
71 |
74 OopStarTaskQueue _claimed_stack_depth; |
72 OopStarTaskQueue _claimed_stack_depth; |
75 OverflowTaskQueue<oop> _claimed_stack_breadth; |
73 OverflowTaskQueue<oop> _claimed_stack_breadth; |
76 |
74 |
77 bool _depth_first; |
|
78 bool _totally_drain; |
75 bool _totally_drain; |
79 uint _target_stack_size; |
76 uint _target_stack_size; |
80 |
77 |
81 uint _array_chunk_size; |
78 uint _array_chunk_size; |
82 uint _min_array_size_for_chunking; |
79 uint _min_array_size_for_chunking; |
85 static PSOldGen* old_gen() { return _old_gen; } |
82 static PSOldGen* old_gen() { return _old_gen; } |
86 static MutableSpace* young_space() { return _young_space; } |
83 static MutableSpace* young_space() { return _young_space; } |
87 |
84 |
88 inline static PSPromotionManager* manager_array(int index); |
85 inline static PSPromotionManager* manager_array(int index); |
89 template <class T> inline void claim_or_forward_internal_depth(T* p); |
86 template <class T> inline void claim_or_forward_internal_depth(T* p); |
90 template <class T> inline void claim_or_forward_internal_breadth(T* p); |
|
91 |
87 |
92 // On the task queues we push reference locations as well as |
88 // On the task queues we push reference locations as well as |
93 // partially-scanned arrays (in the latter case, we push an oop to |
89 // partially-scanned arrays (in the latter case, we push an oop to |
94 // the from-space image of the array and the length on the |
90 // the from-space image of the array and the length on the |
95 // from-space image indicates how many entries on the array we still |
91 // from-space image indicates how many entries on the array we still |
134 template <class T> void process_array_chunk_work(oop obj, |
130 template <class T> void process_array_chunk_work(oop obj, |
135 int start, int end); |
131 int start, int end); |
136 void process_array_chunk(oop old); |
132 void process_array_chunk(oop old); |
137 |
133 |
138 template <class T> void push_depth(T* p) { |
134 template <class T> void push_depth(T* p) { |
139 assert(depth_first(), "pre-condition"); |
|
140 claimed_stack_depth()->push(p); |
135 claimed_stack_depth()->push(p); |
141 } |
|
142 |
|
143 void push_breadth(oop o) { |
|
144 assert(!depth_first(), "pre-condition"); |
|
145 claimed_stack_breadth()->push(o); |
|
146 } |
136 } |
147 |
137 |
148 protected: |
138 protected: |
149 static OopStarTaskQueueSet* stack_array_depth() { return _stack_array_depth; } |
139 static OopStarTaskQueueSet* stack_array_depth() { return _stack_array_depth; } |
150 static OopTaskQueueSet* stack_array_breadth() { return _stack_array_breadth; } |
|
151 |
|
152 public: |
140 public: |
153 // Static |
141 // Static |
154 static void initialize(); |
142 static void initialize(); |
155 |
143 |
156 static void pre_scavenge(); |
144 static void pre_scavenge(); |
161 |
149 |
162 static bool steal_depth(int queue_num, int* seed, StarTask& t) { |
150 static bool steal_depth(int queue_num, int* seed, StarTask& t) { |
163 return stack_array_depth()->steal(queue_num, seed, t); |
151 return stack_array_depth()->steal(queue_num, seed, t); |
164 } |
152 } |
165 |
153 |
166 static bool steal_breadth(int queue_num, int* seed, oop& t) { |
|
167 return stack_array_breadth()->steal(queue_num, seed, t); |
|
168 } |
|
169 |
|
170 PSPromotionManager(); |
154 PSPromotionManager(); |
171 |
155 |
172 // Accessors |
156 // Accessors |
173 OopStarTaskQueue* claimed_stack_depth() { |
157 OopStarTaskQueue* claimed_stack_depth() { |
174 return &_claimed_stack_depth; |
158 return &_claimed_stack_depth; |
175 } |
|
176 OverflowTaskQueue<oop>* claimed_stack_breadth() { |
|
177 return &_claimed_stack_breadth; |
|
178 } |
159 } |
179 |
160 |
180 bool young_gen_is_full() { return _young_gen_is_full; } |
161 bool young_gen_is_full() { return _young_gen_is_full; } |
181 |
162 |
182 bool old_gen_is_full() { return _old_gen_is_full; } |
163 bool old_gen_is_full() { return _old_gen_is_full; } |
183 void set_old_gen_is_full(bool state) { _old_gen_is_full = state; } |
164 void set_old_gen_is_full(bool state) { _old_gen_is_full = state; } |
184 |
165 |
185 // Promotion methods |
166 // Promotion methods |
186 oop copy_to_survivor_space(oop o, bool depth_first); |
167 oop copy_to_survivor_space(oop o); |
187 oop oop_promotion_failed(oop obj, markOop obj_mark); |
168 oop oop_promotion_failed(oop obj, markOop obj_mark); |
188 |
169 |
189 void reset(); |
170 void reset(); |
190 |
171 |
191 void flush_labs(); |
172 void flush_labs(); |
192 void drain_stacks(bool totally_drain) { |
173 void drain_stacks(bool totally_drain) { |
193 if (depth_first()) { |
174 drain_stacks_depth(totally_drain); |
194 drain_stacks_depth(totally_drain); |
|
195 } else { |
|
196 drain_stacks_breadth(totally_drain); |
|
197 } |
|
198 } |
175 } |
199 public: |
176 public: |
200 void drain_stacks_cond_depth() { |
177 void drain_stacks_cond_depth() { |
201 if (claimed_stack_depth()->size() > _target_stack_size) { |
178 if (claimed_stack_depth()->size() > _target_stack_size) { |
202 drain_stacks_depth(false); |
179 drain_stacks_depth(false); |
203 } |
180 } |
204 } |
181 } |
205 void drain_stacks_depth(bool totally_drain); |
182 void drain_stacks_depth(bool totally_drain); |
206 void drain_stacks_breadth(bool totally_drain); |
|
207 |
183 |
208 bool depth_first() const { |
|
209 return _depth_first; |
|
210 } |
|
211 bool stacks_empty() { |
184 bool stacks_empty() { |
212 return depth_first() ? |
185 return claimed_stack_depth()->is_empty(); |
213 claimed_stack_depth()->is_empty() : |
|
214 claimed_stack_breadth()->is_empty(); |
|
215 } |
186 } |
216 |
187 |
217 inline void process_popped_location_depth(StarTask p); |
188 inline void process_popped_location_depth(StarTask p); |
218 |
189 |
219 inline void flush_prefetch_queue(); |
|
220 template <class T> inline void claim_or_forward_depth(T* p); |
190 template <class T> inline void claim_or_forward_depth(T* p); |
221 template <class T> inline void claim_or_forward_breadth(T* p); |
|
222 |
191 |
223 TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) |
192 TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) |
224 }; |
193 }; |