Skip to content

8381871: GenShen: ShenandoahGCHeuristics flag not reset after ignoring non-adaptive value#30714

Open
pf0n wants to merge 5 commits intoopenjdk:masterfrom
pf0n:8381871
Open

8381871: GenShen: ShenandoahGCHeuristics flag not reset after ignoring non-adaptive value#30714
pf0n wants to merge 5 commits intoopenjdk:masterfrom
pf0n:8381871

Conversation

@pf0n
Copy link
Copy Markdown

@pf0n pf0n commented Apr 13, 2026

Reset ShenandoahGCHeuristics flag to "adaptive" after a non-adaptive value is set for ShenandoahGCHeuristics when using Generational Shenandoah.

Testing

Created a test file TestGenerationalHeuristics.java that checks if ShenandoahGCHeuristics flag is always adaptive for Generational Shenandoah.



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (4 reviews required, with at least 1 Reviewer, 3 Authors)

Issue

  • JDK-8381871: GenShen: ShenandoahGCHeuristics flag not reset after ignoring non-adaptive value (Bug - P5)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30714

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 13, 2026

👋 Welcome back pf0n! 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
Copy Markdown

openjdk bot commented Apr 13, 2026

@pf0n This change is no longer ready for integration - check the PR body for details.

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Apr 13, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 13, 2026

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

  • hotspot-gc
  • 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 the rfr Pull request is ready for review label Apr 13, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 13, 2026

Webrevs

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 13, 2026
Copy link
Copy Markdown
Contributor

@kdnilsen kdnilsen left a comment

Choose a reason for hiding this comment

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

Thanks for this fix.

@mrserb
Copy link
Copy Markdown
Member

mrserb commented Apr 13, 2026

/reviewers 4

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 13, 2026

@mrserb
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 4 (with at least 1 Reviewer, 3 Authors).

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Apr 13, 2026
Copy link
Copy Markdown
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

Fix looks fine.

Can you verify the result of "PrintFlagsInitial"?

@pf0n
Copy link
Copy Markdown
Author

pf0n commented Apr 13, 2026

Fix looks fine.

Can you verify the result of "PrintFlagsInitial"?

Yes, here's the result:

$ ./build/linux-x86_64-server-release/images/jdk/bin/java -XX:+UseShenandoahGC \
    -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=static \
    -XX:+PrintFlagsFinal -version | grep ShenandoahGCHeuristics

[0.001s][warning][gc] Ignoring -XX:ShenandoahGCHeuristics input: static, because generational shenandoah only supports adaptive heuristics
    ccstr ShenandoahGCHeuristics                   = adaptive                                  {product} {command line}

@mrserb
Copy link
Copy Markdown
Member

mrserb commented Apr 13, 2026

I think FLAG_SET_ERGO should be used here. The FLAG_SET_DEFAULT will just assign the flag(I did not find a place where this macro is used with strings?). As far as I understand the FLAG_SET_ERGO will additionally clean the heap allocated for the string passed by the user.

@mrserb
Copy link
Copy Markdown
Member

mrserb commented Apr 13, 2026

It would be good to add a test for this issue. grep the current tests for usage of "PrintFlagsFinal", you will find a few that call java via ProcessTools and check the results, for ex ProcessToolsExecuteLimitedTestJavaTest.

@mrserb
Copy link
Copy Markdown
Member

mrserb commented Apr 13, 2026

another example of the test: gc/shenandoah/options/TestThreadCountsOverride.java

@ysramakrishna
Copy link
Copy Markdown
Member

Fix looks fine.
Can you verify the result of "PrintFlagsInitial"?

Yes, here's the result:

$ ./build/linux-x86_64-server-release/images/jdk/bin/java -XX:+UseShenandoahGC \
    -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=static \
    -XX:+PrintFlagsFinal -version | grep ShenandoahGCHeuristics

[0.001s][warning][gc] Ignoring -XX:ShenandoahGCHeuristics input: static, because generational shenandoah only supports adaptive heuristics
    ccstr ShenandoahGCHeuristics                   = adaptive                                  {product} {command line}

How about -XX:+PrintFlagsInitial ?

@pf0n
Copy link
Copy Markdown
Author

pf0n commented Apr 14, 2026

I think FLAG_SET_ERGO should be used here. The FLAG_SET_DEFAULT will just assign the flag(I did not find a place where this macro is used with strings?). As far as I understand the FLAG_SET_ERGO will additionally clean the heap allocated for the string passed by the user.

@mrserb good to note, I'll make that change.

@pf0n
Copy link
Copy Markdown
Author

pf0n commented Apr 14, 2026

@ysramakrishna Here is -XX:+PrintFlagsInitial. The results are the same before my change.

$ ./build/linux-x86_64-server-release/jdk/bin/java -XX:+UseShenandoahGC \                          
    -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=static \
    -XX:+PrintFlagsInitial -version | grep ShenandoahGCHeuristics

    ccstr ShenandoahGCHeuristics                   = adaptive                                  {product} {default}

@pf0n pf0n requested a review from ysramakrishna April 14, 2026 19:02
@pf0n pf0n requested a review from mrserb April 14, 2026 22:07
@ysramakrishna
Copy link
Copy Markdown
Member

Fix looks fine.
Can you verify the result of "PrintFlagsInitial"?

Yes, here's the result:

$ ./build/linux-x86_64-server-release/images/jdk/bin/java -XX:+UseShenandoahGC \
    -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=static \
    -XX:+PrintFlagsFinal -version | grep ShenandoahGCHeuristics

[0.001s][warning][gc] Ignoring -XX:ShenandoahGCHeuristics input: static, because generational shenandoah only supports adaptive heuristics
    ccstr ShenandoahGCHeuristics                   = adaptive                                  {product} {command line}

I assume that, after the change suggested by @mrserb , above you now get ergonomic instead of command line as the last field in the output?

@pf0n
Copy link
Copy Markdown
Author

pf0n commented Apr 14, 2026

I assume that, after the change suggested by @mrserb , above you now get ergonomic instead of command line as the last field in the output?

This is the result after the change:

[0.001s][warning][gc] Ignoring -XX:ShenandoahGCHeuristics input: static, because generational shenandoah only supports adaptive heuristics
    ccstr ShenandoahGCHeuristics                   = adaptive                                  {product} {command line, ergonomic}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-gc hotspot-gc-dev@openjdk.org rfr Pull request is ready for review shenandoah shenandoah-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

6 participants