146 PSEvacuateFollowersClosure evac_followers(promotion_manager); |
146 PSEvacuateFollowersClosure evac_followers(promotion_manager); |
147 PSIsAliveClosure is_alive; |
147 PSIsAliveClosure is_alive; |
148 _rp_task.work(_work_id, is_alive, keep_alive, evac_followers); |
148 _rp_task.work(_work_id, is_alive, keep_alive, evac_followers); |
149 } |
149 } |
150 |
150 |
151 class PSRefEnqueueTaskProxy: public GCTask { |
|
152 typedef AbstractRefProcTaskExecutor::EnqueueTask EnqueueTask; |
|
153 EnqueueTask& _enq_task; |
|
154 uint _work_id; |
|
155 |
|
156 public: |
|
157 PSRefEnqueueTaskProxy(EnqueueTask& enq_task, uint work_id) |
|
158 : _enq_task(enq_task), |
|
159 _work_id(work_id) |
|
160 { } |
|
161 |
|
162 virtual char* name() { return (char *)"Enqueue reference objects in parallel"; } |
|
163 virtual void do_it(GCTaskManager* manager, uint which) |
|
164 { |
|
165 _enq_task.work(_work_id); |
|
166 } |
|
167 }; |
|
168 |
|
169 class PSRefProcTaskExecutor: public AbstractRefProcTaskExecutor { |
151 class PSRefProcTaskExecutor: public AbstractRefProcTaskExecutor { |
170 virtual void execute(ProcessTask& task); |
152 virtual void execute(ProcessTask& task); |
171 virtual void execute(EnqueueTask& task); |
|
172 }; |
153 }; |
173 |
154 |
174 void PSRefProcTaskExecutor::execute(ProcessTask& task) |
155 void PSRefProcTaskExecutor::execute(ProcessTask& task) |
175 { |
156 { |
176 GCTaskQueue* q = GCTaskQueue::create(); |
157 GCTaskQueue* q = GCTaskQueue::create(); |
182 (TaskQueueSetSuper*) PSPromotionManager::stack_array_depth()); |
163 (TaskQueueSetSuper*) PSPromotionManager::stack_array_depth()); |
183 if (task.marks_oops_alive() && manager->active_workers() > 1) { |
164 if (task.marks_oops_alive() && manager->active_workers() > 1) { |
184 for (uint j = 0; j < manager->active_workers(); j++) { |
165 for (uint j = 0; j < manager->active_workers(); j++) { |
185 q->enqueue(new StealTask(&terminator)); |
166 q->enqueue(new StealTask(&terminator)); |
186 } |
167 } |
187 } |
|
188 manager->execute_and_wait(q); |
|
189 } |
|
190 |
|
191 |
|
192 void PSRefProcTaskExecutor::execute(EnqueueTask& task) |
|
193 { |
|
194 GCTaskQueue* q = GCTaskQueue::create(); |
|
195 GCTaskManager* manager = ParallelScavengeHeap::gc_task_manager(); |
|
196 for(uint i=0; i < manager->active_workers(); i++) { |
|
197 q->enqueue(new PSRefEnqueueTaskProxy(task, i)); |
|
198 } |
168 } |
199 manager->execute_and_wait(q); |
169 manager->execute_and_wait(q); |
200 } |
170 } |
201 |
171 |
202 // This method contains all heap specific policy for invoking scavenge. |
172 // This method contains all heap specific policy for invoking scavenge. |