Dan,
 
Can you clarify this sentence:
----
Note that an implementation is free to try to re-resolve X multiple times and keep looping until the stack actually overflows—once you've reached the nested X the first time, all further computation is not observable by users.
----
 
In particular this statement  "not observable by users" has some unpleasant implications.  Does that mean that side-effects that occur during the re-resolution should be undone?That the StackOverflowError's backtrace should only include a single loop of the re-resolution?
 
There are a lot of ways that users could observe further computation and if the JVM needs to detect and prevent them from seeing the effects, this actually mandates early detection.  Was that the intention or am I being overly pedantic?
 
--Dan
----- Original message -----
From: Dan Smith <daniel.sm...@oracle.com>
Sent by: "valhalla-spec-experts" <valhalla-spec-experts-boun...@openjdk.java.net>
To: valhalla-spec-experts <valhalla-spec-experts@openjdk.java.net>
Cc:
Subject: Re: Final CONSTANT_Dynamic spec
Date: Wed, Jan 31, 2018 9:47 PM
 
> On Jan 18, 2018, at 5:14 PM, Dan Smith <daniel.sm...@oracle.com> wrote:
>
> A proposed final spec for CONSTANT_Dynamic is here:
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__cr.openjdk.java.net_-7Edlsmith_constant-2Ddynamic.html&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=LBQnmyrHQkEBElM8bAxhzfwLG2HbsYDdzEznFrQoob4&m=gItW7uu58mA6Y7JF5L0w7HfDcUi2UDkAVf1EY72Rslo&s=ZTLlXZISKOh3fs-q-Xdj4U4skQd3eVZZaYPrOpgMx5g&e=
>
> There are two significant changes:
>
> 5.4.3: Expanded the rule about concurrent resolution to account for nested resolution in a single thread
>
> 5.4.3.6: Added a resolution-time rule for detecting cycles in static arguments, with some additional discussion about cycles

Discussing this cycle-detection rule with Alex, we agreed that its nondeterminism was not helpful, and that we can make it deterministic without putting undue constraints on implementations. So here's a tweaked version of the rule we'd like to use instead:

-----

Let X be the symbolic reference currently being resolved, and let Y be a static argument of X to be resolved as described above. If X and Y are both dynamically-computed constants, and if Y is either the same as X or has a static argument that references X through its static arguments, directly or indirectly, resolution fails with a StackOverflowError **at the point where re-resolution of X would be required**.

~~This rule allows some leeway in the sequencing of the error check: the implementation may resolve some of the static arguments of Y, or may not.~~

-----

Note that an implementation is free to try to re-resolve X multiple times and keep looping until the stack actually overflows—once you've reached the nested X the first time, all further computation is not observable by users.

—Dan
 

Reply via email to