Skip to content

8348261: assert(n->is_Mem()) failed: memory node required #23938

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

Closed
wants to merge 1 commit into from

Conversation

vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 7, 2025

Add missing check for StrInflatedCopy intrinsic in C2 Escape Analysis.

Very rare case since we not usually use Latin1.inflate(). In failing case we inline both paths in String.getBytes() and eliminate `TreeMap$EntryIterator allocation:

        # java.lang.String::getBytes @ bci:40 (line 4812) L[0]=rsp + #64 L[1]=rsp + #132 L[2]=rsp + #120 L[3]=rsp + #124 STK[0]=rsp + #128 STK[1]=#0 STK[2]=rsp + #132 STK[3]=rsp + #120 STK[4]=rsp + #164
        # java.lang.AbstractStringBuilder::putStringAt @ bci:15 (line 1754) L[0]=rsp + #0 L[1]=rsp + #120 L[2]=rsp + #64
        # java.lang.AbstractStringBuilder::append @ bci:30 (line 592) L[0]=rsp + #0 L[1]=rsp + #64 L[2]=rsp + #28
        # java.lang.StringBuilder::append @ bci:2 (line 179) L[0]=rsp + #0 L[1]=rsp + #64
        # java.lang.StringBuilder::append @ bci:5 (line 173) L[0]=rsp + #0 L[1]=rsp + #32
        # sun.util.locale.LocaleExtensions::toID @ bci:100 (line 206) L[0]=RBP L[1]=rsp + #0 L[2]=rsp + #8 L[3]=#ScObj0 L[4]=rsp + #16 L[5]=rsp + #24 L[6]=rsp + #32
        # ScObj0 java/util/TreeMap$EntryIterator={ [expectedModCount :0]=rsp + #140, [next :1]=rsp + #176, [lastReturned :2]=rsp + #16, [this$0 :3]=rsp + #168 }

Unfortunately I was not able to create standalone test - it seems requires very particular frequencies of executed paths and used features/flags. The fix was verified with compilation replay file from the bug report.

I am running testing and will let you know results.


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-8348261: assert(n->is_Mem()) failed: memory node required (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23938

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 7, 2025

👋 Welcome back kvn! 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 7, 2025

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

8348261: assert(n->is_Mem()) failed: memory node required

Reviewed-by: chagedorn, epeter

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

  • 4066f33: 8350565: NMT: remaining memory flag/type to be replaced with memory tag
  • 7314efc: 8351377: Fix the ProblemList for com/sun/management/OperatingSystemMXBean cpuLoad tests on AIX

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 rfr Pull request is ready for review label Mar 7, 2025
@openjdk
Copy link

openjdk bot commented Mar 7, 2025

@vnkozlov 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 Mar 7, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 7, 2025

Webrevs

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.

Looks good to me!

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

@eme64 eme64 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.

Is there maybe some kind of stress-flag we could develop? Because you are saying the reproduction depends on some specific probabilities.

} else if (n->Opcode() == Op_StrCompressedCopy ||
n->Opcode() == Op_EncodeISOArray) {
// get the memory projection
n = n->find_out_with(Op_SCMemProj);
assert(n != nullptr && n->Opcode() == Op_SCMemProj, "memory projection required");
} else {
#ifdef ASSERT
if (!n->is_Mem()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to turn this into a product check? Could we bail-out gracefully at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For first question - may be but we hit it first time since JDK 9. I think we should balance what is really needs to be checked in product and what can be done in debug VM. For this case I think checking in debug is fine.
For second question - not from EA but we can from compilation. We are in split_unique_types() where we start modifying graph already.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Mar 7, 2025

Thank you, Christian and Emanuel for reviews

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Mar 7, 2025

Looks reasonable.

Is there maybe some kind of stress-flag we could develop? Because you are saying the reproduction depends on some specific probabilities.

I think stressing flag -XX:+StressUnstableIfTraps added by Tobias may help here.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Mar 7, 2025

My testing tier1-5, xcomp and stress passed without new failures.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Mar 7, 2025

/integrate

@openjdk
Copy link

openjdk bot commented Mar 7, 2025

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

  • 5cd4fe6: 8348309: MultiNST tests need more debugging and timing
  • 7c22b81: 8350811: [JMH] test foreign.StrLenTest failed with StringIndexOutOfBoundsException for size=451
  • 54fe643: 8347433: Deprecate XML interchange in java.management/javax/management/modelmbean/DescriptorSupport for removal
  • 155697f: 8349623: [ASAN] Gtest os_linux.glibc_mallinfo_wrapper_vm fails
  • 4066f33: 8350565: NMT: remaining memory flag/type to be replaced with memory tag
  • 7314efc: 8351377: Fix the ProblemList for com/sun/management/OperatingSystemMXBean cpuLoad tests on AIX

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 7, 2025

@vnkozlov Pushed as commit f6a8db2.

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

@vnkozlov vnkozlov deleted the 8348261 branch March 7, 2025 19:19
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
Development

Successfully merging this pull request may close these issues.

3 participants