Skip to content
Permalink
Browse files

8240745: Implementation: JEP 377: ZGC: A Scalable Low-Latency Garbage…

… Collector (Production)

Reviewed-by: stefank, eosterlund
  • Loading branch information
pliden committed Apr 3, 2020
1 parent 76d5349 commit 2e4783411edd20c30c9673a253761c4b5cc7514c
Showing with 49 additions and 57 deletions.
  1. +1 −1 src/hotspot/share/gc/shared/gc_globals.hpp
  2. +7 −7 src/hotspot/share/gc/z/z_globals.hpp
  3. +7 −7 src/hotspot/share/jfr/metadata/metadata.xml
  4. +2 −2 test/hotspot/jtreg/compiler/gcbarriers/UnsafeIntrinsicsTest.java
  5. +2 −2 test/hotspot/jtreg/compiler/loopopts/TestRangeCheckPredicatesControl.java
  6. +2 −2 test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java
  7. +2 −2 test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithZ.java
  8. +3 −3 test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithZ.java
  9. +0 −1 test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java
  10. +6 −6 test/hotspot/jtreg/gc/z/TestAlwaysPreTouch.java
  11. +2 −3 test/hotspot/jtreg/gc/z/TestHighUsage.java
  12. +0 −1 test/hotspot/jtreg/gc/z/TestSmallHeap.java
  13. +3 −3 test/hotspot/jtreg/gc/z/TestUncommit.java
  14. +0 −4 test/hotspot/jtreg/runtime/cds/appcds/TestZGCWithCDS.java
  15. +2 −2 test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/IncompatibleOptions.java
  16. +2 −2 test/jdk/java/lang/management/MemoryMXBean/MemoryTestZGC.sh
  17. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java
  18. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java
  19. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java
  20. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestZPageCacheFlushEvent.java
  21. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java
  22. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java
  23. +1 −1 test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java
  24. +1 −2 test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java
