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

8352595: Regression of JDK-8314999 in IR matching #24163

Closed

Conversation

marc-chevalier
Copy link
Member

@marc-chevalier marc-chevalier commented Mar 21, 2025

A lot of tests for the IR framework used ALLOC and friends as a check that would run on the Opto assembly by default, but can also run earlier, but that's no longer the case.

There were two kinds of tests to fix: the ones rather about ALLOC, where the used or expected compile phases have to change, and the tests where ALLOC were just a check that would run on opto assembly. For this, I tried to keep the spirit of the test using other regexes made for this stage.


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-8352595: Regression of JDK-8314999 in IR matching (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24163

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 21, 2025

👋 Welcome back marc-chevalier! 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 Mar 21, 2025

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

8352595: Regression of JDK-8314999 in IR matching

Reviewed-by: chagedorn, thartmann

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

  • 48fac66: 8347406: [REDO] C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)
  • 99c8a6e: 8350463: AArch64: Add vector rearrange support for small lane count vectors
  • b2da0d3: 8352289: [macos] Review skipped tests in tools/jpackage/macosx/SigningPackage*
  • ba658a7: 8349522: AArch64: Add backend implementation for new unsigned and saturating vector operations
  • 5625b43: 8350429: runtime/NMT/CheckForProperDetailStackTrace.java should only run for debug JVM
  • 2c60fc5: 8352176: Automate setting up environment for mac signing tests
  • 6e6a39d: 8347321: [ubsan] CGGlyphImages.m:553:30: runtime error: nan is outside the range of representable values of type 'unsigned long'
  • b84b292: 8352615: [Test] RISC-V: TestVectorizationMultiInvar.java fails on riscv64 without rvv support
  • a54445f: 8350609: Cleanup unknown unwind opcode (0xB) for windows
  • c87e1be: 8349582: APX NDD code generation for OpenJDK
  • ... and 9 more: https://git.openjdk.org/jdk/compare/e23e0f85ef0f959a68adda0cff9e721ba2173ffc...master

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 (@chhagedorn, @TobiHartmann) 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
Copy link

openjdk bot commented Mar 21, 2025

@marc-chevalier To determine the appropriate audience for reviewing this pull request, one or more labels corresponding to different subsystems will normally be applied automatically. However, no automatic labelling rule matches the changes in this pull request. In order to have an "RFR" email sent to the correct mailing list, you will need to add one or more applicable labels manually using the /label pull request command.

Applicable Labels
  • build
  • client
  • compiler
  • core-libs
  • graal
  • hotspot
  • hotspot-compiler
  • hotspot-gc
  • hotspot-jfr
  • hotspot-runtime
  • i18n
  • ide-support
  • javadoc
  • jdk
  • jmx
  • kulla
  • net
  • nio
  • security
  • serviceability
  • shenandoah

@marc-chevalier marc-chevalier force-pushed the fix/fix-IRframework-test branch from 98f574b to 17e11d4 Compare March 21, 2025 18:43
@marc-chevalier marc-chevalier marked this pull request as ready for review March 24, 2025 07:21
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 24, 2025
Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Thanks for addressing this. I have some comments.

@ExpectedFailure(ruleId = 4, phase = CompilePhase.PRINT_IDEAL, failOn = 1, counts = {1, 4})

