Skip to content

8347997: assert(false) failed: EA: missing memory path #23284

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 5 commits into from

Conversation

vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Jan 24, 2025

C2's Escape Analysis does not recognize pattern where one input of memory Phi node is MergeMem node and an other is RAW store. This pattern is created by Continuation pinning intrinsic. As result EA complains about strange memory graph.

I suggest to add second MergeMem between Store and Phi nodes by calling reset_memory(). EA recognize such patter and removes allocations.

I checked generated assembler pinning code and it is the same as before. The only difference in the test is eliminated allocations.

I moved Uncommon code up to avoid resetting memory - it is already done at the beginning of this intrinsic code.

We should not use uncommon_trap_exact() for Deoptimization::Action_none - It is used for other actions to prevent changing them to Action_none.

Tested tier1-5, hs-xcomp, hs-comp-stress
Added new regression test based on reproducer from bug report.


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-8347997: assert(false) failed: EA: missing memory path (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23284

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 24, 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 Jan 24, 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:

8347997: assert(false) failed: EA: missing memory path

Reviewed-by: thartmann, chagedorn

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

  • 55c3e78: 8348631: Crash in PredictedCallGenerator::generate after JDK-8347006
  • 98a93e1: 8348800: Many serviceability/sa tests failing after JDK-8348239
  • 5e81fa6: 8348892: Properly fix compilation error for zip_util.c on Windows
  • 3a564ed: 8347955: TimeZone methods to stream the available timezone IDs
  • 1efae9a: 8348888: tier1 closed build failure on Windows after JDK-8348348
  • c018a60: 8344637: Fix Page8 of manual test java/awt/print/PrinterJob/PrintTextTest.java on Linux and Windows
  • c3c3888: 8336760: [JVMCI] -XX:+PrintCompilation should also print "hosted" JVMCI compilations
  • 9f4d3de: 8347718: Unexpected NullPointerException in C2 compiled code due to ReduceAllocationMerges
  • a224f12: 8348205: Improve cutover time selection when building available currencies set
  • 8103256: 8348348: Remove unnecessary #ifdef STATIC_BUILD around DEF_STATIC_JNI_OnLoad from zip_util.c
  • ... and 53 more: https://git.openjdk.org/jdk/compare/7f16a0875ced8669b9d2131c67496a66e74ea36f...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
Copy link

openjdk bot commented Jan 24, 2025

@vnkozlov The following labels will be automatically applied to this pull request:

  • graal
  • hotspot-compiler

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

@openjdk openjdk bot added graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org labels Jan 24, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 24, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 24, 2025

Webrevs

@AlanBateman
Copy link
Contributor

If you want, the reproducer can be simplified to just invoke pin/unpin, avoids needing the method handle code to invoke them reflectively, e.g.

import jdk.internal.vm.Continuation;

    static class FailsEA {
        final Object o;

        public FailsEA() throws Throwable {
            o = new Object();
            Continuation.pin();
            Continuation.unpin();
        }
    }

    static class Crashes {
        final Object o;

        public Crashes() throws Throwable {
            Continuation.pin();
            Continuation.unpin();
            o = new Object();
        }
    }

If you add @modules java.base/jdk.internal.vm to the test description then jtreg will compile and run the test with this package exported, no need be open the package with the @run tag.

@vnkozlov
Copy link
Contributor Author

Thank you @AlanBateman for suggestions about the test. I implemented them and verified that the test still catches the failure without fix.

@AlanBateman
Copy link
Contributor

Thank you @AlanBateman for suggestions about the test. I implemented them and verified that the test still catches the failure without fix.

Good, much simpler.

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 otherwise.

The only difference in the test is eliminated allocations.

Sounds like a good opportunity for an IR framework test but could be done as follow-up (starter) RFE.


public class TestContinuationPinningAndEA {

static class FailsEA {
Copy link
Member

Choose a reason for hiding this comment

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

Should use 4-whitespace indentation since it's Java code.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 28, 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.

Otherwise, the fix looks good to me, too!

@@ -3772,6 +3772,18 @@ bool LibraryCallKit::inline_native_Continuation_pinning(bool unpin) {
Node* test_pin_count_over_underflow = _gvn.transform(new BoolNode(pin_count_cmp, BoolTest::eq));
IfNode* iff_pin_count_over_underflow = create_and_map_if(control(), test_pin_count_over_underflow, PROB_MIN, COUNT_UNKNOWN);

// True branch, pin count over/underflow.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you can add a comment here about why we do the trap first (as described in the PR description).

…AndEA.java

Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 28, 2025
@vnkozlov
Copy link
Contributor Author

Sounds like a good opportunity for an IR framework test but could be done as follow-up (starter) RFE.

I created JDK-8348887

@vnkozlov
Copy link
Contributor Author

Thank you @TobiHartmann and @chhagedorn for reviews. I addressed your comments.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 28, 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.

Update looks good, thanks!

@vnkozlov
Copy link
Contributor Author

/integrate

@vnkozlov
Copy link
Contributor Author

Thank you, @TobiHartmann and @chhagedorn for reviews

@openjdk
Copy link

openjdk bot commented Jan 29, 2025

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

  • 4662363: 8348687: [BACKOUT] C2: Non-fluid StringBuilder pattern bails out in OptoStringConcat
  • d266ca9: 8348752: Enable -XX:+AOTClassLinking by default when -XX:AOTMode is specified
  • cbc89a7: 8348898: Remove unused OctalDigits to clean up code
  • 96fefed: 8319850: PrintInlining should print which methods are late inlines
  • 51cce6e: 8318577: Windows Look-and-Feel JProgressBarUI does not render correctly on 2x UI scale
  • 6bfae3a: 8333386: TestAbortOnVMOperationTimeout test fails for client VM
  • f98d9a3: 8348870: Eliminate array bound checks in DecimalDigits
  • fe6d9ab: 8348582: Set -fstack-protector when building with clang
  • fff97d6: 8343938: TestStressBailout triggers "Should not be locked when freed" assert
  • 69ec453: 8347985: Deprecate java.management Permission classes for removal
  • ... and 65 more: https://git.openjdk.org/jdk/compare/7f16a0875ced8669b9d2131c67496a66e74ea36f...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 29, 2025

@vnkozlov Pushed as commit 6b581d2.

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

Successfully merging this pull request may close these issues.

4 participants