RFR: 8292877: java/util/concurrent/atomic/Serial.java uses {Double,Long}Accumulator incorrectly
Aleksey Shipilev
shade at openjdk.org
Thu Aug 25 16:43:24 UTC 2022
On Wed, 24 Aug 2022 18:15:17 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> [JDK-8026344](https://bugs.openjdk.org/browse/JDK-8026344) added tests that subtly contradict the contract for `{Double,Long}Accumulator`-s, which breaks the tests on some platforms even in the single-threaded case.
>
> They use accumulators with binary plus as update function and using non-zero values as identity, which breaks once accumulators create many cells, reset their values to identity, and then apply the function over them, producing unexpected values.
>
> See the investigation on RISC-V here:
> https://mail.openjdk.org/pipermail/riscv-port-dev/2022-August/000594.html
>
> We can do what `DoubleAccumulator` javadocs do as the sample, namely: "For example, to maintain a running maximum value, you could supply Double::max along with Double.NEGATIVE_INFINITY as the identity."
>
> Additional testing:
> - [x] Linux x86_64, `java/util/concurrent` tests
Thank you all!
-------------
PR: https://git.openjdk.org/jdk/pull/10002
More information about the core-libs-dev
mailing list