39 // End move to some global location |
39 // End move to some global location |
40 |
40 |
41 class MutableSpace; |
41 class MutableSpace; |
42 class PSOldGen; |
42 class PSOldGen; |
43 class ParCompactionManager; |
43 class ParCompactionManager; |
44 |
|
45 #define PS_PM_STATS 0 |
|
46 |
44 |
47 class PSPromotionManager : public CHeapObj { |
45 class PSPromotionManager : public CHeapObj { |
48 friend class PSScavenge; |
46 friend class PSScavenge; |
49 friend class PSRefProcTaskExecutor; |
47 friend class PSRefProcTaskExecutor; |
50 private: |
48 private: |
52 static OopStarTaskQueueSet* _stack_array_depth; |
50 static OopStarTaskQueueSet* _stack_array_depth; |
53 static OopTaskQueueSet* _stack_array_breadth; |
51 static OopTaskQueueSet* _stack_array_breadth; |
54 static PSOldGen* _old_gen; |
52 static PSOldGen* _old_gen; |
55 static MutableSpace* _young_space; |
53 static MutableSpace* _young_space; |
56 |
54 |
57 #if PS_PM_STATS |
55 #if TASKQUEUE_STATS |
58 uint _total_pushes; |
56 size_t _masked_pushes; |
59 uint _masked_pushes; |
57 size_t _masked_steals; |
60 |
58 size_t _arrays_chunked; |
61 uint _overflow_pushes; |
59 size_t _array_chunks_processed; |
62 uint _max_overflow_length; |
60 |
63 |
61 void print_taskqueue_stats(uint i) const; |
64 uint _arrays_chunked; |
62 void print_local_stats(uint i) const; |
65 uint _array_chunks_processed; |
|
66 |
|
67 uint _total_steals; |
|
68 uint _masked_steals; |
|
69 |
|
70 void print_stats(uint i); |
|
71 static void print_stats(); |
63 static void print_stats(); |
72 #endif // PS_PM_STATS |
64 |
|
65 void reset_stats(); |
|
66 #endif // TASKQUEUE_STATS |
73 |
67 |
74 PSYoungPromotionLAB _young_lab; |
68 PSYoungPromotionLAB _young_lab; |
75 PSOldPromotionLAB _old_lab; |
69 PSOldPromotionLAB _old_lab; |
76 bool _young_gen_is_full; |
70 bool _young_gen_is_full; |
77 bool _old_gen_is_full; |
71 bool _old_gen_is_full; |
141 int start, int end); |
135 int start, int end); |
142 void process_array_chunk(oop old); |
136 void process_array_chunk(oop old); |
143 |
137 |
144 template <class T> void push_depth(T* p) { |
138 template <class T> void push_depth(T* p) { |
145 assert(depth_first(), "pre-condition"); |
139 assert(depth_first(), "pre-condition"); |
146 |
|
147 #if PS_PM_STATS |
|
148 ++_total_pushes; |
|
149 int stack_length = claimed_stack_depth()->overflow_stack()->length(); |
|
150 #endif // PS_PM_STATS |
|
151 |
|
152 claimed_stack_depth()->push(p); |
140 claimed_stack_depth()->push(p); |
153 |
|
154 #if PS_PM_STATS |
|
155 if (claimed_stack_depth()->overflow_stack()->length() != stack_length) { |
|
156 ++_overflow_pushes; |
|
157 if ((uint)stack_length + 1 > _max_overflow_length) { |
|
158 _max_overflow_length = (uint)stack_length + 1; |
|
159 } |
|
160 } |
|
161 #endif // PS_PM_STATS |
|
162 } |
141 } |
163 |
142 |
164 void push_breadth(oop o) { |
143 void push_breadth(oop o) { |
165 assert(!depth_first(), "pre-condition"); |
144 assert(!depth_first(), "pre-condition"); |
166 |
|
167 #if PS_PM_STATS |
|
168 ++_total_pushes; |
|
169 int stack_length = claimed_stack_breadth()->overflow_stack()->length(); |
|
170 #endif // PS_PM_STATS |
|
171 |
|
172 claimed_stack_breadth()->push(o); |
145 claimed_stack_breadth()->push(o); |
173 |
|
174 #if PS_PM_STATS |
|
175 if (claimed_stack_breadth()->overflow_stack()->length() != stack_length) { |
|
176 ++_overflow_pushes; |
|
177 if ((uint)stack_length + 1 > _max_overflow_length) { |
|
178 _max_overflow_length = (uint)stack_length + 1; |
|
179 } |
|
180 } |
|
181 #endif // PS_PM_STATS |
|
182 } |
146 } |
183 |
147 |
184 protected: |
148 protected: |
185 static OopStarTaskQueueSet* stack_array_depth() { return _stack_array_depth; } |
149 static OopStarTaskQueueSet* stack_array_depth() { return _stack_array_depth; } |
186 static OopTaskQueueSet* stack_array_breadth() { return _stack_array_breadth; } |
150 static OopTaskQueueSet* stack_array_breadth() { return _stack_array_breadth; } |
254 |
218 |
255 inline void flush_prefetch_queue(); |
219 inline void flush_prefetch_queue(); |
256 template <class T> inline void claim_or_forward_depth(T* p); |
220 template <class T> inline void claim_or_forward_depth(T* p); |
257 template <class T> inline void claim_or_forward_breadth(T* p); |
221 template <class T> inline void claim_or_forward_breadth(T* p); |
258 |
222 |
259 #if PS_PM_STATS |
223 TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) |
260 void increment_steals(oop* p = NULL) { |
|
261 _total_steals += 1; |
|
262 if (p != NULL && is_oop_masked(p)) { |
|
263 _masked_steals += 1; |
|
264 } |
|
265 } |
|
266 #endif // PS_PM_STATS |
|
267 }; |
224 }; |