70 NotValid |
70 NotValid |
71 }; |
71 }; |
72 // ------------------------ End don't putback if not needed |
72 // ------------------------ End don't putback if not needed |
73 |
73 |
74 private: |
74 private: |
75 static ParCompactionManager** _manager_array; |
75 static ParCompactionManager** _manager_array; |
76 static OopTaskQueueSet* _stack_array; |
76 static OopTaskQueueSet* _stack_array; |
77 static ObjectStartArray* _start_array; |
77 static ObjectStartArray* _start_array; |
78 static ChunkTaskQueueSet* _chunk_array; |
78 static RegionTaskQueueSet* _region_array; |
79 static PSOldGen* _old_gen; |
79 static PSOldGen* _old_gen; |
80 |
80 |
81 OopTaskQueue _marking_stack; |
81 OopTaskQueue _marking_stack; |
82 GrowableArray<oop>* _overflow_stack; |
82 GrowableArray<oop>* _overflow_stack; |
83 // Is there a way to reuse the _marking_stack for the |
83 // Is there a way to reuse the _marking_stack for the |
84 // saving empty chunks? For now just create a different |
84 // saving empty regions? For now just create a different |
85 // type of TaskQueue. |
85 // type of TaskQueue. |
86 |
86 |
87 #ifdef USE_ChunkTaskQueueWithOverflow |
87 #ifdef USE_RegionTaskQueueWithOverflow |
88 ChunkTaskQueueWithOverflow _chunk_stack; |
88 RegionTaskQueueWithOverflow _region_stack; |
89 #else |
89 #else |
90 ChunkTaskQueue _chunk_stack; |
90 RegionTaskQueue _region_stack; |
91 GrowableArray<size_t>* _chunk_overflow_stack; |
91 GrowableArray<size_t>* _region_overflow_stack; |
92 #endif |
92 #endif |
93 |
93 |
94 #if 1 // does this happen enough to need a per thread stack? |
94 #if 1 // does this happen enough to need a per thread stack? |
95 GrowableArray<Klass*>* _revisit_klass_stack; |
95 GrowableArray<Klass*>* _revisit_klass_stack; |
96 #endif |
96 #endif |
97 static ParMarkBitMap* _mark_bitmap; |
97 static ParMarkBitMap* _mark_bitmap; |
98 |
98 |
99 Action _action; |
99 Action _action; |
100 |
100 |
101 static PSOldGen* old_gen() { return _old_gen; } |
101 static PSOldGen* old_gen() { return _old_gen; } |
102 static ObjectStartArray* start_array() { return _start_array; } |
102 static ObjectStartArray* start_array() { return _start_array; } |
103 static OopTaskQueueSet* stack_array() { return _stack_array; } |
103 static OopTaskQueueSet* stack_array() { return _stack_array; } |
104 |
104 |
105 static void initialize(ParMarkBitMap* mbm); |
105 static void initialize(ParMarkBitMap* mbm); |
106 |
106 |
107 protected: |
107 protected: |
108 // Array of tasks. Needed by the ParallelTaskTerminator. |
108 // Array of tasks. Needed by the ParallelTaskTerminator. |
109 static ChunkTaskQueueSet* chunk_array() { return _chunk_array; } |
109 static RegionTaskQueueSet* region_array() { return _region_array; } |
110 |
110 OopTaskQueue* marking_stack() { return &_marking_stack; } |
111 OopTaskQueue* marking_stack() { return &_marking_stack; } |
111 GrowableArray<oop>* overflow_stack() { return _overflow_stack; } |
112 GrowableArray<oop>* overflow_stack() { return _overflow_stack; } |
112 #ifdef USE_RegionTaskQueueWithOverflow |
113 #ifdef USE_ChunkTaskQueueWithOverflow |
113 RegionTaskQueueWithOverflow* region_stack() { return &_region_stack; } |
114 ChunkTaskQueueWithOverflow* chunk_stack() { return &_chunk_stack; } |
|
115 #else |
114 #else |
116 ChunkTaskQueue* chunk_stack() { return &_chunk_stack; } |
115 RegionTaskQueue* region_stack() { return &_region_stack; } |
117 GrowableArray<size_t>* chunk_overflow_stack() { return _chunk_overflow_stack; } |
116 GrowableArray<size_t>* region_overflow_stack() { |
|
117 return _region_overflow_stack; |
|
118 } |
118 #endif |
119 #endif |
119 |
120 |
120 // Pushes onto the marking stack. If the marking stack is full, |
121 // Pushes onto the marking stack. If the marking stack is full, |
121 // pushes onto the overflow stack. |
122 // pushes onto the overflow stack. |
122 void stack_push(oop obj); |
123 void stack_push(oop obj); |
123 // Do not implement an equivalent stack_pop. Deal with the |
124 // Do not implement an equivalent stack_pop. Deal with the |
124 // marking stack and overflow stack directly. |
125 // marking stack and overflow stack directly. |
125 |
126 |
126 // Pushes onto the chunk stack. If the chunk stack is full, |
127 // Pushes onto the region stack. If the region stack is full, |
127 // pushes onto the chunk overflow stack. |
128 // pushes onto the region overflow stack. |
128 void chunk_stack_push(size_t chunk_index); |
129 void region_stack_push(size_t region_index); |
129 public: |
130 public: |
130 |
131 |
131 Action action() { return _action; } |
132 Action action() { return _action; } |
132 void set_action(Action v) { _action = v; } |
133 void set_action(Action v) { _action = v; } |
133 |
134 |
158 // Save oop for later processing. Must not fail. |
159 // Save oop for later processing. Must not fail. |
159 void save_for_scanning(oop m); |
160 void save_for_scanning(oop m); |
160 // Get a oop for scanning. If returns null, no oop were found. |
161 // Get a oop for scanning. If returns null, no oop were found. |
161 oop retrieve_for_scanning(); |
162 oop retrieve_for_scanning(); |
162 |
163 |
163 // Save chunk for later processing. Must not fail. |
164 // Save region for later processing. Must not fail. |
164 void save_for_processing(size_t chunk_index); |
165 void save_for_processing(size_t region_index); |
165 // Get a chunk for processing. If returns null, no chunk were found. |
166 // Get a region for processing. If returns null, no region were found. |
166 bool retrieve_for_processing(size_t& chunk_index); |
167 bool retrieve_for_processing(size_t& region_index); |
167 |
168 |
168 // Access function for compaction managers |
169 // Access function for compaction managers |
169 static ParCompactionManager* gc_thread_compaction_manager(int index); |
170 static ParCompactionManager* gc_thread_compaction_manager(int index); |
170 |
171 |
171 static bool steal(int queue_num, int* seed, Task& t) { |
172 static bool steal(int queue_num, int* seed, Task& t) { |
172 return stack_array()->steal(queue_num, seed, t); |
173 return stack_array()->steal(queue_num, seed, t); |
173 } |
174 } |
174 |
175 |
175 static bool steal(int queue_num, int* seed, ChunkTask& t) { |
176 static bool steal(int queue_num, int* seed, RegionTask& t) { |
176 return chunk_array()->steal(queue_num, seed, t); |
177 return region_array()->steal(queue_num, seed, t); |
177 } |
178 } |
178 |
179 |
179 // Process tasks remaining on any stack |
180 // Process tasks remaining on any stack |
180 void drain_marking_stacks(OopClosure *blk); |
181 void drain_marking_stacks(OopClosure *blk); |
181 |
182 |
182 // Process tasks remaining on any stack |
183 // Process tasks remaining on any stack |
183 void drain_chunk_stacks(); |
184 void drain_region_stacks(); |
184 |
185 |
185 // Process tasks remaining on any stack |
186 // Process tasks remaining on any stack |
186 void drain_chunk_overflow_stack(); |
187 void drain_region_overflow_stack(); |
187 |
188 |
188 // Debugging support |
189 // Debugging support |
189 #ifdef ASSERT |
190 #ifdef ASSERT |
190 bool stacks_have_been_allocated(); |
191 bool stacks_have_been_allocated(); |
191 #endif |
192 #endif |