On Tue, 29 Nov 2022 11:49:10 GMT, Andrew Haley <a...@openjdk.org> wrote:
>> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Unused variable > > src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/ScopedValue.java > line 385: > >> 383: try { >> 384: JLA.setScopedValueBindings(newSnapshot); >> 385: JLA.ensureMaterializedForStackWalk(newSnapshot); > > Question: is it necessary here to invoke `ensureMaterializedForStackWalk()` > It's really only there to prevent the new `Snapshot` from being scalar > replaced. But we know that it cannot be scalar replaced, because it really > does escape: a pointer to it is stored in the current `Thread`. So should we > simply remove the call to `ensureMaterializedForStackWalk()`, on the grounds > that it cannot have any effect? It does seem unnecessary here, but I'm not an expert on current and future C2 escape analysis. @vnkozlov, do you agree? ------------- PR: https://git.openjdk.org/jdk/pull/10952