Skip to content

8358334: C2/Shenandoah: incorrect execution with Unsafe #1901

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Jun 18, 2025

Patch doesn't apply cleanly:

  • jdk21u still has IU barriers: context for some of the changes is
    different.

  • Because of IU barriers, there's an extra call to fix_ctrl() for
    which the renaming to nodes_above_barriers must be applied.

  • The initial patch makes a subtle change that doesn't affect jdk
    25/26 in the code that was
    refactored. ShenandoahBarrierC2Support::push_data_inputs_at_control()
    is introduced with logic:

    if (in != nullptr && phase->has_ctrl(in) && phase->get_ctrl(in) == ctrl) {

which replaces the same logic in
ShenandoahBarrierC2Support::fix_ctrl() but also a slightly
different logic in
ShenandoahBarrierC2Support::is_dominator_same_ctrl():

    if (m->in(i) != nullptr && phase->ctrl_or_self(m->in(i)) == c) {

that is, it uses ctrl_or_self() which works for both data nodes
and control nodes but the new method uses has_ctrl(in) && get_ctrl(in) which can only be true for data nodes. That change
causes failures in jdk 21 again because of IU barriers that produce
a new memory state when expanded and need the logic from
MemoryGraphFixer. What I propose in this backport to be on the
safe side is to leave
ShenandoahBarrierC2Support::is_dominator_same_ctrl() alone (not
apply that part of the refactoring).

Tested with hotspot_gc_shenandoah + tier1 with -XX:+UseShenandoahGC


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • JDK-8358334 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8358334: C2/Shenandoah: incorrect execution with Unsafe (Bug - P2)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/1901/head:pull/1901
$ git checkout pull/1901

Update a local copy of the PR:
$ git checkout pull/1901
$ git pull https://git.openjdk.org/jdk21u-dev.git pull/1901/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1901

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/1901.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 18, 2025

👋 Welcome back roland! 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 Jun 18, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 46cfc1e1940ff6b91c4f0cb0a9161fd0aef37c38 8358334: C2/Shenandoah: incorrect execution with Unsafe Jun 18, 2025
@openjdk
Copy link

openjdk bot commented Jun 18, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels Jun 18, 2025
@mlbridge
Copy link

mlbridge bot commented Jun 18, 2025

Webrevs

Copy link
Contributor

@earthling-amzn earthling-amzn left a comment

Choose a reason for hiding this comment

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

My approval doesn't count for anything here, but in case it helps grease the wheels: I ran this test without the patch and observed it fail. I ran the test with the patch and observed it pass. Thank you for the backport!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants