Skip to content

Commit

Permalink
Enable String Deduplication on JDK 17+ (#1380)
Browse files Browse the repository at this point in the history
Enable String Deduplication on JDK 17+

G1 and Shenandoah GC support string deduplication as of JDK 17
* https://openjdk.java.net/jeps/192
* https://bugs.openjdk.org/browse/JDK-8264718

Only enable on JDK 17+ due to fix
https://bugs.openjdk.org/browse/JDK-8277981

JDK 18+ enable string deduplication for SerialGC, ParallalGC, and ZGC.
https://malloc.se/blog/zgc-jdk18
  • Loading branch information
schlosna authored Mar 15, 2023
1 parent 33a7c9e commit 902de8d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions changelog/@unreleased/pr-1380.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type: improvement
improvement:
description: |-
Enable String Deduplication on JDK 17+
G1 and Shenandoah GC support string deduplication as of JDK 17
* https://openjdk.java.net/jeps/192
* https://bugs.openjdk.org/browse/JDK-8264718
Only enable on JDK 17+ due to fix
https://bugs.openjdk.org/browse/JDK-8277981
JDK 18+ enable string deduplication for SerialGC, ParallalGC, and ZGC.
https://malloc.se/blog/zgc-jdk18
links:
- https://github.com/palantir/sls-packaging/pull/1380
- https://openjdk.java.net/jeps/192
- https://bugs.openjdk.org/browse/JDK-8264718
- https://malloc.se/blog/zgc-jdk18
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public final class LaunchConfig {
ImmutableList.of("-XX:+ShowCodeDetailsInExceptionMessages");
private static final ImmutableList<String> java15Options =
ImmutableList.of("-XX:+UnlockDiagnosticVMOptions", "-XX:+ExpandSubTypeCheckAtParseTime");

private static final ImmutableList<String> java17PlusOptions = ImmutableList.of(
"-XX:+UseStringDeduplication"); // only enable on JDK 17+ due to https://bugs.openjdk.org/browse/JDK-8277981

private static final ImmutableList<String> disableBiasedLocking = ImmutableList.of("-XX:-UseBiasedLocking");
// Disable C2 compilation for problematic structure in JDK 11.0.16, see https://bugs.openjdk.org/browse/JDK-8291665
private static final ImmutableList<String> jdk11DisableC2Compile =
Expand Down Expand Up @@ -175,6 +179,10 @@ static void action(Params params) {
javaVersion.compareTo(JavaVersion.toVersion("15")) == 0
? java15Options
: ImmutableList.of())
.addAllJvmOpts(
javaVersion.compareTo(JavaVersion.toVersion("17")) >= 0
? java17PlusOptions
: ImmutableList.of())
// Biased locking is disabled on java 15+ https://openjdk.java.net/jeps/374
// We disable biased locking on all releases in order to reduce safepoint time,
// revoking biased locks requires a safepoint, and can occur for non-obvious
Expand Down

0 comments on commit 902de8d

Please sign in to comment.