RFR: 8264788: Make SequentialSubTasksDone use-once

Thomas Schatzl tschatzl at openjdk.java.net
Wed Apr 7 08:54:29 UTC 2021


On Wed, 7 Apr 2021 08:32:11 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   can I have reviews for this change that simplifies code ahead?
> 
> SequentialSubTasksDone has some machinery to reset itself automatically after all tasks were claimed.
> 
> This is not used at all and can/should be removed. 
> 
> Test: tier1-3

Note that it is possible to remove the CAS loop in `SequentialSubTasksDone` with an atomic add. I wasn't sure to do this, but if somebody thinks it is a good idea (and probably faster in many implementations) similar to the following:

    bool SequentialSubTasksDone::try_claim_task(uint& t) {
      if (t < _num_tasks) {
        t = Atomic::add(&_num_claimed, 1) - 1;
      }
      return t < _num_tasks;
    }

(And slightly fixing that assert in the destructor)

-------------

PR: https://git.openjdk.java.net/jdk/pull/3372



More information about the hotspot-gc-dev mailing list