@@ -164,7 +164,7 @@
experimental(bool, UseEpsilonGC, false, \
"Use the Epsilon (no-op) garbage collector") \
\
experimental(bool, UseZGC, false, \
product(bool, UseZGC, false, \
"Use the Z garbage collector") \
\
experimental(bool, UseShenandoahGC, false, \
@@ -38,26 +38,26 @@
range, \
constraint) \
\
experimental(double, ZAllocationSpikeTolerance, 2.0, \
product(double, ZAllocationSpikeTolerance, 2.0, \
"Allocation spike tolerance factor") \
\
experimental(double, ZFragmentationLimit, 25.0, \
product(double, ZFragmentationLimit, 25.0, \
"Maximum allowed heap fragmentation") \
\
experimental(size_t, ZMarkStackSpaceLimit, 8*G, \
product(size_t, ZMarkStackSpaceLimit, 8*G, \
"Maximum number of bytes allocated for mark stacks") \
range(32*M, 1024*G) \
\
experimental(uint, ZCollectionInterval, 0, \
product(uint, ZCollectionInterval, 0, \
"Force GC at a fixed time interval (in seconds)") \
\
experimental(bool, ZProactive, true, \
product(bool, ZProactive, true, \
"Enable proactive GC cycles") \
\
experimental(bool, ZUncommit, true, \
product(bool, ZUncommit, true, \
"Uncommit unused memory") \
\
experimental(uintx, ZUncommitDelay, 5 * 60, \
product(uintx, ZUncommitDelay, 5 * 60, \
"Uncommit memory if it has been unused for the specified " \
"amount of time (in seconds)") \
\
@@ -993,12 +993,12 @@
<Field type="uint" name="newRatio" label="New Ratio" description="The size of the young generation relative to the tenured generation" />
</Event>

<Event name="ZAllocationStall" category="Java Virtual Machine, GC, Detailed" label="ZGC Allocation Stall" description="Time spent waiting for memory to become available" thread="true" experimental="true">
<Event name="ZAllocationStall" category="Java Virtual Machine, GC, Detailed" label="ZGC Allocation Stall" description="Time spent waiting for memory to become available" thread="true">
<Field type="ZPageTypeType" name="type" label="Type" />
<Field type="ulong" contentType="bytes" name="size" label="Size" />
</Event>

<Event name="ZPageAllocation" category="Java Virtual Machine, GC, Detailed" label="ZGC Page Allocation" description="Allocation of a ZPage" thread="true" stackTrace="true" experimental="true">
<Event name="ZPageAllocation" category="Java Virtual Machine, GC, Detailed" label="ZGC Page Allocation" description="Allocation of a ZPage" thread="true" stackTrace="true">
<Field type="ZPageTypeType" name="type" label="Type" />
<Field type="ulong" contentType="bytes" name="size" label="Size" />
<Field type="ulong" contentType="bytes" name="usedAfter" label="Used After" />
@@ -1008,19 +1008,19 @@
<Field type="boolean" name="noReserve" label="No Reserve" />
</Event>

<Event name="ZPageCacheFlush" category="Java Virtual Machine, GC, Detailed" label="ZGC Page Cache Flush" description="Flushing of ZPages" thread="true" stackTrace="true" experimental="true">
<Event name="ZPageCacheFlush" category="Java Virtual Machine, GC, Detailed" label="ZGC Page Cache Flush" description="Flushing of ZPages" thread="true" stackTrace="true">
<Field type="ulong" contentType="bytes" name="flushed" label="Flushed Size" />
<Field type="boolean" name="forAllocation" label="For Allocation" />
</Event>

<Event name="ZRelocationSet" category="Java Virtual Machine, GC, Detailed" label="ZGC Relocation Set" thread="true" experimental="true">
<Event name="ZRelocationSet" category="Java Virtual Machine, GC, Detailed" label="ZGC Relocation Set" thread="true">
<Field type="ulong" contentType="bytes" name="total" label="Total" />
<Field type="ulong" contentType="bytes" name="empty" label="Empty" />
<Field type="ulong" contentType="bytes" name="compactingFrom" label="Compacting From" />
<Field type="ulong" contentType="bytes" name="compactingTo" label="Compacting To" />
</Event>

<Event name="ZRelocationSetGroup" category="Java Virtual Machine, GC, Detailed" label="ZGC Relocation Set Group" thread="true" experimental="true">
<Event name="ZRelocationSetGroup" category="Java Virtual Machine, GC, Detailed" label="ZGC Relocation Set Group" thread="true">
<Field type="ZPageTypeType" name="type" label="Type" />
<Field type="ulong" name="pages" label="Pages" />
<Field type="ulong" contentType="bytes" name="total" label="Total" />
@@ -1029,7 +1029,7 @@
<Field type="ulong" contentType="bytes" name="compactingTo" label="Compacting To" />
</Event>

<Event name="ZStatisticsCounter" category="Java Virtual Machine, GC, Detailed" label="ZGC Statistics Counter" thread="true" experimental="true" >
<Event name="ZStatisticsCounter" category="Java Virtual Machine, GC, Detailed" label="ZGC Statistics Counter" thread="true" experimental="true">
<Field type="ZStatisticsCounterType" name="id" label="Id" />
<Field type="ulong" name="increment" label="Increment" />
<Field type="ulong" name="value" label="Value" />
@@ -1045,7 +1045,7 @@
<Field type="string" name="name" label="Name" />
</Event>

<Event name="ZUncommit" category="Java Virtual Machine, GC, Detailed" label="ZGC Uncommit" description="Uncommitting of memory" thread="true" experimental="true">
<Event name="ZUncommit" category="Java Virtual Machine, GC, Detailed" label="ZGC Uncommit" description="Uncommitting of memory" thread="true">
<Field type="ulong" contentType="bytes" name="capacityBefore" label="Capacity Before" />
<Field type="ulong" contentType="bytes" name="capacityAfter" label="Capacity After" />
<Field type="ulong" contentType="bytes" name="uncommitted" label="Uncommitted" />
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
* @modules java.base/jdk.internal.misc:+open
* @summary Validate barriers after Unsafe getReference, CAS and swap (GetAndSet)
* @requires vm.gc.Z & !vm.graal.enabled
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+ZVerifyViews -XX:ZCollectionInterval=1 -XX:-CreateCoredumpOnCrash -XX:CompileCommand=dontinline,*::mergeImpl* compiler.gcbarriers.UnsafeIntrinsicsTest
* @run main/othervm -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+ZVerifyViews -XX:ZCollectionInterval=1 -XX:-CreateCoredumpOnCrash -XX:CompileCommand=dontinline,*::mergeImpl* compiler.gcbarriers.UnsafeIntrinsicsTest
*/

package compiler.gcbarriers;
@@ -27,8 +27,8 @@
* @bug 8237859
* @summary A LoadP node has a wrong control input (too early) which results in an out-of-bounds read of an object array with ZGC.
*
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC compiler.loopopts.TestRangeCheckPredicatesControl
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM compiler.loopopts.TestRangeCheckPredicatesControl
* @run main/othervm -XX:+UseZGC compiler.loopopts.TestRangeCheckPredicatesControl
* @run main/othervm -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM compiler.loopopts.TestRangeCheckPredicatesControl
*/

package compiler.loopopts;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,9 +44,9 @@ public static void main(String[] args) throws Exception {
ProcessBuilder pb = GCArguments.createJavaProcessBuilder("-XX:-UseSerialGC",
"-XX:-UseParallelGC",
"-XX:-UseG1GC",
"-XX:-UseZGC",
"-XX:+UnlockExperimentalVMOptions",
"-XX:-UseShenandoahGC",
"-XX:-UseZGC",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldMatch("Garbage collector not selected");
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
* @requires vm.gc.Z
* @requires vm.flavor == "server" & !vm.emulatedClient & !vm.graal.enabled
* @summary Stress ZGC
* @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx384m -server -XX:+UnlockExperimentalVMOptions -XX:+UseZGC gc.stress.gcbasher.TestGCBasherWithZ 120000
* @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx384m -server -XX:+UseZGC gc.stress.gcbasher.TestGCBasherWithZ 120000
*/
public class TestGCBasherWithZ {
public static void main(String[] args) throws IOException {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,8 @@
* @library /
* @requires vm.gc.Z & !vm.graal.enabled
* @summary Stress the Z
* @run main/othervm -Xmx384M -XX:+UnlockExperimentalVMOptions -XX:+UseZGC gc.stress.gcold.TestGCOldWithZ 50 1 20 10 10000
* @run main/othervm -Xmx256m -XX:+UnlockExperimentalVMOptions -XX:+UseZGC gc.stress.gcold.TestGCOldWithZ 50 5 20 1 5000
* @run main/othervm -Xmx384M -XX:+UseZGC gc.stress.gcold.TestGCOldWithZ 50 1 20 10 10000
* @run main/othervm -Xmx256m -XX:+UseZGC gc.stress.gcold.TestGCOldWithZ 50 5 20 1 5000
*/
public class TestGCOldWithZ {
public static void main(String[] args) {
@@ -42,7 +42,6 @@ public static void main(String[] args) throws Exception {
final String failedToCreateFile = "Failed to create file " + directory;

ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder(new String[] {
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
"-Xlog:gc*",
"-Xms32M",
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,11 @@
* @test TestAlwaysPreTouch
* @requires vm.gc.Z & !vm.graal.enabled
* @summary Test ZGC parallel pre-touch
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc* -XX:-AlwaysPreTouch -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=1 -Xms2M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms2M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=1 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UseZGC -Xlog:gc* -XX:-AlwaysPreTouch -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=1 -Xms2M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms2M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=1 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
* @run main/othervm -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
*/

public class TestAlwaysPreTouch {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -85,8 +85,7 @@ public static void main(String[] args) throws Exception {
}

public static void main(String[] args) throws Exception {
ProcessTools.executeTestJvm(new String[]{ "-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
ProcessTools.executeTestJvm(new String[]{ "-XX:+UseZGC",
"-XX:-ZProactive",
"-Xms128M",
"-Xmx128M",
@@ -54,7 +54,6 @@ public static void main(String[] args) throws Exception {
public static void main(String[] args) throws Exception {
for (var maxCapacity: args) {
ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder(new String[] {
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
"-Xlog:gc,gc+init,gc+reloc,gc+heap",
"-Xmx" + maxCapacity,
@@ -27,9 +27,9 @@
* @test TestUncommit
* @requires vm.gc.Z & !vm.graal.enabled & vm.compMode != "Xcomp"
* @summary Test ZGC uncommit unused memory
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit true 2
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*,gc+stats=off -Xms512M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit false 1
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 -XX:-ZUncommit gc.z.TestUncommit false 1
* @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit true 2
* @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+stats=off -Xms512M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit false 1
* @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 -XX:-ZUncommit gc.z.TestUncommit false 1
*/

/*
@@ -39,7 +39,6 @@ public static void main(String... args) throws Exception {
OutputAnalyzer out = TestCommon
.dump(helloJar,
new String[] {"Hello"},
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
"-Xlog:cds");
out.shouldContain("Dumping shared data to file:");
@@ -49,7 +48,6 @@ public static void main(String... args) throws Exception {
System.out.println("1. Run with same args of dump");
out = TestCommon
.exec(helloJar,
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
"-Xlog:cds",
"Hello");
@@ -60,7 +58,6 @@ public static void main(String... args) throws Exception {
System.out.println("2. Run with ZGC turned off");
out = TestCommon
.exec(helloJar,
"-XX:+UnlockExperimentalVMOptions",
"-XX:-UseZGC",
"-XX:+UseCompressedOops", // in case turned off by vmoptions
"-XX:+UseCompressedClassPointers", // by jtreg
@@ -120,7 +117,6 @@ public static void main(String... args) throws Exception {
System.out.println("7. Run with ZGC");
out = TestCommon
.exec(helloJar,
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
"-Xlog:cds",
"Hello");
@@ -101,8 +101,8 @@ public static void test(String[] args_ignored) throws Exception {

// Uncompressed OOPs
testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", null, false);
if (GC.Z.isSupported()) { // ZGC is included in build.
testDump(1, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC", null, false);
if (GC.Z.isSupported()) {
testDump(1, "-XX:+UseZGC", "-XX:-UseCompressedOops", null, false);
}

// incompatible GCs
@@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,6 @@ runOne()

# Test MemoryTest with ZGC. ZGC is a single generation GC, which means
# it has one memory manager and one memory pool.
runOne -XX:+UnlockExperimentalVMOptions -XX:+UseZGC MemoryTest 1 1
runOne -XX:+UseZGC MemoryTest 1 1

exit 0
@@ -37,7 +37,7 @@
* @requires vm.hasJFR & vm.gc.Z
* @key jfr
* @library /test/lib /test/jdk /test/hotspot/jtreg
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestGCPhaseConcurrent
* @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestGCPhaseConcurrent
*/
public class TestGCPhaseConcurrent {
public static void main(String[] args) throws Exception {

0 comments on commit 2e47834

Please sign in to comment.