```
G1ConcurrentMark::weak_refs_work(...) {
...
set_concurrency(active_workers);
...
rp->process_discovered_references(...)
}
```
`set_concurrency` is there to ensure proper termination logic, `TaskTerminator::offer_termination` needs to know how many workers are actually launched. However, Ref-processing is divided into several steps internally, and each step may launch different number of workers. The correct number of workers is actually set in `prepare_run_task_hook`. Therefore, the `set_concurrency` call inside `weak_refs_work` is not needed.
G1ConcurrentMark::weak_refs_work(...) {
...
set_concurrency(active_workers);
...
rp->process_discovered_references(...)
}
```
`set_concurrency` is there to ensure proper termination logic, `TaskTerminator::offer_termination` needs to know how many workers are actually launched. However, Ref-processing is divided into several steps internally, and each step may launch different number of workers. The correct number of workers is actually set in `prepare_run_task_hook`. Therefore, the `set_concurrency` call inside `weak_refs_work` is not needed.