> This PR removes some unnecessary coupling between Lower, Gen and 
> LocalProxyVarsGen.
> 
> It does so by making LocalProxyVarsGen no longer a standalone pass but, 
> rather, a helper for Gen::normalizeMethod.
> 
> The main idea is that we can make things more regular, by having Gen always 
> inserting variable initializer in the correct place.
> Then, LocalProxyVarGen will create a blank proxy, and use its visitor to 
> inspect the rest of the constructor body.
> Since the visitor _already_ rewires assignments to real fields as assignments 
> to proxies, this new arrangement has the desired effect of generating the 
> same code as before, but w/o too much coupling.
> 
> Some massaging to `Gen::normalizeMethod` was needed because now we need to 
> make sure it calls the proxy step for all constructors, not just in case 
> there's some pending var initializers.
> 
> Finally, when cleaning up `Lower` I noticed a likely bug: `freevardefs` was 
> no longer preserving the `LOCAL_CAPTURE_FIELD` -- sometimes it was replacing 
> it with `STRICT`. But `LOCAL_CAPTURE_FIELD` is used by LambdaToMethod, so 
> changing this probably results in bad downstream lowering.
> I've fixed this by adding both `STRICT` _and_ `LOCAL_CAPTURE_FIELD` to the 
> captured sym.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Maurizio Cimadamore has updated the pull request incrementally with one 
additional commit since the last revision:

  Deal with references to lowered fields from early field initializers

-------------

Changes:
  - all: https://git.openjdk.org/valhalla/pull/2488/files
  - new: https://git.openjdk.org/valhalla/pull/2488/files/2e929ac6..bf825680

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=2488&range=01
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2488&range=00-01

  Stats: 71 lines in 2 files changed: 71 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/valhalla/pull/2488.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2488/head:pull/2488

PR: https://git.openjdk.org/valhalla/pull/2488

Reply via email to