Skip to content

Conversation

@rbrchen
Copy link
Contributor

@rbrchen rbrchen commented Nov 21, 2025

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.


Progress

  • Change must not contain extraneous whitespace

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/babylon.git pull/691/head:pull/691
$ git checkout pull/691

Update a local copy of the PR:
$ git checkout pull/691
$ git pull https://git.openjdk.org/babylon.git pull/691/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 691

View PR using the GUI difftool:
$ git pr show -t 691

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/babylon/pull/691.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 21, 2025

👋 Welcome back rbrchen! A progress list of the required criteria for merging this PR into code-reflection will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

@rbrchen This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

ModuleOp generation from LambdaOp and FuncOp

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the code-reflection branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 21, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 21, 2025

* <p>
* Such a lambda operation is one with the following constraints:
* <ol>
* <li>Zero or one captured value (assuming correspondence to the {@code this} variable).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is too restrictive. For method references they may or may not capture this, but for a direct invocation there will be captures e.g., the optimization pattern in HAT is a lambda expression that makes a direct call to another method, capturing variables and passing then on as arguments to the method. So you need to test out those cases with mixture of lambda parameters and captured variables.

if (funcOp != null) {
temp.add(funcOp);
Op.Result result = blockBuilder.op(CoreOp.funcCall(
iop.invokeDescriptor().name(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the func to call differs from the transformed func's name, so the model you create is incorrect. You need to test more robustly e.g., run through the interpreter or compare text output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants