changeset 50876:e95f45dc3927

ZGC: Testing
author duke
date Fri, 08 Jun 2018 18:24:45 +0200
parents 3d4b26a487d7
children 2dff159158c5
files test/hotspot/jtreg/TEST.ROOT test/hotspot/jtreg/compiler/gcbarriers/UnsafeIntrinsicsTest.java test/hotspot/jtreg/gc/TestAllocateHeapAt.java test/hotspot/jtreg/gc/TestAllocateHeapAtError.java test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java test/hotspot/jtreg/gc/TestVerifyDuringStartup.java test/hotspot/jtreg/gc/TestVerifySilently.java test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithZ.java test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithZ.java test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java test/hotspot/jtreg/gc/whitebox/TestWBGC.java test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java test/hotspot/jtreg/serviceability/dcmd/gc/RunGCTest.java test/hotspot/jtreg/serviceability/sa/TestUniverse.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/CompressedClassSpaceSize/TestDescription.java test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/ShrinkGrowTest/ShrinkGrowTest.java test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java test/jdk/TEST.ROOT test/jdk/com/sun/jdi/OomDebugTest.java test/jdk/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java test/jdk/java/lang/management/ManagementFactory/MXBeanException.java test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java test/jdk/java/lang/management/MemoryMXBean/MemoryTestZGC.sh test/lib/sun/hotspot/gc/GC.java
diffstat 49 files changed, 593 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/TEST.ROOT	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/TEST.ROOT	Fri Jun 08 18:24:45 2018 +0200
@@ -45,6 +45,7 @@
     vm.gc.Serial \
     vm.gc.Parallel \
     vm.gc.ConcMarkSweep \
+    vm.gc.Z \
     vm.jvmci \
     vm.emulatedClient \
     vm.cpu.features \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/gcbarriers/UnsafeIntrinsicsTest.java	Fri Jun 08 18:24:45 2018 +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> thread_list = new ArrayList<Thread>();
+        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> thread_list = new ArrayList<Thread>();
+        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> 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;
+    }
+}
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAt.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAt.java	Fri Jun 08 18:24:45 2018 +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
  */
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java	Fri Jun 08 18:24:45 2018 +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);
   }
 }
-
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java	Fri Jun 08 18:24:45 2018 +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;
--- a/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java	Fri Jun 08 18:24:45 2018 +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
  */
--- a/test/hotspot/jtreg/gc/TestVerifySilently.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/TestVerifySilently.java	Fri Jun 08 18:24:45 2018 +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
  */
--- a/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java	Fri Jun 08 18:24:45 2018 +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");
--- a/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java	Fri Jun 08 18:24:45 2018 +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
  *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithZ.java	Fri Jun 08 18:24:45 2018 +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	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithZ.java	Fri Jun 08 18:24:45 2018 +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);
+    }
+}
--- a/test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/gc/whitebox/TestWBGC.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/gc/whitebox/TestWBGC.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/serviceability/dcmd/gc/RunGCTest.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/dcmd/gc/RunGCTest.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/serviceability/sa/TestUniverse.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/TestUniverse.java	Fri Jun 08 18:24:45 2018 +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<String> vmArgs = new ArrayList<String>();
+            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);
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java	Fri Jun 08 18:24:45 2018 +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.*;
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java	Fri Jun 08 18:24:45 2018 +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.*;
--- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/CompressedClassSpaceSize/TestDescription.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/CompressedClassSpaceSize/TestDescription.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/ShrinkGrowTest/ShrinkGrowTest.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/shrink_grow/ShrinkGrowTest/ShrinkGrowTest.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java	Fri Jun 08 18:24:45 2018 +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);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java	Fri Jun 08 18:24:45 2018 +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);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java	Fri Jun 08 18:24:45 2018 +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);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java	Fri Jun 08 18:24:45 2018 +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[];
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java	Fri Jun 08 18:24:45 2018 +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";
--- a/test/jdk/TEST.ROOT	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/jdk/TEST.ROOT	Fri Jun 08 18:24:45 2018 +0200
@@ -37,6 +37,7 @@
 requires.properties= \
     sun.arch.data.model \
     java.runtime.name \
+    vm.gc.Z \
     vm.graal.enabled \
     vm.cds
 
--- a/test/jdk/com/sun/jdi/OomDebugTest.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/jdk/com/sun/jdi/OomDebugTest.java	Fri Jun 08 18:24:45 2018 +0200
@@ -29,6 +29,7 @@
  *
  *  @author Severin Gehwolf <sgehwolf@redhat.com>
  *
+ *  @requires vm.gc != "Z"
  *  @library ..
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g OomDebugTest.java
--- a/test/jdk/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/jdk/com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java	Fri Jun 08 18:24:45 2018 +0200
@@ -25,6 +25,7 @@
  * @test
  * @bug     4858522 6191542
  * @summary Basic unit test of OperatingSystemMXBean.getCommittedVirtualMemorySize()
+ * @requires vm.gc != "Z"
  * @author  Steve Bohne
  */
 
--- a/test/jdk/java/lang/management/ManagementFactory/MXBeanException.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/jdk/java/lang/management/ManagementFactory/MXBeanException.java	Fri Jun 08 18:24:45 2018 +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
--- a/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java	Fri Jun 08 18:24:45 2018 +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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/management/MemoryMXBean/MemoryTestZGC.sh	Fri Jun 08 18:24:45 2018 +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
--- a/test/lib/sun/hotspot/gc/GC.java	Fri Jun 08 18:24:45 2018 +0200
+++ b/test/lib/sun/hotspot/gc/GC.java	Fri Jun 08 18:24:45 2018 +0200
@@ -36,7 +36,8 @@
     Serial(1),
     Parallel(2),
     ConcMarkSweep(3),
-    G1(4);
+    G1(4),
+    Z(5);
 
     private static final WhiteBox WB = WhiteBox.getWhiteBox();