Integrated: 8278351: Add function to retrieve worker_id from any context
Per Liden
pliden at openjdk.java.net
Wed Dec 15 10:13:03 UTC 2021
On Tue, 7 Dec 2021 16:07:28 GMT, Per Liden <pliden at openjdk.org> wrote:
> The `worker_id` argument passed to `WorkerTask::work(uint worker_id)` is sometimes needed in contexts where it today can't be easily accessed, mainly because it's not feasible to pass this argument through many layers of semi-unrelated code. To solve this, I propose that we make the current `worker_id` accessible though a static function `WorkerThread::worker_id()`.
>
> By doing this, we also pave the way for ZGC to remove its `ZTask` and `ZThread`, which are helper class to make the `worker_id` easily accessible in any context.
>
> At the same time I propose that we remove `WorkerThread::_id`. This id identifies the actual worker thread. There is currently only one user of `WorkerThread::_id`, the `ReferenceProcessor`. However, we should use `WorkerThread::worker_id()` here instead. The only reason it doesn't use `worker_id` today is that it's not easily accessible in that context (the discover path).
>
> Testing: Passed Tier1-3
This pull request has now been integrated.
Changeset: 7adf7f33
Author: Per Liden <pliden at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/7adf7f3353ab81c5af3f2fc4c0fc9e4cf8905e32
Stats: 35 lines in 5 files changed: 9 ins; 10 del; 16 mod
8278351: Add function to retrieve worker_id from any context
Reviewed-by: eosterlund, kbarrett, ayang
-------------
PR: https://git.openjdk.java.net/jdk/pull/6747
More information about the hotspot-gc-dev
mailing list