On Thu, 28 Aug 2025 01:14:20 GMT, Rui Li <d...@openjdk.org> wrote:

> Backport of https://bugs.openjdk.org/browse/JDK-8361497
> 
> Not clean due to the lack of https://bugs.openjdk.org/browse/JDK-8360884. The 
> cherry pick conflict was caused by the a new test added in the JDK-8360884., 
> [code](https://github.com/openjdk/jdk/commit/4df9c873452293ccde3c7dbcd64e1ced6b6af52e#diff-314e483e41a8dd49577b207c12683b369ab87b6de6da289b9f7e89aae5f412cbR227-R232).
>  Based on the conversation in 
> [JDK-8360884](https://bugs.openjdk.org/browse/JDK-8360884), it seems people 
> are not comfortable to backport JDK-8360884 into 25 yet. The conflict was 
> easy to resolve tho. Just remove the additional test brought by JDK-8360884.

src/java.base/share/classes/java/lang/ScopedValue.java line 597:

> 595:         Object value = scopedValueBindings().find(this);
> 596:         boolean found = (value != Snapshot.NIL);
> 597:         if (found)  Cache.put(this, value);

Suggestion:

        if (found) Cache.put(this, value);

test/micro/org/openjdk/bench/java/lang/ScopedValues.java line 240:

> 238:     // Test 6: Performance with a large number of bindings
> 239:     static final long deepCall(ScopedValue<Integer> outer, long n) {
> 240:         long result = 0;

This could be defined below, only if `n <= 0`

test/micro/org/openjdk/bench/java/lang/ScopedValues.java line 245:

> 243:             return where(sv, n).call(() -> deepCall(outer, n - 1));
> 244:         } else {
> 245:             for (int i = 0; i < 1_000_000; i++) {

nit: you can reduce indentation by one level, the `else` clause is not needed

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26976#discussion_r2306869898
PR Review Comment: https://git.openjdk.org/jdk/pull/26976#discussion_r2306867517
PR Review Comment: https://git.openjdk.org/jdk/pull/26976#discussion_r2306865824

Reply via email to