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

8294980: test/jdk/java/lang/invoke 15 test classes use experimental bytecode library #16268

Closed
wants to merge 21 commits into from

Conversation

mabbay
Copy link
Member

@mabbay mabbay commented Oct 19, 2023

early experimental version of the bytecode library is bundled under:
test/jdk/lib/testlibrary/bytecode

following tests reference it:
test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/InstructionHelper.java
test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java
test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java
test/jdk/java/lang/invoke/condy/CondyWrongType.java
test/jdk/java/lang/invoke/condy/CondyNestedTest.java
test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java
test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java
test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java
test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java
test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java
test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java
test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java
test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java
test/jdk/java/lang/invoke/condy/CondyBSMException.java
test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java


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-8294980: test/jdk/java/lang/invoke 15 test classes use experimental bytecode library (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16268

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 19, 2023

👋 Welcome back mabbay! A progress list of the required criteria for merging this PR into master 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 Oct 19, 2023

@mabbay The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Oct 19, 2023
.withCode(codeBuilder -> {
for (int i = 0; i < type.parameterCount(); i++) {
codeBuilder.loadInstruction(TypeKind.fromDescriptor(
type.parameterType(i).descriptorString()), i);
Copy link
Member

Choose a reason for hiding this comment

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

You can just use TypeKind.from(type.parameterType(i))

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't see such as method.

Copy link
Member

Choose a reason for hiding this comment

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

It is declared as public static TypeKind from(TypeDescriptor.OfField<?> descriptor) so that you can pass either Class or ClassDesc in.

codeBuilder.invokedynamic(DynamicCallSiteDesc.of(
MethodHandleDesc.ofMethod(
DirectMethodHandleDesc.Kind.STATIC,
ClassDesc.of(l.lookupClass().getCanonicalName()),
Copy link
Member

Choose a reason for hiding this comment

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

Despite this being part of the original code, getCanonicalName is unreliable for bytecode engineering, for it cannot distinguish packages from nested/inner classes.

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 will use ClassDesc.ofDescriptor and passes the descriptor string of the type.

@mabbay mabbay marked this pull request as ready for review November 3, 2023 12:06
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 3, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 3, 2023

Webrevs

}

@DataProvider
public Object[][] validNamesProvider() throws Exception {
return Stream.of("<clinit>",
"<init>",
"<foo>")
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this reducing the test cases?

Copy link
Member Author

@mabbay mabbay Nov 8, 2023

Choose a reason for hiding this comment

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

<foo> is not a valid name for dynamic constant.

Copy link
Member Author

Choose a reason for hiding this comment

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

You can see java.lang.constant.ConstantUtils.validateMemberName

Copy link
Member

Choose a reason for hiding this comment

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

So how is it possible that testValidNames has been passing with the name?
Conversion should not change the tested subjects.

Copy link
Member Author

@mabbay mabbay Nov 8, 2023

Choose a reason for hiding this comment

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

I think the old experimental library wasn't validating constant name. In the new library, constant name is validated in the constructor of DynamicConstantDesc

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, the test only generate bytecode, without execution.

Copy link
Member

@asotona asotona 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 Nov 8, 2023

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

8294980: test/jdk/java/lang/invoke 15 test classes use experimental bytecode library

Reviewed-by: asotona

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

  • cd9719b: 8319306: Serial: Remove TenuredSpace::verify
  • 1e687b4: 8316719: C2 compilation still fails with "bad AD file"
  • 8555e0f: 8319318: bufferedStream fixed case can be removed
  • 73c5f60: 8319556: Harmonize interface formatting in the FFM API
  • cc4b0d9: 8319378: Spec for j.util.Timer::purge and j.util.Timer::cancel could be improved
  • a290256: 8315680: java/lang/ref/ReachabilityFenceTest.java should run with -Xbatch
  • b1625af: 8305814: Update Xalan Java to 2.7.3

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@asotona) but any other Committer may sponsor as well.

➡️ 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 the ready Pull request is ready to be integrated label Nov 8, 2023
@mabbay
Copy link
Member Author

mabbay commented Nov 8, 2023

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 8, 2023
@openjdk
Copy link

openjdk bot commented Nov 8, 2023

@mabbay
Your change (at version c95c1e2) is now ready to be sponsored by a Committer.

@asotona
Copy link
Member

asotona commented Nov 8, 2023

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 8, 2023

Going to push as commit 7bc8e4c.
Since your change was applied there have been 8 commits pushed to the master branch:

  • e841897: 8319374: JFR: Remove instrumentation for exception events
  • cd9719b: 8319306: Serial: Remove TenuredSpace::verify
  • 1e687b4: 8316719: C2 compilation still fails with "bad AD file"
  • 8555e0f: 8319318: bufferedStream fixed case can be removed
  • 73c5f60: 8319556: Harmonize interface formatting in the FFM API
  • cc4b0d9: 8319378: Spec for j.util.Timer::purge and j.util.Timer::cancel could be improved
  • a290256: 8315680: java/lang/ref/ReachabilityFenceTest.java should run with -Xbatch
  • b1625af: 8305814: Update Xalan Java to 2.7.3

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 8, 2023

@asotona @mabbay Pushed as commit 7bc8e4c.

💡 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
3 participants