RFR: 8359936: StableValues can release the underlying function after complete computation [v5]
Viktor Klang
vklang at openjdk.org
Wed Aug 13 11:45:13 UTC 2025
On Tue, 12 Aug 2025 09:21:07 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposes to release the underlying function if a stable function or collection has invoked its underlying supplier exhaustively so that it can be collected.
>>
>> This PR passes tier1, tier2, and tier3 testing on multiple platforms.
>
> Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
>
> - Add comment for outer.outer
> - Merge branch 'master' into sv-release-supplier2
> - Merge branch 'master' into sv-release-supplier2
> - Add a new method to StableValueImpl for improved speed
> - Merge branch 'master' into sv-release-supplier2
> - Fix performance regression
> - Clean up
> - Fix bug
> - Simplify
> - Revert to records
> - ... and 2 more: https://git.openjdk.org/jdk/compare/126c2618...243479df
src/java.base/share/classes/jdk/internal/lang/stable/StableFunction.java line 79:
> 77: public static <T, R> StableFunction<T, R> of(Set<? extends T> inputs,
> 78: Function<? super T, ? extends R> underlying) {
> 79: return new StableFunction<>(StableUtil.map(inputs), new UnderlyingHolder<>(underlying, inputs.size()));
Suggestion:
var m = StableUtil.map(inputs);
return new StableFunction<>(m, new UnderlyingHolder<>(underlying, m.size()));
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25878#discussion_r2273121882
More information about the core-libs-dev
mailing list