[code-reflection] RFR: Simplify code generation for quotable lambdas not to require duplicate capture argument lists
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Oct 7 09:31:50 UTC 2024
On Fri, 4 Oct 2024 22:26:07 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> I think my comment was confusing. Here's another way of describing it - you could add the following to `quotedCapturedArgs`
>>
>> assert bodyScanner.top.body.entryBlock().parameters().size() == bodyScanner.top.localToOp.keySet().size();
>>
>> The top body becomes the body of the `quotedLambda` func op.
>
> So i think we could avoid `top.localToOp.put(currentClassSym, null)` and detect if we need to synthesize `this` by checking the sizes.
I see what you mean, but IMHO the suggested approach won't work as is. E.g. constant captures are added to the `localToOp` map, but they do not feature in the signature of the entry block (because constant captures are elided). So, looking at numbers and sizes might lead to the wrong result. I will try to simplify this nevertheless.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/249#discussion_r1789862224
More information about the babylon-dev
mailing list