Skip to content

8356075: Support Shenandoah GC in JVMCI #25001

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

Conversation

rkennke
Copy link
Contributor

@rkennke rkennke commented May 2, 2025

In order to support Shenandoah GC in Graal, some changes are required in JVMCI, namely, export Shenandoah relevant symbols.

Testing:


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-8356075: Support Shenandoah GC in JVMCI (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25001

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 2, 2025

👋 Welcome back rkennke! 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 May 2, 2025

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

8356075: Support Shenandoah GC in JVMCI

Reviewed-by: shade, dnsimon, cslucas

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 77 new commits pushed to 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
Copy link

openjdk bot commented May 2, 2025

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

  • build
  • core-libs
  • graal
  • hotspot
  • shenandoah

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 build build-dev@openjdk.org hotspot hotspot-dev@openjdk.org core-libs core-libs-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels May 2, 2025
@rkennke rkennke changed the title Support Shenandoah GC in JVMCI 8356075: Support Shenandoah GC in JVMCI May 2, 2025
@rkennke
Copy link
Contributor Author

rkennke commented May 2, 2025

/label remove build

@rkennke
Copy link
Contributor Author

rkennke commented May 2, 2025

/label remove core-libs

@openjdk openjdk bot removed the build build-dev@openjdk.org label May 2, 2025
@openjdk
Copy link

openjdk bot commented May 2, 2025

@rkennke
The build label was successfully removed.

@openjdk openjdk bot removed the core-libs core-libs-dev@openjdk.org label May 2, 2025
@openjdk
Copy link

openjdk bot commented May 2, 2025

@rkennke
The core-libs label was successfully removed.

@rkennke rkennke marked this pull request as ready for review May 5, 2025 13:39
@openjdk openjdk bot added the rfr Pull request is ready for review label May 5, 2025
@mlbridge
Copy link

mlbridge bot commented May 5, 2025

Webrevs

Copy link
Member

@dougxc dougxc left a comment

Choose a reason for hiding this comment

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

LGTM

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

A few questions:

Comment on lines 40 to 42
static void pre_barrier(JavaThread* thread, oopDesc* orig) {
write_ref_field_pre(orig, thread);
}
Copy link
Member

Choose a reason for hiding this comment

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

So, why not export write_ref_field_pre, instead of introducing this new method? Style/cleanliness, or something else? I am asking, because every time we add a new stub here, we would need to record it in AOTCache tables for Leyden benefit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's about the argument ordering. Graal expects the Thread* to be prependend, while other JITs call it with the Thread* appended. I guess we could change other JIT calls to also prepend the thread, or change the interface to not pass the Thread* at all. I chose to follow G1 and export both variants.

Copy link
Member

@shipilev shipilev May 5, 2025

Choose a reason for hiding this comment

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

Oh, so this matches JVMCIRuntime::write_barrier_pre for G1 (weird place to have it, but oh well).

Does Graal need the Thread* argument?

I think this method is only called when SATB buffer is full. So the performance of this method is likely not affected by getting the current thread down in caller. So I think it would be more straight-forward to sharpen ShenandoahRuntime::write_ref_field_pre by dropping Thread* and then exporting that. Maybe also under the SR::write_barrier_pre name to be even more consistent for everything else.

Maybe @JohnTortugo wants to clean up more mess in C2 related to this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Graal does not need the Thread* argument, but the runtime code behind write_ref_pre() currently uses it. I agree, it does not look performance critical to pass it through. However, getting rid of it seems to blow the scope of this PR. I'd rather do this as a follow-up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'd probably add the new entry for Graal without the Thread* argument now, and fix the others in a follow-up. Otherwise we need to deal with it on the Graal side again later once we change the entry points.

Copy link
Member

Choose a reason for hiding this comment

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

OK, but that follow-up risks changing the JVMCI interface again? How about we introduce:

static void write_barrier_pre(oopDesc* pre_val) {
  write_ref_field_pre(pre_val, JavaThread::current());
}

...and then the follow-up purges the old write_ref_field_pre? The implementation might need to be in .cpp.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 5, 2025
Copy link
Contributor

@JohnTortugo JohnTortugo left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

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.

All right, this works, thanks!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 6, 2025
@rkennke
Copy link
Contributor Author

rkennke commented May 6, 2025

Thanks!

/integrate

@openjdk
Copy link

openjdk bot commented May 6, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 6, 2025

@rkennke Pushed as commit 614ba9f.

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

@@ -227,12 +236,22 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
assert(base != nullptr, "unexpected byte_map_base");
cardtable_start_address = base;
cardtable_shift = CardTable::card_shift();
} else if (bs->is_a(BarrierSet::ShenandoahBarrierSet)) {
Copy link
Member

@dougxc dougxc May 6, 2025

Choose a reason for hiding this comment

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

This change is causing a failure in mach5 tier 1:

[2025-05-06T11:34:44,742Z] /workspace/open/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp:239:35: error: no member named 'ShenandoahBarrierSet' in 'BarrierSet'
[2025-05-06T11:34:44,742Z]   } else if (bs->is_a(BarrierSet::ShenandoahBarrierSet)) {
[2025-05-06T11:34:44,742Z]                       ~~~~~~~~~~~~^
[2025-05-06T11:34:45,729Z] 1 error generated.

I assume it's missing #if INCLUDE_SHENANDOAHGC.

https://bugs.openjdk.org/browse/JDK-8356265

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

Successfully merging this pull request may close these issues.

4 participants