On Wed, 24 Aug 2022 18:15:17 GMT, Aleksey Shipilev <sh...@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

This pull request has now been integrated.

Changeset: 251bff6b
Author:    Aleksey Shipilev <sh...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/251bff6beeafcd98824dab60e9831c0175fe0689
Stats:     4 lines in 1 file changed: 0 ins; 0 del; 4 mod

8292877: java/util/concurrent/atomic/Serial.java uses {Double,Long}Accumulator 
incorrectly

Reviewed-by: psandoz, martin, alanb

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

PR: https://git.openjdk.org/jdk/pull/10002

Reply via email to