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

IIRC I worked on 
test/jdk/java/util/concurrent/tck/LongAdderTest.java:testSerialization
test/jdk/java/util/concurrent/tck/DoubleAdderTest.java:testSerialization
I should have added similar tests back then, to 
DoubleAccumulatorTest.java
LongAccumulatorTest.java
and that would allow deletion of Serial.java as a redundant test.
I would have done that now as well, but there's nothing wrong with this fix.

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

Marked as reviewed by martin (Reviewer).

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

Reply via email to