4277 |
4277 |
4278 Mutex _stats_lock; |
4278 Mutex _stats_lock; |
4279 Mutex* stats_lock() { return &_stats_lock; } |
4279 Mutex* stats_lock() { return &_stats_lock; } |
4280 |
4280 |
4281 public: |
4281 public: |
4282 G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor) |
4282 G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor, uint n_workers) |
4283 : AbstractGangTask("G1 collection"), |
4283 : AbstractGangTask("G1 collection"), |
4284 _g1h(g1h), |
4284 _g1h(g1h), |
4285 _queues(task_queues), |
4285 _queues(task_queues), |
4286 _root_processor(root_processor), |
4286 _root_processor(root_processor), |
4287 _terminator(0, _queues), |
4287 _terminator(n_workers, _queues), |
|
4288 _n_workers(n_workers), |
4288 _stats_lock(Mutex::leaf, "parallel G1 stats lock", true) |
4289 _stats_lock(Mutex::leaf, "parallel G1 stats lock", true) |
4289 {} |
4290 {} |
4290 |
4291 |
4291 RefToScanQueueSet* queues() { return _queues; } |
4292 RefToScanQueueSet* queues() { return _queues; } |
4292 |
4293 |
4293 RefToScanQueue *work_queue(int i) { |
4294 RefToScanQueue *work_queue(int i) { |
4294 return queues()->queue(i); |
4295 return queues()->queue(i); |
4295 } |
4296 } |
4296 |
4297 |
4297 ParallelTaskTerminator* terminator() { return &_terminator; } |
4298 ParallelTaskTerminator* terminator() { return &_terminator; } |
4298 |
|
4299 virtual void set_for_termination(uint active_workers) { |
|
4300 terminator()->reset_for_reuse(active_workers); |
|
4301 _n_workers = active_workers; |
|
4302 } |
|
4303 |
4299 |
4304 // Helps out with CLD processing. |
4300 // Helps out with CLD processing. |
4305 // |
4301 // |
4306 // During InitialMark we need to: |
4302 // During InitialMark we need to: |
4307 // 1) Scavenge all CLDs for the young GC. |
4303 // 1) Scavenge all CLDs for the young GC. |
5341 double start_par_time_sec = os::elapsedTime(); |
5337 double start_par_time_sec = os::elapsedTime(); |
5342 double end_par_time_sec; |
5338 double end_par_time_sec; |
5343 |
5339 |
5344 { |
5340 { |
5345 G1RootProcessor root_processor(this, n_workers); |
5341 G1RootProcessor root_processor(this, n_workers); |
5346 G1ParTask g1_par_task(this, _task_queues, &root_processor); |
5342 G1ParTask g1_par_task(this, _task_queues, &root_processor, n_workers); |
5347 // InitialMark needs claim bits to keep track of the marked-through CLDs. |
5343 // InitialMark needs claim bits to keep track of the marked-through CLDs. |
5348 if (g1_policy()->during_initial_mark_pause()) { |
5344 if (g1_policy()->during_initial_mark_pause()) { |
5349 ClassLoaderDataGraph::clear_claimed_marks(); |
5345 ClassLoaderDataGraph::clear_claimed_marks(); |
5350 } |
5346 } |
5351 |
5347 |