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

8314106: C2: assert(is_valid()) failed: must be valid after JDK-8305636 #15225

Closed
wants to merge 1 commit into from

Conversation

chhagedorn
Copy link
Member

@chhagedorn chhagedorn commented Aug 10, 2023

In the failing test case, we are unswitching a loop for which we've already removed Parse Predicates with Compile::cleanup_parse_predicates(). We are wrongly checking if a predicate block is non-empty (i.e. find the Parse or Runtime Predicates) instead of only checking if we find the Parse Predicate:

if (predicate_block->is_non_empty()) {
clone_parse_predicate_to_unswitched_loops(predicate_block, reason, iffast_pred, ifslow_pred);
clone_assertion_predicates_to_unswitched_loop(loop, old_new, reason, predicate_block->parse_predicate_success_proj(),
iffast_pred, ifslow_pred);
}

In the test case, we have a predicate block that contains Runtime Predicates from Loop Predication but no Parse Predicate anymore. Therefore, when trying to clone the non-existing Parse Predicate, we fail with the assertion because we do not have a valid Parse Predicate.

The fix is to only clone a Parse Predicate and the Assertion Predicates for a predicate block if the Parse Predicate is actually there. This is not entirely correct because we would also need to clone Assertion Predicates in the absence of Parse Predicates. But this was already wrong before JDK-8305636:

ParsePredicates parse_predicates(entry);
ParsePredicateSuccessProj* loop_predicate_proj = parse_predicates.loop_predicate_proj();
if (loop_predicate_proj != nullptr) {
// Clone Parse Predicate and Template Assertion Predicates of the Loop Predicate Block.
iffast_pred = clone_parse_predicate_to_unswitched_loop(loop_predicate_proj, iffast_pred,
Deoptimization::Reason_predicate, false);
check_cloned_parse_predicate_for_unswitching(iffast_pred, true);
ifslow_pred = clone_parse_predicate_to_unswitched_loop(loop_predicate_proj, ifslow_pred,
Deoptimization::Reason_predicate, true);
check_cloned_parse_predicate_for_unswitching(ifslow_pred, false);
clone_assertion_predicates_to_unswitched_loop(loop, old_new, Deoptimization::Reason_predicate, loop_predicate_proj,
iffast_pred, ifslow_pred);
}

This will only be fixed with the complete fix (JDK-8288981). The proposed fix here just reverts back to the old behavior before JDK-8305636.

Thanks,
Christian


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-8314106: C2: assert(is_valid()) failed: must be valid after JDK-8305636 (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15225

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 10, 2023

👋 Welcome back chagedorn! 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 openjdk bot added the rfr Pull request is ready for review label Aug 10, 2023
@openjdk
Copy link

openjdk bot commented Aug 10, 2023

@chhagedorn 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 Aug 10, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 10, 2023

Webrevs

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 and trivial to me.

@openjdk
Copy link

openjdk bot commented Aug 10, 2023

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

8314106: C2: assert(is_valid()) failed: must be valid after JDK-8305636

Reviewed-by: thartmann, kvn

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

  • bd1b942: 8313905: Checked_cast assert in CDS compare_by_loader
  • 9b53251: 8313654: Test WaitNotifySuspendedVThreadTest.java timed out
  • e7c83ea: 8312194: test/hotspot/jtreg/applications/ctw/modules/jdk_crypto_ec.java cannot handle empty modules
  • 23fe2ec: 8313616: support loading library members on AIX in os::dll_load
  • f47767f: 8313882: Fix -Wconversion warnings in runtime code
  • 0cb9ab0: 8313239: InetAddress.getCanonicalHostName may return ip address if reverse lookup fails
  • 028b3ae: 8313874: JNI NewWeakGlobalRef throws exception for null arg
  • 83adaf5: 8313421: [JVMCI] avoid locking class loader in CompilerToVM.lookupType
  • 35b60f9: 8298095: Refine implSpec for SegmentAllocator
  • 6dba202: 8313670: Simplify shared lib name handling code in some tests
  • ... and 46 more: https://git.openjdk.org/jdk/compare/dc01604756c22889412f9f25b534488180327317...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 Aug 10, 2023
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@chhagedorn
Copy link
Member Author

Thanks Tobias and Vladimir for your reviews!

@chhagedorn
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 14, 2023

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

  • 5c91622: 8314117: RISC-V: Incorrect VMReg encoding in RISCV64Frame.java
  • 6bbcef5: 8313948: Remove unnecessary static fields defaultUpper/defaultLower in sun.net.PortConfig
  • b88c273: 8313743: Make fields final in sun.nio.ch
  • ec0cc63: 8313904: [macos] All signing tests which verifies unsigned app images are failing
  • 7332502: 8314139: TEST_BUG: runtime/os/THPsInThreadStackPreventionTest.java could fail on machine with large number of cores
  • 8f1c134: 8313798: [aarch64] sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java sometimes times out on aarch64
  • 1232677: 8313244: NM flags handling in configure process
  • 6ffc032: 8314113: G1: Remove unused G1CardSetInlinePtr::card_at
  • 62adeb0: 8311648: Refactor the Arena/Chunk/ChunkPool interface
  • 43462a3: 8313224: Avoid calling JavaThread::current() in MemAllocator::Allocation constructor
  • ... and 63 more: https://git.openjdk.org/jdk/compare/dc01604756c22889412f9f25b534488180327317...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 14, 2023

@chhagedorn Pushed as commit 1de5bf1.

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