RFR: 8342640: GenShen: Silently ignoring ShenandoahGCHeuristics considered poor user-experience

Rui Li duke at openjdk.org
Wed Aug 27 18:31:03 UTC 2025


When generational shenandoah is enabled, it ignores the value of ShenandoahGCHeuristics input silently:

java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=junk -version
openjdk version "25" 2025-09-16 LTS
OpenJDK Runtime Environment Corretto-25.0.0.36.1 (build 25+36-LTS)
OpenJDK 64-Bit Server VM Corretto-25.0.0.36.1 (build 25+36-LTS, mixed mode, sharing)


Adding additional guard rail to gen shen is not an option - it is actually by design that gen shen does not support non adaptive heuristics due to the complexity brought by generational design. 

So print out a warning to users to indicate that their `ShenandoahGCHeuristics` input is ignored.


x64 (8342640) % java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=static -version
[0.001s][warning][gc] Ignoring -XX:ShenandoahGCHeuristics input: static, because generational shenandoah only supports adaptive heuristics
openjdk version "26" 2026-03-17
OpenJDK Runtime Environment Corretto-26.0.2.1.1 (slowdebug build 26+2-FR)
OpenJDK 64-Bit Server VM Corretto-26.0.2.1.1 (slowdebug build 26+2-FR, mixed mode)

x64 (8342640) % java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=junk -version
[0.001s][warning][gc] Ignoring -XX:ShenandoahGCHeuristics input: junk, because generational shenandoah only supports adaptive heuristics
openjdk version "26" 2026-03-17
OpenJDK Runtime Environment Corretto-26.0.2.1.1 (slowdebug build 26+2-FR)
OpenJDK 64-Bit Server VM Corretto-26.0.2.1.1 (slowdebug build 26+2-FR, mixed mode)

x64 (8342640) % java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -XX:ShenandoahGCHeuristics=adaptive -version
openjdk version "26" 2026-03-17
OpenJDK Runtime Environment Corretto-26.0.2.1.1 (slowdebug build 26+2-FR)
OpenJDK 64-Bit Server VM Corretto-26.0.2.1.1 (slowdebug build 26+2-FR, mixed mode)

x64 (8342640) % java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -version  
openjdk version "26" 2026-03-17
OpenJDK Runtime Environment Corretto-26.0.2.1.1 (slowdebug build 26+2-FR)
OpenJDK 64-Bit Server VM Corretto-26.0.2.1.1 (slowdebug build 26+2-FR, mixed mode)

-------------

Commit messages:
 - 8342640: GenShen: Silently ignoring ShenandoahGCHeuristics considered poor user-experience

Changes: https://git.openjdk.org/jdk/pull/26968/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26968&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8342640
  Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/26968.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26968/head:pull/26968

PR: https://git.openjdk.org/jdk/pull/26968


More information about the hotspot-gc-dev mailing list