Skip to content

Conversation

@asotona
Copy link
Member

@asotona asotona commented Mar 9, 2023

jdk.jlink internal plugins are heavily using ASM

This patch converts ASM calls to Classfile API.

Please review.
Thanks,
Adam


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-8294972: Convert jdk.jlink internal plugins to use the Classfile API

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12944

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12944.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 Mar 16, 2023

What was the issue with the previous revision?
The only conversion bug I found during the code reformat/revision was missing className.replace('/', '.') and after that the test pass.

.constantInstruction(className.replace('/', '.'))

Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

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

Looks good. I reviewed the changes in all plugins except IncludeLocalePlugin and will re-review it once you restore to the previous version.

Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk
Copy link

openjdk bot commented Mar 20, 2023

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

8294972: Convert jdk.jlink internal plugins to use the Classfile API

Reviewed-by: mchung, alanb

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 9 new commits pushed to the master branch:

  • 0156909: 8304502: Classfile API class hierarchy makes assumptions when class is not resolved
  • 0deb648: 8290200: com/sun/jdi/InvokeHangTest.java fails with "Debuggee appears to be hung"
  • 019fcd8: 8304139: Add and method constants to ConstantDescs
  • d6f20e2: 8304680: Problemlist compiler/sharedstubs/SharedStubToInterpTest.java
  • d788a1b: 8304180: Constant Descriptors for MethodHandles::classData and classDataAt
  • bbde215: 8299494: Test vmTestbase/nsk/stress/except/except011.java failed: ExceptionInInitializerError: target class not found
  • 1c04686: 8304387: Fix positions of shared static stubs / trampolines
  • c65bb2c: 8304334: java/awt/color/ICC_ColorSpace/ToFromCIEXYZRoundTrip.java times out on slow platforms
  • 4bf1fbb: 8303648: Add String.indexOf(String str, int beginIndex, int endIndex)

Please see this link for an up-to-date comparison between the source branch of this pull request and the master 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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 20, 2023
Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

Good work

"<init>",
MethodTypeDesc.of(CD_void, CD_String))
.astore(BUILDER_VAR)
.aload(BUILDER_VAR);
Copy link
Contributor

Choose a reason for hiding this comment

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

The methods to generate the MD all load the Builder onto the operand stack so the aload at L1021 is catching my attention, is that needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems to be redundant as the following code does not expect it on stack and loads it again as needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so. If java -XX:+UnlockDiagnosticVMOptions -XX:+BytecodeVerificationLocal -version doesn't fail and you've run all the tests then it should be okay to drop it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can confirm java -XX:+UnlockDiagnosticVMOptions -XX:+BytecodeVerificationLocal -version successful execution and passing all jdk/tools/jlink tests. Now waiting for all tier1 tests results.

Copy link
Member Author

Choose a reason for hiding this comment

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

all tier1, 2, and 3 tests passed

asotona added 2 commits March 21, 2023 09:57
# Conflicts:
#	src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
asotona and others added 2 commits March 22, 2023 07:10
Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
@asotona
Copy link
Member Author

asotona commented Mar 22, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Mar 22, 2023

Going to push as commit 358c61b.
Since your change was applied there have been 13 commits pushed to the master branch:

  • c74507e: 8304657: G1: Rename set_state_empty to set_state_untracked
  • ca94287: 8304144: G1: Remove unnecessary is_survivor check in G1ClearCardTableTask
  • eda0065: 8304286: java/net/SocketOption/OptionsTest.java failing after JDK-8302659
  • c039d26: 8303804: Fix some errors of If-VectorTest and CMove-VectorTest
  • 0156909: 8304502: Classfile API class hierarchy makes assumptions when class is not resolved
  • 0deb648: 8290200: com/sun/jdi/InvokeHangTest.java fails with "Debuggee appears to be hung"
  • 019fcd8: 8304139: Add and method constants to ConstantDescs
  • d6f20e2: 8304680: Problemlist compiler/sharedstubs/SharedStubToInterpTest.java
  • d788a1b: 8304180: Constant Descriptors for MethodHandles::classData and classDataAt
  • bbde215: 8299494: Test vmTestbase/nsk/stress/except/except011.java failed: ExceptionInInitializerError: target class not found
  • ... and 3 more: https://git.openjdk.org/jdk/compare/c4df9b5f176672617f29bd253f01df2ea81dac36...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 22, 2023
@openjdk openjdk bot closed this Mar 22, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 22, 2023
@openjdk
Copy link

openjdk bot commented Mar 22, 2023

@asotona Pushed as commit 358c61b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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 integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.