[code-reflection] RFR: BytecodeGenerator support of lambdas [v4]

Paul Sandoz psandoz at openjdk.org
Fri Apr 12 21:02:49 UTC 2024


On Fri, 12 Apr 2024 15:44:02 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> BytecodeGenerator support of lambdas
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   commented out debug print

Looking good, just some minor refinements. Also, would be be possible to reformat long lines to <= 120 characters? Otherwise its hard to read and review the code.

src/java.base/share/classes/java/lang/reflect/code/bytecode/BytecodeGenerator.java line 770:

> 768:                             } else {
> 769:                                 cob.invokedynamic(DynamicCallSiteDesc.of(
> 770:                                         DMHD_LAMBDA_METAFACTORY,

This should use the `metafactory` bootstrap rather than `altMetafactory`.

test/jdk/java/lang/reflect/code/bytecode/TestBytecode.java line 295:

> 293: 
> 294:     static int consumeQuotable(int i, QuotableFunc f) {
> 295:         return f.apply(i + 1);

For now perhaps assert that the result of `f.quoted()` and `f.quoted().op()` are non-null and the latter is an instance of `LambdaOp`. A separate test is needed to assert on the code model and captured parameters, we could add that in another PR.

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

PR Review: https://git.openjdk.org/babylon/pull/48#pullrequestreview-1998417342
PR Review Comment: https://git.openjdk.org/babylon/pull/48#discussion_r1563193964
PR Review Comment: https://git.openjdk.org/babylon/pull/48#discussion_r1563194048


More information about the babylon-dev mailing list