[code-reflection] RFR: BytecodeGenerator support of lambdas [v3]
Adam Sotona
asotona at openjdk.org
Fri Apr 12 15:41:04 UTC 2024
On Fri, 12 Apr 2024 14:32:32 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> Yes, now it is quoting all lambdas.
>> We may restrict it to interfaces explicitly extending `Quotable`.
>> Or we may use the ability of `LMF` to inject additional interfaces and make all lambdas generated from code models as `Quotable`.
>
> We should only quote when the the FIs extend from `Quotable` or intersects with it. Otherwise, for non-quotable lambdas we are doing unnecessary work, deviating from what the compiler does, and potentially deviating from required behavior.
>
> At the moment we don't support intersection types, but we plan to. I would suggest setting up the code path for quotable and non-quotable and switching based on whether the FI class is assignable. Later on we can enhance when intersection types are supported.
OK, generating the field and using `FLAG_QUOTABLE` only for `Quotable` interfaces.
Thanks!
>> NPE when the attribute is missing. This passes the null name and works OK.
>
> Ah, yes (also i think the change from `Map.of` to `new HashMap` is related to that). I think that's originating from building the code model to quote the lambda. Do you mind if i fix this separately? Lets add variable names to that code model (derived from the parameter index) to avoid this issue for now?
OK, I've added parameter names and reverted the fix.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/48#discussion_r1562729994
PR Review Comment: https://git.openjdk.org/babylon/pull/48#discussion_r1562727347
More information about the babylon-dev
mailing list