[code-reflection] RFR: Simplify code generation for quotable lambdas not to require duplicate capture argument lists

Paul Sandoz psandoz at openjdk.org
Fri Oct 4 22:25:48 UTC 2024


On Fri, 4 Oct 2024 21:15:13 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Note that this logic is only really needed for the Quoted case, not the Quotable one. If we inline this directly into the Quoted path (as you suggested) perhaps this will be simplified away.
>
> That said - not sure. Isn't `funcOp` the function for the lambda? That should not feature any captured argument - just the parameter of the lambda as they appear in the source. I'm not sure we can deduce the need for `this` capture just by looking at that?

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.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/249#discussion_r1788384771


More information about the babylon-dev mailing list