Skip to content

Add method reference to FuncOp#992

Open
mabbay wants to merge 37 commits into
openjdk:code-reflectionfrom
mabbay:funcop-mref
Open

Add method reference to FuncOp#992
mabbay wants to merge 37 commits into
openjdk:code-reflectionfrom
mabbay:funcop-mref

Conversation

@mabbay

@mabbay mabbay commented Apr 3, 2026

Copy link
Copy Markdown
Member

Allow user to attach a MethodRef to a FuncOp.
Compiler tests are failing because of these changes, instead of updating the tests, we remove the source attribute from the javac model before testing.
Attaching MethodRef to FuncOp will allow us to access the original j.l.r.Method from which we extracted a FuncOp -JDK-8376824



Progress

  • Change must not contain extraneous whitespace

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 992

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@mabbay
mabbay requested review from PaulSandoz and mcimadamore April 3, 2026 19:08
@mabbay mabbay self-assigned this Apr 3, 2026
@bridgekeeper

bridgekeeper Bot commented Apr 3, 2026

Copy link
Copy Markdown

👋 Welcome back mabbay! 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

openjdk Bot commented Apr 3, 2026

Copy link
Copy Markdown

@mabbay 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:

Add method reference to 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 1 new commit pushed to the code-reflection branch:

  • 8e278d7: Align Op.ofElement with ReflectMethods::visitMethodDef

Please see this link for an up-to-date comparison between the source branch of this pull request and the code-reflection branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the code-reflection branch, type /integrate in a new comment.

Comment thread src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java Outdated
@openjdk

openjdk Bot commented Apr 10, 2026

Copy link
Copy Markdown

@mabbay this pull request can not be integrated into code-reflection due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout funcop-mref
git fetch https://git.openjdk.org/babylon.git code-reflection
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge code-reflection"
git push

@openjdk openjdk Bot added the merge-conflict Pull request has merge conflict with target branch label Apr 10, 2026
@openjdk openjdk Bot removed the merge-conflict Pull request has merge conflict with target branch label Apr 13, 2026
@mabbay

mabbay commented Apr 13, 2026

Copy link
Copy Markdown
Member Author

/template append

@openjdk

openjdk Bot commented Apr 13, 2026

Copy link
Copy Markdown

@mabbay The pull request template has been appended to the pull request body

@mabbay
mabbay requested a review from grfrost April 28, 2026 15:15
Comment thread src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java Outdated
Comment thread src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java Outdated
Comment thread src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/core/CoreOp.java Outdated
@openjdk openjdk Bot added the merge-conflict Pull request has merge conflict with target branch label Jun 10, 2026
@bridgekeeper

bridgekeeper Bot commented Jul 2, 2026

Copy link
Copy Markdown

@mabbay This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk openjdk Bot removed the merge-conflict Pull request has merge conflict with target branch label Jul 6, 2026
@mabbay
mabbay marked this pull request as ready for review July 6, 2026 18:37
@openjdk openjdk Bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 6, 2026
@mlbridge

mlbridge Bot commented Jul 6, 2026

Copy link
Copy Markdown

Webrevs

@PaulSandoz PaulSandoz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Check for canonicalization of models in runtime tests.

}

private boolean isFakeSource() {
return !source.refType().equals(JavaType.VOID);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The method name seems to describe the inversion of its implementation. Perhaps change to:

private boolean isSyntheticSourceRef() {
    return source.refType().equals(JavaType.VOID);
}

* @return the reference to the method this function operation models.
*/
public Optional<MethodRef> sourceRef() {
return isFakeSource() ? Optional.of(source) : Optional.empty();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change to:

/**
 * {@return the source reference to the method this operation models, otherwise an empty optional if the reference is unavailable.}
 */
public Optional<MethodRef> sourceRef() {
    return isSyntheticSourceRef() ? Optional.empty() : Optional.of(source);
}

if (!method.isAnnotationPresent(Reflect.class)) return;
String found = canonicalizeModel(method, Op.ofMethod(method).orElseThrow());
CoreOp.FuncOp op = Op.ofMethod(method).orElseThrow();
String found = canonicalizeModel(method, removeSourceAttribute(op));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make note this is a work around to avoid updating the tests, which we will do later.

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