Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handlers #12945

Closed
wants to merge 234 commits into from

Conversation

asotona
Copy link
Member

@asotona asotona commented Mar 9, 2023

java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handlers

This patch converts ASM calls to Classfile API.
This PR is initially chained on 8294982: Implementation of Classfile API #10982


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handlers (Sub-task - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12945

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12945.diff

asotona and others added 30 commits June 10, 2022 14:20
…lang.reflect.AccesFlag in Classfile API and tests
…andleInfo

implemented RebuildingTransformation and added to Transforms and CorpusTest
reduced CorpusTestHelper output and adjusted TEST.properties
MethodParameterInfo name parameter changed to Optional
added MethodParameterInfo::ofParameter(Optional<String>,int)
implemented TemporaryConstantPool::stringEntry
adjusted BoundAttribute and RebuildingTransformation test helper
EnclosingMethodAttribute factory method changed to accept Optionals
added EnclosingMethodAttribute::of(ClassDesc,Optional<String>,Optional<MethodTypeDesc>)
added EnclosingMethodAttribute accessor methods
InnerClassInfo all factory methods changed to accept Optionals
added NestHostAttribute::of(ClassDesc)
added SourceIDAttribute::of(String)
changes reflected in BoundAttribute and RebuildTransformation test helper
* added TypeAnnotation factory methods accepting ClassDesc and AnnotationElement...
AnnotationValue.OfConstant sub-classed to allow switch pattern matching
RebuildingTransformation test helper adjusted

* added TypeAnnotation.TargetInfo factory methods with validity checking for multi-target types
adjusted RebuildTransformation test helper
…Symbol (openjdk#13)

refactored to FieldModel::fieldTypeSymbol and MethodModel::methodTypeSymbol (openjdk#13)
added round testing of signatures in RebuildTransformation test helper
… a frame type.

 Doing so, make the chop size available to consumers of frames.
@asotona
Copy link
Member Author

asotona commented Jun 8, 2023

@liach thank you for the review

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 3, 2023

@asotona 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 add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

Copy link

@ExE-Boss ExE-Boss left a comment

Choose a reason for hiding this comment

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

@openjdk
Copy link

openjdk bot commented Sep 21, 2023

@asotona this pull request can not be integrated into master 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 JDK-8294960-lambdas
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Sep 21, 2023
}
return cw.toByteArray();
return Classfile.of().build(ClassDesc.of("InjectedInvoker"), clb -> clb
.withFlags(Classfile.ACC_PRIVATE | Classfile.ACC_SUPER)
Copy link
Member

Choose a reason for hiding this comment

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

Don't think ACC_PRIVATE works for classes; ASM might have a workaround to apply this onto an InnerClasses attribute, but we cannot modify the outer class to inject attributes so only adding this to inner class's InnerClasses is meaningless.

# Conflicts:
#	src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java
#	src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Sep 26, 2023
asotona and others added 7 commits September 27, 2023 11:10
…sHelper.java

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
…sHelper.java

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
…java

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
…nerator.java

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
@bridgekeeper
Copy link

bridgekeeper bot commented Nov 22, 2023

@asotona 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 add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@asotona
Copy link
Member Author

asotona commented Dec 14, 2023

Unfortunately this PR went far out of the sync to merge or rebase, so I have to close it and start a new PR with squashed and rebased changes from this one.

@asotona
Copy link
Member Author

asotona commented Dec 14, 2023

Work on java.lang.invoke package conversion continues in #17108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org