Final CONSTANT_Dynamic spec
daniel.smith at oracle.com
Wed Jan 31 20:47:27 UTC 2018
> On Jan 18, 2018, at 5:14 PM, Dan Smith <daniel.smith at oracle.com> wrote:
> A proposed final spec for CONSTANT_Dynamic is here:
> There are two significant changes:
> 5.4.3: Expanded the rule about concurrent resolution to account for nested resolution in a single thread
> 188.8.131.52: 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.
More information about the valhalla-spec-observers