--- old/test/hotspot/jtreg/TEST.ROOT 2018-06-08 19:43:26.008163274 +0200 +++ new/test/hotspot/jtreg/TEST.ROOT 2018-06-08 19:43:25.740151646 +0200 @@ -45,6 +45,7 @@ vm.gc.Serial \ vm.gc.Parallel \ vm.gc.ConcMarkSweep \ + vm.gc.Z \ vm.jvmci \ vm.emulatedClient \ vm.cpu.features \ --- old/test/hotspot/jtreg/gc/TestAllocateHeapAt.java 2018-06-08 19:43:26.391179892 +0200 +++ new/test/hotspot/jtreg/gc/TestAllocateHeapAt.java 2018-06-08 19:43:26.122168220 +0200 @@ -24,6 +24,7 @@ /* @test TestAllocateHeapAt.java * @key gc * @summary Test to check allocation of Java Heap with AllocateHeapAt option + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc */ --- old/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java 2018-06-08 19:43:26.772196423 +0200 +++ new/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java 2018-06-08 19:43:26.504184794 +0200 @@ -24,6 +24,7 @@ /* @test TestAllocateHeapAtError.java * @key gc * @summary Test to check correct handling of non-existent directory passed to AllocateHeapAt option + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc */ @@ -75,4 +76,3 @@ output.shouldNotHaveExitValue(0); } } - --- old/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java 2018-06-08 19:43:27.151212867 +0200 +++ new/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java 2018-06-08 19:43:26.883201239 +0200 @@ -26,7 +26,7 @@ * @summary Test to check allocation of Java Heap with AllocateHeapAt option. Has multiple sub-tests to cover different code paths. * @library /test/lib * @modules java.base/jdk.internal.misc - * @requires vm.bits == "64" + * @requires vm.bits == "64" & vm.gc != "Z" */ import jdk.test.lib.JDKToolFinder; --- old/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java 2018-06-08 19:43:27.538229658 +0200 +++ new/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java 2018-06-08 19:43:27.270218030 +0200 @@ -25,6 +25,7 @@ * @key gc * @bug 8010463 8011343 8011898 * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc */ --- old/test/hotspot/jtreg/gc/TestVerifySilently.java 2018-06-08 19:43:27.916246059 +0200 +++ new/test/hotspot/jtreg/gc/TestVerifySilently.java 2018-06-08 19:43:27.645234300 +0200 @@ -25,6 +25,7 @@ * @key gc * @bug 8032771 * @summary Test silent verification. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc */ --- old/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java 2018-06-08 19:43:28.300262720 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java 2018-06-08 19:43:28.030251005 +0200 @@ -43,6 +43,8 @@ "-XX:-UseParallelGC", "-XX:-UseG1GC", "-XX:-UseConcMarkSweepGC", + "-XX:+UnlockExperimentalVMOptions", + "-XX:-UseZGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldMatch("Garbage collector not selected"); --- old/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java 2018-06-08 19:43:28.652277992 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java 2018-06-08 19:43:28.385266408 +0200 @@ -25,6 +25,7 @@ * @test TestMaxMinHeapFreeRatioFlags * @key gc * @summary Verify that heap size changes according to max and min heap free ratios. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java 2018-06-08 19:43:29.023294089 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java 2018-06-08 19:43:28.755282461 +0200 @@ -26,6 +26,7 @@ * @key gc * @bug 8025166 * @summary Verify that heap devided among generations according to NewRatio + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java 2018-06-08 19:43:29.399310403 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java 2018-06-08 19:43:29.129298689 +0200 @@ -26,6 +26,7 @@ * @key gc * @bug 8025166 * @summary Verify that young gen size conforms values specified by NewSize, MaxNewSize and Xmn options + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java 2018-06-08 19:43:29.785327151 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java 2018-06-08 19:43:29.519315610 +0200 @@ -25,6 +25,7 @@ * @test TestShrinkHeapInSteps * @key gc * @summary Verify that -XX:-ShrinkHeapInSteps works properly. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java 2018-06-08 19:43:30.168343769 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java 2018-06-08 19:43:29.900332141 +0200 @@ -25,6 +25,7 @@ * @test TestSurvivorRatioFlag * @key gc * @summary Verify that actual survivor ratio is equal to specified SurvivorRatio value + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java 2018-06-08 19:43:30.548360256 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java 2018-06-08 19:43:30.276348455 +0200 @@ -27,6 +27,7 @@ * @summary Verify that option TargetSurvivorRatio affects survivor space occupancy after minor GC. * @requires (vm.opt.ExplicitGCInvokesConcurrent == null) | (vm.opt.ExplicitGCInvokesConcurrent == false) * @requires (vm.opt.UseJVMCICompiler == null) | (vm.opt.UseJVMCICompiler == false) + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java 2018-06-08 19:43:30.919376353 +0200 +++ new/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java 2018-06-08 19:43:30.652364769 +0200 @@ -28,6 +28,7 @@ * @summary Runs an simple application (GarbageProducer) with various combinations of -XX:{+|-}Verify{After|Before}GC flags and checks that output contain or doesn't contain expected patterns + * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * @modules java.management * @library /test/lib --- old/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java 2018-06-08 19:43:31.304393058 +0200 +++ new/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java 2018-06-08 19:43:31.036381430 +0200 @@ -42,6 +42,7 @@ * @key gc stress * @summary Switches gc log level on fly while stressing memory/gc * @requires !vm.flightRecorder + * @requires vm.gc != "Z" * @library /test/lib / * @modules java.management java.base/jdk.internal.misc * --- old/test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java 2018-06-08 19:43:31.678409285 +0200 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java 2018-06-08 19:43:31.411397700 +0200 @@ -26,6 +26,7 @@ * @bug 8031323 * @summary Verify that object's alignment in eden space is not affected by * SurvivorAlignmentInBytes option. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java 2018-06-08 19:43:32.051425469 +0200 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java 2018-06-08 19:43:31.780413711 +0200 @@ -26,6 +26,7 @@ * @bug 8031323 * @summary Verify that objects promoted from eden space to tenured space during * full GC are not aligned to SurvivorAlignmentInBytes value. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java 2018-06-08 19:43:32.433442043 +0200 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java 2018-06-08 19:43:32.163430328 +0200 @@ -26,6 +26,7 @@ * @bug 8031323 * @summary Verify that objects promoted from survivor space to tenured space * during full GC are not aligned to SurvivorAlignmentInBytes value. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2018-06-08 19:43:32.810458401 +0200 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2018-06-08 19:43:32.543446816 +0200 @@ -27,6 +27,7 @@ * @summary Verify that objects promoted from survivor space to tenured space * when their age exceeded tenuring threshold are not aligned to * SurvivorAlignmentInBytes value. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java 2018-06-08 19:43:33.189474845 +0200 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java 2018-06-08 19:43:32.920463173 +0200 @@ -26,6 +26,7 @@ * @bug 8031323 * @summary Verify that objects promoted from eden space to survivor space after * minor GC are aligned to SurvivorAlignmentInBytes. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/whitebox/TestWBGC.java 2018-06-08 19:43:33.568491289 +0200 +++ new/test/hotspot/jtreg/gc/whitebox/TestWBGC.java 2018-06-08 19:43:33.303479791 +0200 @@ -25,6 +25,7 @@ * @test TestWBGC * @bug 8055098 * @summary Test verify that WB methods isObjectInOldGen and youngGC works correctly. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java 2018-06-08 19:43:33.959508254 +0200 +++ new/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java 2018-06-08 19:43:33.686496409 +0200 @@ -30,6 +30,7 @@ * @test * @key metaspace jcmd * @summary Test the VM.metaspace command + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java 2018-06-08 19:43:34.342524871 +0200 +++ new/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java 2018-06-08 19:43:34.069513026 +0200 @@ -23,6 +23,7 @@ /* @test TestLargePagesFlags * @summary Tests how large pages are choosen depending on the given large pages flag combinations. + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/serviceability/dcmd/gc/RunGCTest.java 2018-06-08 19:43:34.728541619 +0200 +++ new/test/hotspot/jtreg/serviceability/dcmd/gc/RunGCTest.java 2018-06-08 19:43:34.459529948 +0200 @@ -36,6 +36,7 @@ /* * @test * @summary Test of diagnostic command GC.run + * @requires vm.gc != "Z" * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler --- old/test/hotspot/jtreg/serviceability/sa/TestUniverse.java 2018-06-08 19:43:35.110558193 +0200 +++ new/test/hotspot/jtreg/serviceability/sa/TestUniverse.java 2018-06-08 19:43:34.842546565 +0200 @@ -36,12 +36,25 @@ /* * @test * @summary Test the 'universe' command of jhsdb clhsdb. + * @requires vm.gc != "Z" * @bug 8190307 * @library /test/lib * @build jdk.test.lib.apps.* * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withoutZ + */ + +/* + * @test + * @summary Test the 'universe' command of jhsdb clhsdb. + * @requires vm.gc == "Z" + * @bug 8190307 + * @library /test/lib + * @build jdk.test.lib.apps.* + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withZ */ public class TestUniverse { @@ -106,6 +119,9 @@ output.shouldContain("PSYoungGen"); output.shouldContain("eden"); } + if (gc.contains("UseZGC")) { + output.shouldContain("ZHeap"); + } } @@ -113,6 +129,9 @@ LingeredApp app = null; try { List vmArgs = new ArrayList(); + if (gc.contains("UseZGC")) { + vmArgs.add("-XX:+UnlockExperimentalVMOptions"); + } vmArgs.add(gc); app = LingeredApp.startApp(vmArgs); System.out.println ("Started LingeredApp with the GC option " + gc + @@ -136,8 +155,11 @@ test("-XX:+UseG1GC"); test("-XX:+UseParallelGC"); test("-XX:+UseSerialGC"); - if (!Compiler.isGraalEnabled()) { // Graal does not support CMS - test("-XX:+UseConcMarkSweepGC"); + if (!Compiler.isGraalEnabled()) { // Graal does not support all GCs + test("-XX:+UseConcMarkSweepGC"); + if (args[0].equals("withZ")) { + test("-XX:+UseZGC"); + } } } catch (Exception e) { throw new Error("Test failed with " + e); --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java 2018-06-08 19:43:35.500575115 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java 2018-06-08 19:43:35.230563400 +0200 @@ -27,6 +27,7 @@ * @test * @summary Test checks the consistency of the output * displayed with jstat -gccapacity. + * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java 2018-06-08 19:43:35.882591689 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java 2018-06-08 19:43:35.609579844 +0200 @@ -32,6 +32,7 @@ * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @requires vm.gc != "Z" * @run main/othervm -XX:+UsePerfData -Xmx128M GcCauseTest01 */ import utils.*; --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java 2018-06-08 19:43:36.240607222 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java 2018-06-08 19:43:35.973595637 +0200 @@ -28,6 +28,7 @@ * test forces debuggee application eat ~70% of heap and runs jstat. * jstat should show actual usage of old gen (OC/OU ~= old gen usage). * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java 2018-06-08 19:43:36.597622712 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java 2018-06-08 19:43:36.332611214 +0200 @@ -27,6 +27,7 @@ * Test scenario: * test forces debuggee application call System.gc(), runs jstat and checks that * cause of last garbage collection displayed by jstat (LGCC) is 'System.gc()'. + * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java 2018-06-08 19:43:36.974639069 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java 2018-06-08 19:43:36.709627571 +0200 @@ -29,6 +29,7 @@ * test several times provokes garbage collection in the debuggee application and after each garbage * collection runs jstat. jstat should show that after garbage collection number of GC events and garbage * collection time increase. + * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java 2018-06-08 19:43:37.324654255 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java 2018-06-08 19:43:37.067643104 +0200 @@ -35,6 +35,7 @@ * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @requires vm.gc != "Z" * @run main/othervm -XX:+UsePerfData -Xmx128M GcTest01 */ import utils.*; --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java 2018-06-08 19:43:37.682669788 +0200 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java 2018-06-08 19:43:37.418658333 +0200 @@ -28,6 +28,7 @@ * test forces debuggee application eat ~70% of heap and runs jstat. * jstat should show actual usage of old gen (OC/OU ~= old gen usage). * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/CompressedClassSpaceSize/TestDescription.java 2018-06-08 19:43:38.040685321 +0200 +++ new/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/CompressedClassSpaceSize/TestDescription.java 2018-06-08 19:43:37.774673780 +0200 @@ -29,6 +29,7 @@ * VM Testbase keywords: [monitoring, quarantine] * VM Testbase comments: JDK-8058967 * + * @requires vm.opt.final.ClassUnloading * @library /vmTestbase /test/lib * @run driver jdk.test.lib.FileInstaller . . * @run main/othervm --- old/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/ShrinkGrowTest/ShrinkGrowTest.java 2018-06-08 19:43:38.405701158 +0200 +++ new/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/ShrinkGrowTest/ShrinkGrowTest.java 2018-06-08 19:43:38.137689529 +0200 @@ -27,6 +27,7 @@ * * @summary converted from VM Testbase metaspace/shrink_grow/ShrinkGrowTest. * + * @requires vm.opt.final.ClassUnloading * @library /vmTestbase /test/lib * @run driver jdk.test.lib.FileInstaller . . * @run main/othervm --- old/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java 2018-06-08 19:43:38.761716604 +0200 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java 2018-06-08 19:43:38.497705149 +0200 @@ -51,6 +51,7 @@ * create references of all possible types to single object, ObjectReference.referringObjects should return only * referrers with supported type(Strong, PhantomReference, SoftReference, WeakReference) * + * @requires vm.gc != "Z" * @library /vmTestbase * /test/lib * @run driver jdk.test.lib.FileInstaller . . @@ -151,6 +152,11 @@ else expectedInstanceCount = 0; + // Note! This test is broken, in the sense that it incorrectly assumes + // that no GC can happen before it walks the heap. In practice, it seems + // to only affect this test when using ZGC. However, this test will also + // fail when using other GCs if an explicit GC is done here. + checkDebugeeAnswer_instanceCounts(className, expectedInstanceCount, objectsToFilter); checkDebugeeAnswer_instances_referringObjects(objectsToFilter, className, expectedInstanceCount, includedInReferrersCount, referrerCount); --- old/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java 2018-06-08 19:43:39.135732831 +0200 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java 2018-06-08 19:43:38.870721333 +0200 @@ -41,6 +41,7 @@ * done * Test is executed for following sublcasses of ObjectReference: StringReference, ThreadReference, ClassLoaderReference * + * @requires vm.gc != "Z" * @library /vmTestbase * /test/lib * @run driver jdk.test.lib.FileInstaller . . @@ -125,6 +126,11 @@ ":" + referrerCount + ":" + referrerType + (referrerType.equals(ObjectInstancesManager.WEAK_REFERENCE) ? "|" + ObjectInstancesManager.STRONG_REFERENCE : "")); + // Note! This test is broken, in the sense that it incorrectly assumes + // that no GC can happen before it walks the heap. In practice, it seems + // to only affect this test when using ZGC. However, this test will also + // fail when using other GCs if an explicit GC is done here. + // the instance counts should not be affected by creating multiple references checkDebugeeAnswer_instanceCounts(className, createInstanceCount, objectsToFilter); --- old/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java 2018-06-08 19:43:39.499748624 +0200 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java 2018-06-08 19:43:39.236737213 +0200 @@ -60,6 +60,7 @@ * Finally, debugger sends debuggee signal to quit, waits for it exits * and exits too with the proper exit code. * + * @requires vm.gc != "Z" * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @run driver jdk.test.lib.FileInstaller . . @@ -156,6 +157,10 @@ long typeID = debuggee.getReferenceTypeID(createTypeSignature(testClassName)); + // Note! This test is broken, in the sense that it incorrectly assumes + // that no GC can happen before it walks the heap. In practice, it seems + // to only affect this test when using ZGC. However, this test will also + // fail when using other GCs if an explicit GC is done here. // create command with maxInstances=1, only 1 instance should be returned testClass(typeID, 1, 1, false, 0); --- old/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java 2018-06-08 19:43:39.888765502 +0200 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java 2018-06-08 19:43:39.611753484 +0200 @@ -61,6 +61,7 @@ * Finally, debugger sends debuggee signal to quit, waits for it exits * and exits too with the proper exit code. * + * @requires vm.gc != "Z" * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @run driver jdk.test.lib.FileInstaller . . @@ -164,6 +165,11 @@ if (!isDebuggeeReady()) return; + // Note! This test is broken, in the sense that it incorrectly assumes + // that no GC can happen before it walks the heap. In practice, it seems + // to only affect this test when using ZGC. However, this test will also + // fail when using other GCs if an explicit GC is done here. + int expectedCount = instanceCounts001a.expectedCount; String classNames[]; --- old/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java 2018-06-08 19:43:40.275782293 +0200 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java 2018-06-08 19:43:40.009770752 +0200 @@ -69,9 +69,10 @@ Boolean isExplicitGCInvokesConcurrentOn = wb.getBooleanVMFlag("ExplicitGCInvokesConcurrent"); Boolean isUseG1GCon = wb.getBooleanVMFlag("UseG1GC"); Boolean isUseConcMarkSweepGCon = wb.getBooleanVMFlag("UseConcMarkSweepGC"); + Boolean isUseZGCon = wb.getBooleanVMFlag("UseZGC"); String keyPhrase; - if (isExplicitGCInvokesConcurrentOn && (isUseG1GCon || isUseConcMarkSweepGCon)) { + if ((isExplicitGCInvokesConcurrentOn && (isUseG1GCon || isUseConcMarkSweepGCon)) || isUseZGCon) { keyPhrase = "GC"; } else { keyPhrase = "Pause Full"; --- old/test/jdk/TEST.ROOT 2018-06-08 19:43:40.639798087 +0200 +++ new/test/jdk/TEST.ROOT 2018-06-08 19:43:40.375786632 +0200 @@ -37,6 +37,7 @@ requires.properties= \ sun.arch.data.model \ java.runtime.name \ + vm.gc.Z \ vm.graal.enabled \ vm.cds --- old/test/jdk/com/sun/jdi/OomDebugTest.java 2018-06-08 19:43:40.997813620 +0200 +++ new/test/jdk/com/sun/jdi/OomDebugTest.java 2018-06-08 19:43:40.729801992 +0200 @@ -29,6 +29,7 @@ * * @author Severin Gehwolf * + * @requires vm.gc != "Z" * @library .. * @run build TestScaffold VMConnection TargetListener TargetAdapter * @run compile -g OomDebugTest.java --- old/test/jdk/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java 2018-06-08 19:43:41.391830715 +0200 +++ new/test/jdk/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java 2018-06-08 19:43:41.120818957 +0200 @@ -25,6 +25,7 @@ * @test * @bug 4858522 6191542 * @summary Basic unit test of OperatingSystemMXBean.getCommittedVirtualMemorySize() + * @requires vm.gc != "Z" * @author Steve Bohne */ --- old/test/jdk/java/lang/management/ManagementFactory/MXBeanException.java 2018-06-08 19:43:41.762846812 +0200 +++ new/test/jdk/java/lang/management/ManagementFactory/MXBeanException.java 2018-06-08 19:43:41.491835054 +0200 @@ -27,6 +27,7 @@ * @summary Check if a RuntimeException is wrapped by RuntimeMBeanException * only once. * + * @requires vm.gc != "Z" * @author Mandy Chung * * @build MXBeanException --- old/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java 2018-06-08 19:43:42.139863169 +0200 +++ new/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java 2018-06-08 19:43:41.869851454 +0200 @@ -26,6 +26,7 @@ * @bug 4530538 * @summary Basic unit test of MemoryMXBean.getMemoryPools() and * MemoryMXBean.getMemoryManager(). + * @requires vm.gc != "Z" * @author Mandy Chung * * @modules jdk.management --- old/test/lib/sun/hotspot/gc/GC.java 2018-06-08 19:43:42.518879613 +0200 +++ new/test/lib/sun/hotspot/gc/GC.java 2018-06-08 19:43:42.253868115 +0200 @@ -36,7 +36,8 @@ Serial(1), Parallel(2), ConcMarkSweep(3), - G1(4); + G1(4), + Z(5); private static final WhiteBox WB = WhiteBox.getWhiteBox(); --- /dev/null 2018-04-03 12:55:20.301839954 +0200 +++ new/test/hotspot/jtreg/compiler/gcbarriers/UnsafeIntrinsicsTest.java 2018-06-08 19:43:42.634884646 +0200 @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8059022 + * @modules java.base/jdk.internal.misc:+open + * @summary Validate barriers after Unsafe getObject, CAS and swap (GetAndSet) + * @requires vm.gc.Z & !vm.graal.enabled + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+ZUnmapBadViews -XX:ZCollectionInterval=1 -XX:-CreateCoredumpOnCrash -XX:CompileCommand=dontinline,*::mergeImpl* compiler.gcbarriers.UnsafeIntrinsicsTest + */ + +package compiler.gcbarriers; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Random; +import sun.misc.Unsafe; + +public class UnsafeIntrinsicsTest { + + /* + * This test triggers the loadbarriers by allocating a lot, keeping the objects alive and then + * letting them die in a way that maximizes fragmentation. + * + * All subtests (OperationType's) could run in parallel. + */ + + static int node_count = 133700; + static int thread_count = 4; + static int time = Integer.getInteger("time", 4); // seconds per subtest + + static Runner r = new Runner(null, 1, 1, Runner.OperationType.CAS); + + static Node first_node; + int epoch = 0; + + public static void main(String[] args) { + UnsafeIntrinsicsTest t = new UnsafeIntrinsicsTest(); + + t.testWithLocalData(Runner.OperationType.CAS); + t.testWithLocalData(Runner.OperationType.Weak_CAS); + t.testWithLocalData(Runner.OperationType.CMPX); + + t.testWithSharedData(Runner.OperationType.Swap); + t.testWithSharedData(Runner.OperationType.Load); + } + + public UnsafeIntrinsicsTest() { + + } + + public void testWithLocalData(Runner.OperationType optype) { + System.out.println("Testing " + optype.name() + " with " + thread_count +" thread and " + node_count + " nodes"); + + // start mutator threads + ArrayList thread_list = new ArrayList(); + Random r = new Random(System.nanoTime()); + for (int i = 0; i < thread_count; i++) { + + setup(); // each thread has its own circle of nodes + Thread t = new Thread(new Runner(first_node, time, r.nextLong(), optype)); + t.start(); + thread_list.add(t); + } + + waitForCompletion(thread_list); + countNodes(); + } + + public void testWithSharedData(Runner.OperationType optype) { + System.out.println("Testing " + optype.name() + " with " + thread_count +" thread and " + node_count + " nodes"); + + setup(); // All nodes are shared between threads + ArrayList thread_list = new ArrayList(); + Random r = new Random(System.nanoTime()); + for (int i = 0; i < thread_count; i++) { + Thread t = new Thread(new Runner(first_node, time, r.nextLong(), optype)); + t.start(); + thread_list.add(t); + } + + waitForCompletion(thread_list); + countNodes(); + } + + public void waitForCompletion(ArrayList thread_list) { + // do some waiting + try { + Thread.sleep(time*1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // wait for all thread to terminate + for (int i = 0; i < thread_count; i++) { + try { + thread_list.get(i).join(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + void countNodes() { + epoch++; + int count = 0; + Node node = first_node; + while (node.number() < epoch) { + node.setNumber(epoch); + count++; + node = node.next(); + } + System.out.println("Program end, found " + count + " nodes"); + } + + // Create a circular linked list + public void setup() { + first_node = new Node(); + Node last_node = first_node; + for (int i = 0; i < node_count; i++) { + last_node = new Node(last_node); + } + first_node.setNext(last_node); + } +} + +class Runner implements Runnable { + + OperationType type; + Node current; + Random r; + long time; + long seed; + + long milage = 0; + long created = 0; + long skipped = 0; + int iterations = 0; + + static final jdk.internal.misc.Unsafe UNSAFE; + static final long offset; + + public enum OperationType { + Load("Load"), + Swap("Swap"), + CAS("CAS"), + Weak_CAS("Weak-CAS"), + CMPX("CMPX"); + + private String name; + private OperationType(String name) { this.name = name; } + } + + static { + try { + Field f = jdk.internal.misc.Unsafe.class.getDeclaredField("theUnsafe"); + f.setAccessible(true); + UNSAFE = (jdk.internal.misc.Unsafe) f.get(null); + offset = UNSAFE.objectFieldOffset(Node.class.getDeclaredField("next")); + } catch (Exception e) { + throw new RuntimeException("Unable to get Unsafe instance.", e); + } + } + + public Runner(Node start, int testtime, long seed, OperationType type) { + current = start; + time = testtime*1000000000L; + r = new Random(seed); + this.type = type; + } + + @Override + public void run() { + long starttime = System.nanoTime(); + while((System.nanoTime() - starttime) < time) { + iterations++; + // Run a bit + int run_length = r.nextInt() & 0xfff; + for (int i = 0; i < run_length; i++) { + current = current.next(); + milage++; + } + // find a start node + Node startNode = current; + Node expectedNext = startNode.next; + + // Run a bit more + int skip_length = (r.nextInt() & 0xff) + 1; + for (int i = 0; i < skip_length; i++) { + current = current.next(); + skipped++; + } + + // create a branch + int branch_length = (r.nextInt() & 0xff) + 1; + created += branch_length; + Node head = makeBranch(current, branch_length); + + // complete circle, but continue to run on old path + boolean test_fail = ((iterations & 0x1) == 0); + Node current = merge(startNode, expectedNext, head, test_fail); + } + System.out.println("Milage: " + milage + " Skipped: " + skipped + " Created: " + created + " iterations: " + iterations); + } + + /* + * The reason for the duplicated code that is wrapping the unsafe operations is that we want + * to test the operations individually. They must not interfere with each other - checking a field + * will heal that reference and no operation after can trigger the barrier. + * + * All mergeImpl*-method are prevented from being inlined. + */ + + private Node merge(Node startNode, Node expectedNext, Node head, boolean test_fail) { + switch (type) { + case Load: + return mergeImplLoad(startNode, expectedNext, head); + case Swap: + return mergeImplSwap(startNode, expectedNext, head); + case CAS: + if (test_fail) { + return mergeImplCASFail(startNode, expectedNext, head); + } else { + return mergeImplCAS(startNode, expectedNext, head); + } + case Weak_CAS: + if (test_fail) { + return mergeImplWeakCASFail(startNode, expectedNext, head); + } else { + return mergeImplWeakCAS(startNode, expectedNext, head); + } + case CMPX: + if (test_fail) { + return mergeImplCMPXFail(startNode, expectedNext, head); + } else { + return mergeImplCMPX(startNode, expectedNext, head); + } + default: + throw new Error("Unimplemented"); + } + } + + private Node mergeImplLoad(Node startNode, Node expectedNext, Node head) { + // Atomic load version + Node temp = (Node) UNSAFE.getObject(startNode, offset); + startNode.setNext(head); + return temp; + } + + private Node mergeImplSwap(Node startNode, Node expectedNext, Node head) { + // Swap version + return (Node) UNSAFE.getAndSetObject(startNode, offset, head); + } + + private Node mergeImplCAS(Node startNode, Node expectedNext, Node head) { + // CAS - should always be true within a single thread - no other thread can have overwritten + if (!UNSAFE.compareAndSetObject(startNode, offset, expectedNext, head)) { + throw new Error("CAS should always succeed on thread local objects, check you barrier implementation"); + } + return expectedNext; // continue on old circle + } + + private Node mergeImplCASFail(Node startNode, Node expectedNext, Node head) { + // Force a fail + if (UNSAFE.compareAndSetObject(startNode, offset, "fail", head)) { + throw new Error("This CAS should always fail, check you barrier implementation"); + } + if (startNode.next() != expectedNext) { + throw new Error("Shouldn't have changed"); + } + return current; + } + + private Node mergeImplWeakCAS(Node startNode, Node expectedNext, Node head) { + // Weak CAS - should always be true within a single thread - no other thread can have overwritten + if (!UNSAFE.weakCompareAndSetObject(startNode, offset, expectedNext, head)) { + throw new Error("Weak CAS should always succeed on thread local objects, check you barrier implementation"); + } + return expectedNext; // continue on old circle + } + + private Node mergeImplWeakCASFail(Node startNode, Node expectedNext, Node head) { + // Force a fail + if (UNSAFE.weakCompareAndSetObject(startNode, offset, "fail", head)) { + throw new Error("This weak CAS should always fail, check you barrier implementation"); + } + if (startNode.next() != expectedNext) { + throw new Error("Shouldn't have changed"); + } + return current; + } + + private Node mergeImplCMPX(Node startNode, Node expectedNext, Node head) { + // CmpX - should always be true within a single thread - no other thread can have overwritten + Object res = UNSAFE.compareAndExchangeObject(startNode, offset, expectedNext, head); + if (!res.equals(expectedNext)) { + throw new Error("Fail CmpX should always succeed on thread local objects, check you barrier implementation"); + } + return expectedNext; // continue on old circle + } + + private Node mergeImplCMPXFail(Node startNode, Node expectedNext, Node head) { + Object res = UNSAFE.compareAndExchangeObject(startNode, offset, head, head); + if (startNode.next() != expectedNext) { + throw new Error("Shouldn't have changed"); + } + if (head == expectedNext) { + throw new Error("Test malfunction"); + } + if (!res.equals(expectedNext)) { + throw new Error("This CmpX should have returned 'expectedNext' when it failed"); + } + if (res.equals(head)) { + throw new Error("This CmpX shouldn't have returned head when it failed. count: "+ iterations); + } + + return current; + } + + // Create a new branch that will replace a part of the circle + public Node makeBranch(Node end_node, int count) { + Node head = end_node; + for (int i = 0; i < count; i++) { + head = new Node(head); + } + return head; + } +} + +class Node { + Node next; + int number = 0; + + public int number() { + return number; + } + + public void setNumber(int v) { + number = v; + } + + public Node() { + } + + public Node(Node link) { + next = link; + } + + public void setNext(Node next) { + this.next = next; + } + public Node next() { + return next; + } +} --- /dev/null 2018-04-03 12:55:20.301839954 +0200 +++ new/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithZ.java 2018-06-08 19:43:43.039902218 +0200 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016, 2018, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +import java.io.IOException; + +/* + * @test TestGCBasherWithZ + * @key gc stress + * @requires vm.gc.Z + * @requires vm.flavor == "server" & !vm.emulatedClient + * @summary Stress ZGC + * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx384m -server -XX:+UnlockExperimentalVMOptions -XX:+UseZGC TestGCBasherWithZ 120000 + */ +public class TestGCBasherWithZ { + public static void main(String[] args) throws IOException { + TestGCBasher.main(args); + } +} --- /dev/null 2018-04-03 12:55:20.301839954 +0200 +++ new/test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithZ.java 2018-06-08 19:43:43.440919617 +0200 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2017, 2018, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * @test TestGCOldWithZ + * @key gc + * @requires vm.gc.Z + * @summary Stress the Z + * @run main/othervm -Xmx384M -XX:+UnlockExperimentalVMOptions -XX:+UseZGC TestGCOldWithZ 50 1 20 10 10000 + * @run main/othervm -Xmx256m -XX:+UnlockExperimentalVMOptions -XX:+UseZGC TestGCOldWithZ 50 5 20 1 5000 + */ +public class TestGCOldWithZ { + public static void main(String[] args) { + TestGCOld.main(args); + } +} --- /dev/null 2018-04-03 12:55:20.301839954 +0200 +++ new/test/jdk/java/lang/management/MemoryMXBean/MemoryTestZGC.sh 2018-06-08 19:43:43.843937103 +0200 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2003, 2015, 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# @test +# @requires vm.gc.Z +# @run compile MemoryTest.java +# @run shell MemoryTestZGC.sh +# + +#Set appropriate jdk + +if [ ! -z "${TESTJAVA}" ] ; then + jdk="$TESTJAVA" +else + echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." + exit 1 +fi + +runOne() +{ + echo "runOne $@" + $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2 +} + +# 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 + +exit 0