@IR(counts = {IRNode.ALLOC, "2", IRNode.ALLOC_OF, "Object", "1"})
@ExpectedFailure(ruleId = 5, phase = CompilePhase.PRINT_OPTO_ASSEMBLY, counts = 1)
@ExpectedFailure(ruleId = 5, phase = CompilePhase.BEFORE_MACRO_EXPANSION, counts = 1)
public void defaultOnBoth() {
Copy link
Member

@chhagedorn chhagedorn Mar 24, 2025

Choose a reason for hiding this comment

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

I think for this test you should add a matching on some PrintOptoAssembly as well since it tries to verify ideal and opto matching.

Comment on lines +212 to +222
@IR(counts = {IRNode.CBZ_HI, "> 1"})
public void test4() {}


@Test
@IR(failOn = IRNode.FIELD_ACCESS)
@IR(counts = {IRNode.CHECKCAST_ARRAY, "2"})
@IR(failOn = {IRNode.CBNZW_HI})
@IR(counts = {IRNode.CBZ_LS, "2", IRNode.CBZW_LS, "> 1"})
public void test5() {}

@Test
@IR(failOn = {IRNode.CHECKCAST_ARRAYCOPY, IRNode.CHECKCAST_ARRAY_OF, "Foo"})
@IR(counts = {IRNode.ALLOC, "2", IRNode.ALLOC_ARRAY_OF, "Foo", "> 1"})
@IR(failOn = {IRNode.CBNZW_HI})
@IR(counts = {IRNode.CBZW_LS, "> 1"})
Copy link
Member

@chhagedorn chhagedorn Mar 24, 2025

Choose a reason for hiding this comment

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

I've just noticed that these AArch64 specific IRNode entries do not have a check that they are only supported on AArch64. In the past, I've added some platform checks for IRNode entries only being supported on certain platforms:

public static void checkIRNodeSupported(String node) throws CheckedTestFrameworkException {
switch (node) {
case INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP -> {
if (!WhiteBox.getWhiteBox().isJVMCISupportedByGC()) {
throw new CheckedTestFrameworkException("INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP is unsupported " +
"in builds without JVMCI.");
}
}
case CHECKCAST_ARRAYCOPY -> {
if (Platform.isS390x()) {
throw new CheckedTestFrameworkException("CHECKCAST_ARRAYCOPY is unsupported on s390.");
}
}
case IS_FINITE_D, IS_FINITE_F -> {
if (!Platform.isRISCV64()) {
throw new CheckedTestFrameworkException("IS_FINITE_* is only supported on riscv64.");
}
}
// default: do nothing -> IR node is supported and can be used by the user.
}
}

We should probably add a similar check for these CB* entries. But that's something that can be done separately.

For this test here, we only collect compile phases and it does not matter on what platforms these IRNode entries are eventually used. So, no action to be done in your changes here.

@@ -113,12 +113,12 @@ public void testMixedPhases() {
assertContainsOnly(methodToCompilePhases, testClass, "mix7", PHASEIDEALLOOP1, PHASEIDEALLOOP2, FINAL_CODE,
OPTIMIZE_FINISHED, PRINT_IDEAL);
assertContainsOnly(methodToCompilePhases, testClass, "mix8", PHASEIDEALLOOP1, PHASEIDEALLOOP2, FINAL_CODE,
OPTIMIZE_FINISHED, PRINT_IDEAL, PRINT_OPTO_ASSEMBLY);
OPTIMIZE_FINISHED, PRINT_IDEAL);
Copy link
Member

Choose a reason for hiding this comment

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

Note that the tests on this file only collect compile phases and actually do not perform any IR matching. So, the IR rules do not need work. This means that for all tests where we use the default compile phase of ALLOC (which is PRINT_OPTO_ASSEMBLY), we can replace ALLOC with just something else that defaults on PRINT_OPTO_ASSEMBLY.

This just means that we should not replace PRINT_OPTO_ASSEMBLY with BEFORE_MACRO_EXPANSION here but instead use a different IRNode in the IR rules at these tests that default on PRINT_OPTO_ASSEMBLY. I've made some comments further down where this applies. The other changes in the file look fine.

@marc-chevalier
Copy link
Member Author

/label add hotspot-compiler

@openjdk
Copy link

openjdk bot commented Mar 24, 2025

@marc-chevalier
The hotspot-compiler label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Mar 24, 2025

Webrevs

@marc-chevalier
Copy link
Member Author

Yes, I indeed misunderstood which tests were specifically for ALLOC, and which were about OptoAssembly, and ALLOC is just a mean. The new diff makes more sense, indeed.

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Thanks for the update, looks good!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 25, 2025
Copy link
Member

@TobiHartmann TobiHartmann 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 to me too. Ship it!

@marc-chevalier
Copy link
Member Author

/integrate

Let's :shipit: indeed!
Thanks!

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 25, 2025
@openjdk
Copy link

openjdk bot commented Mar 25, 2025

@marc-chevalier
Your change (at version c7c0cfa) is now ready to be sponsored by a Committer.

@chhagedorn
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 25, 2025

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

  • 48fac66: 8347406: [REDO] C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)
  • 99c8a6e: 8350463: AArch64: Add vector rearrange support for small lane count vectors
  • b2da0d3: 8352289: [macos] Review skipped tests in tools/jpackage/macosx/SigningPackage*
  • ba658a7: 8349522: AArch64: Add backend implementation for new unsigned and saturating vector operations
  • 5625b43: 8350429: runtime/NMT/CheckForProperDetailStackTrace.java should only run for debug JVM
  • 2c60fc5: 8352176: Automate setting up environment for mac signing tests
  • 6e6a39d: 8347321: [ubsan] CGGlyphImages.m:553:30: runtime error: nan is outside the range of representable values of type 'unsigned long'
  • b84b292: 8352615: [Test] RISC-V: TestVectorizationMultiInvar.java fails on riscv64 without rvv support
  • a54445f: 8350609: Cleanup unknown unwind opcode (0xB) for windows
  • c87e1be: 8349582: APX NDD code generation for OpenJDK
  • ... and 9 more: https://git.openjdk.org/jdk/compare/e23e0f85ef0f959a68adda0cff9e721ba2173ffc...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 25, 2025

@chhagedorn @marc-chevalier Pushed as commit c94bc74.

💡 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
hotspot-compiler [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants