[code-reflection] RFR: ModuleOp generation from LambdaOp and FuncOp

Paul Sandoz psandoz at openjdk.org
Fri Nov 21 20:44:28 UTC 2025


On Fri, 21 Nov 2025 00:20:24 GMT, Ruby Chen <duke at openjdk.org> wrote:

> Add support for generating a ModuleOp from either a LambdaOp or a FuncOp. The given LambdaOp will be converted into the root FuncOp, and the given FuncOp will be assigned as the root FuncOp.
> 
> For `CoreOp.ModuleOp.ofLambdaOp()`, a unique name for the new root FuncOp must be passed as a parameter.

src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java line 383:

> 381:                 cur.elements().filter(e -> e instanceof JavaOp.InvokeOp).forEach(e -> {
> 382:                     if (invokeToFuncOp((JavaOp.InvokeOp) e, l) != null) {
> 383:                         temp.addFirst(invokeToFuncOp((JavaOp.InvokeOp) e, l));

Suggestion:

                    if (invokeToFuncOp((JavaOp.InvokeOp) e, l) instanceof CoreOp.FuncOp resolvedFuncOp) {
                        temp.addFirst(resolvedFuncOp);

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

PR Review Comment: https://git.openjdk.org/babylon/pull/691#discussion_r2550910569


More information about the babylon-dev mailing list