Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8278351

Add function to retrieve worker_id from any context

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 19
    • Fix Version/s: 19
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b02

      Description

      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 the worker_id is not easily accessible in that context (the discover path).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pliden Per Liden
              Reporter:
              pliden Per Liden
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: