On Fri, 5 Sept 2025 at 20:00, Stuart Marks <stuart.ma...@oracle.com> wrote:
> What's the connection between Map.of()'s randomized encounter order and 
> StableValue
> or the JIT's ability to constant-fold? Are you observing that randomized 
> encounter
> order precludes constant folding? Or are you saying that something should 
> change
> near the (preview) StableValue.map() API? For example, that it should specify 
> a
> particular encounter order, or that its API signature should change?

The recent JVMLS talk indicated that a StableValue needs to be rooted
in a field that the JVM can trust does not change (so that constant
folding can occur). This includes static fields, record fields, method
references, and List.of()/Map.of().

As such, the connection between the randomized order and StableValue
is that more devs are going to be pushed to use Map.of().

(unless I misunderstand, StableValue.map() cannot be used to create an
ordered map)

Stephen

Reply via email to