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

8317507: C2 compilation fails with "Exceeded _node_regs array" #16306

Conversation

robcasloz
Copy link
Contributor

@robcasloz robcasloz commented Oct 23, 2023

This changeset avoids incrementing the global node index counter (Compile::_unique) when creating a CISC version node that replaces and reuses the index of the original node. This prevents out-of-bounds accesses to PhaseRegAlloc::_node_regs in programs with a high-density of CISC spill candidate nodes. Such programs can arise, for example, after extensive unrolling of reduction operations in x64 (see the failure analysis for further detail).

A more general fix to eliminate potential out-of-bounds accesses would be to transform PhaseRegAlloc::_node_regs into a growable array. This fix could also reduce memory overhead, as it would obviate the need for over-allocating space for future nodes. This is however a more intrusive, architecture-sensitive, and difficult-to-backport change (see prototype here) that might be best addressed as a separate RFE. Note that the general fix would still benefit from the simpler one proposed in this changeset.

Testing

  • tier1-5, stress test, fuzzing (windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64; release and debug mode).
  • tier6-7 (linux-x64 only).

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-8317507: C2 compilation fails with "Exceeded _node_regs array" (Bug - P2)

Reviewers

Contributors

  • Tobias Hartmann <thartmann@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16306

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 2023

👋 Welcome back rcastanedalo! 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 23, 2023

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

  • hotspot-compiler

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 hotspot-compiler hotspot-compiler-dev@openjdk.org label Oct 23, 2023
@robcasloz robcasloz marked this pull request as ready for review October 23, 2023 10:00
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 23, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 23, 2023

Webrevs

@robcasloz
Copy link
Contributor Author

/contributor add @TobiHartmann

@openjdk
Copy link

openjdk bot commented Oct 24, 2023

@robcasloz
Contributor Tobias Hartmann <thartmann@openjdk.org> successfully added.

@robcasloz
Copy link
Contributor Author

Added @TobiHartmann as contributor (provided the original version of the regression test included in the changeset).

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.

Nice analysis, Roberto. The fix looks good to me.

@TobiHartmann
Copy link
Member

that might be best addressed as a separate RFE

I agree, please file a follow-up RFE.

@openjdk
Copy link

openjdk bot commented Oct 24, 2023

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

8317507: C2 compilation fails with "Exceeded _node_regs array"

Co-authored-by: Tobias Hartmann <thartmann@openjdk.org>
Reviewed-by: thartmann, shade, dlong

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

  • c4c66ab: 8316271: JfrJvmtiAgent::retransformClasses failed: JVMTI_ERROR_FAILS_VERIFICATION
  • 88b9cda: 8318981: compiler/compilercontrol/TestConflictInlineCommands.java fails intermittent with 'disallowed by CompileCommand' missing from stdout/stderr
  • c9d23c3: 8315532: Compiler Implementation for Unnamed Variables & Patterns
  • 3934127: 8318709: Improve System.nanoTime performance on Windows
  • 83eb206: 8318889: C2: add bailout after assert Bad graph detected in build_loop_late
  • 1183b22: 8310978: JFR events SocketReadEvent/SocketWriteEvent for Socket adaptor ops
  • 988e1df: 8318953: RISC-V: Small refactoring for MacroAssembler::test_bit
  • ce0ca47: 8319067: ProblemList serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java on linux-aarch64 in Xcomp mode
  • db34025: 8318827: RISC-V: Improve readability of fclass result testing
  • 1ec0d02: 8318225: RISC-V: C2 UModI
  • ... and 154 more: https://git.openjdk.org/jdk/compare/6fc35142315f1616fa35e415005c9483939c6920...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.

➡️ 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 Oct 24, 2023
@robcasloz
Copy link
Contributor Author

robcasloz commented Oct 24, 2023

Nice analysis, Roberto. The fix looks good to me.

Thanks for reviewing, Tobias!

@robcasloz
Copy link
Contributor Author

I agree, please file a follow-up RFE.

Will do after this changeset is reviewed and integrated.

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me.

@robcasloz
Copy link
Contributor Author

@shipilev thanks for reviewing! I just extended the regression test with a test case that also triggers the failure on earlier JDK releases, as per our discussion here. Please re-review.

Copy link
Member

@shipilev shipilev 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, with a minor nit in test.

@robcasloz
Copy link
Contributor Author

@TobiHartmann OK with the latest revision? (the only change after your review is the inclusion of an additional test case that also triggers the failure on earlier JDK releases).

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.

Still good, thanks!

@robcasloz
Copy link
Contributor Author

Still good, thanks!

Thanks for re-reviewing, Tobias.

@robcasloz
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 30, 2023

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

  • c4c66ab: 8316271: JfrJvmtiAgent::retransformClasses failed: JVMTI_ERROR_FAILS_VERIFICATION
  • 88b9cda: 8318981: compiler/compilercontrol/TestConflictInlineCommands.java fails intermittent with 'disallowed by CompileCommand' missing from stdout/stderr
  • c9d23c3: 8315532: Compiler Implementation for Unnamed Variables & Patterns
  • 3934127: 8318709: Improve System.nanoTime performance on Windows
  • 83eb206: 8318889: C2: add bailout after assert Bad graph detected in build_loop_late
  • 1183b22: 8310978: JFR events SocketReadEvent/SocketWriteEvent for Socket adaptor ops
  • 988e1df: 8318953: RISC-V: Small refactoring for MacroAssembler::test_bit
  • ce0ca47: 8319067: ProblemList serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java on linux-aarch64 in Xcomp mode
  • db34025: 8318827: RISC-V: Improve readability of fclass result testing
  • 1ec0d02: 8318225: RISC-V: C2 UModI
  • ... and 154 more: https://git.openjdk.org/jdk/compare/6fc35142315f1616fa35e415005c9483939c6920...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 30, 2023

@robcasloz Pushed as commit a581897.

💡 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 hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
4 participants