--- old/test/hotspot/jtreg/TEST.ROOT 2018-11-30 10:21:29.865257559 +0100 +++ new/test/hotspot/jtreg/TEST.ROOT 2018-11-30 10:21:29.715259299 +0100 @@ -46,6 +46,7 @@ vm.gc.Serial \ vm.gc.Parallel \ vm.gc.ConcMarkSweep \ + vm.gc.Shenandoah \ vm.gc.Epsilon \ vm.gc.Z \ vm.jvmci \ --- old/test/hotspot/jtreg/TEST.groups 2018-11-30 10:21:30.082255041 +0100 +++ new/test/hotspot/jtreg/TEST.groups 2018-11-30 10:21:29.926256851 +0100 @@ -168,26 +168,33 @@ :tier1_gc_1 \ :tier1_gc_2 \ :tier1_gc_gcold \ - :tier1_gc_gcbasher + :tier1_gc_gcbasher \ + :tier1_gc_shenandoah hotspot_not_fast_gc = \ :hotspot_gc \ -:tier1_gc tier1_gc_1 = \ - gc/epsilon/ \ + :gc_epsilon \ gc/g1/ \ -gc/g1/ihop/TestIHOPErgo.java tier1_gc_2 = \ gc/ \ - -gc/epsilon/ \ + -:gc_epsilon \ -gc/g1/ \ -gc/logging/TestUnifiedLoggingSwitchStress.java \ -gc/stress \ -gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java \ -gc/cms/TestMBeanCMS.java \ - -gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java + -gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \ + -gc/shenandoah + +gc_epsilon = \ + gc/epsilon/ \ + gc/CriticalNativeArgs.java \ + gc/stress/CriticalNativeStress.java tier1_gc_gcold = \ gc/stress/gcold/TestGCOldWithG1.java \ @@ -200,6 +207,52 @@ gc/stress/gcbasher/TestGCBasherWithCMS.java \ gc/stress/gcbasher/TestGCBasherWithSerial.java \ gc/stress/gcbasher/TestGCBasherWithParallel.java + +tier1_gc_shenandoah = \ + gc/shenandoah/options/ \ + gc/shenandoah/compiler/ \ + gc/shenandoah/mxbeans/ \ + gc/shenandoah/TestSmallHeap.java \ + gc/shenandoah/oom/ \ + gc/CriticalNativeArgs.java + +tier2_gc_shenandoah = \ + runtime/MemberName/MemberNameLeak.java \ + runtime/CompressedOops/UseCompressedOops.java \ + gc/TestHumongousReferenceObject.java \ + gc/TestSystemGC.java \ + gc/arguments/TestDisableDefaultGC.java \ + gc/arguments/TestUseCompressedOopsErgo.java \ + gc/arguments/TestAlignmentToUseLargePages.java \ + gc/class_unloading/TestClassUnloadingDisabled.java \ + gc/ergonomics/TestInitialGCThreadLogging.java \ + gc/ergonomics/TestDynamicNumberOfGCThreads.java \ + gc/logging/TestGCId.java \ + gc/metaspace/TestMetaspacePerfCounters.java \ + gc/metaspace/TestMetaspacePerfCounters.java \ + gc/startup_warnings/TestShenandoah.java \ + gc/TestFullGCALot.java \ + gc/logging/TestUnifiedLoggingSwitchStress.java \ + runtime/Metaspace/DefineClass.java \ + gc/shenandoah/ \ + serviceability/sa/TestHeapDumpForInvokeDynamic.java \ + -gc/shenandoah/TestStringDedupStress.java \ + -gc/stress/CriticalNativeStress.java \ + -:tier1_gc_shenandoah + +tier3_gc_shenandoah = \ + gc/stress/gcold/TestGCOldWithShenandoah.java \ + gc/stress/gcbasher/TestGCBasherWithShenandoah.java \ + gc/stress/gclocker/TestGCLockerWithShenandoah.java \ + gc/stress/systemgc/TestSystemGCWithShenandoah.java \ + gc/shenandoah/TestStringDedupStress.java \ + gc/stress/CriticalNativeStress.java \ + -:tier2_gc_shenandoah + +hotspot_gc_shenandoah = \ + :tier1_gc_shenandoah \ + :tier2_gc_shenandoah \ + :tier3_gc_shenandoah tier1_runtime = \ runtime/ \ --- old/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java 2018-11-30 10:21:30.300252511 +0100 +++ new/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java 2018-11-30 10:21:30.152254229 +0100 @@ -39,7 +39,9 @@ * CMS, * CMSCondMark, * Serial, - * Parallel} + * Parallel, + * Shenandoah, + * ShenandoahTraversal} */ @@ -100,6 +102,19 @@ procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC"; procArgs[argcount - 2] = "-XX:+UseCondCardMark"; break; + case "Shenandoah": + argcount = 10; + procArgs = new String[argcount]; + procArgs[argcount - 3] = "-XX:+UnlockExperimentalVMOptions"; + procArgs[argcount - 2] = "-XX:+UseShenandoahGC"; + break; + case "ShenandoahTraversal": + argcount = 11; + procArgs = new String[argcount]; + procArgs[argcount - 4] = "-XX:+UnlockExperimentalVMOptions"; + procArgs[argcount - 3] = "-XX:+UseShenandoahGC"; + procArgs[argcount - 2] = "-XX:ShenandoahGCHeuristics=traversal"; + break; default: throw new RuntimeException("unexpected test type " + testType); } @@ -355,6 +370,17 @@ "ret" }; break; + case "Shenandoah": + case "ShenandoahTraversal": + // Shenandoah generates normal object graphs for + // volatile stores + matches = new String[] { + "membar_release \\(elided\\)", + useCompressedOops ? "stlrw?" : "stlr", + "membar_volatile \\(elided\\)", + "ret" + }; + break; } } else { switch (testType) { @@ -418,6 +444,20 @@ "ret" }; break; + + case "Shenandoah": + case "ShenandoahTraversal": + // Shenandoah generates normal object graphs for + // volatile stores + matches = new String[] { + "membar_release", + "dmb ish", + useCompressedOops ? "strw?" : "str", + "membar_volatile", + "dmb ish", + "ret" + }; + break; } } @@ -520,6 +560,17 @@ "ret" }; break; + case "Shenandoah": + case "ShenandoahTraversal": + // For volatile CAS, Shenanodoah generates normal + // graphs with a shenandoah-specific cmpxchg + matches = new String[] { + "membar_release \\(elided\\)", + useCompressedOops ? "cmpxchgw?_acq_shenandoah" : "cmpxchg_acq_shenandoah", + "membar_acquire \\(elided\\)", + "ret" + }; + break; } } else { switch (testType) { @@ -583,6 +634,19 @@ "ret" }; break; + case "Shenandoah": + case "ShenandoahTraversal": + // For volatile CAS, Shenanodoah generates normal + // graphs with a shenandoah-specific cmpxchg + matches = new String[] { + "membar_release", + "dmb ish", + useCompressedOops ? "cmpxchgw?_shenandoah" : "cmpxchg_shenandoah", + "membar_acquire", + "dmb ish", + "ret" + }; + break; } } @@ -701,6 +765,17 @@ "ret" }; break; + case "Shenandoah": + case "ShenandoahTraversal": + // For volatile CAS, Shenanodoah generates normal + // graphs with a shenandoah-specific cmpxchg + matches = new String[] { + "membar_release \\(elided\\)", + useCompressedOops ? "cmpxchgw?_acq_shenandoah" : "cmpxchg_acq_shenandoah", + "membar_acquire \\(elided\\)", + "ret" + }; + break; } } else { switch (testType) { @@ -764,6 +839,19 @@ "ret" }; break; + case "Shenandoah": + case "ShenandoahTraversal": + // For volatile CAS, Shenanodoah generates normal + // graphs with a shenandoah-specific cmpxchg + matches = new String[] { + "membar_release", + "dmb ish", + useCompressedOops ? "cmpxchgw?_shenandoah" : "cmpxchg_shenandoah", + "membar_acquire", + "dmb ish", + "ret" + }; + break; } } @@ -862,6 +950,15 @@ "ret" }; break; + case "Shenandoah": + case "ShenandoahTraversal": + matches = new String[] { + "membar_release \\(elided\\)", + useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq", + "membar_acquire \\(elided\\)", + "ret" + }; + break; } } else { switch (testType) { @@ -923,6 +1020,17 @@ "membar_acquire", "dmb ish", "ret" + }; + break; + case "Shenandoah": + case "ShenandoahTraversal": + matches = new String[] { + "membar_release", + "dmb ish", + useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ", + "membar_acquire", + "dmb ish", + "ret" }; break; } --- /dev/null 2018-11-30 10:10:44.238550338 +0100 +++ new/test/hotspot/jtreg/gc/CriticalNativeArgs.java 2018-11-30 10:21:30.378251606 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. + * + * 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 CriticalNativeStressEpsilon + * @key gc + * @bug 8199868 + * @requires (os.arch =="x86_64" | os.arch == "amd64") & vm.gc.Epsilon & !vm.graal.enabled + * @summary test argument unpacking nmethod wrapper of critical native method + * @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xcomp -Xmx256M -XX:+CriticalJNINatives CriticalNativeArgs + */ + +/* + * @test CriticalNativeStressShenandoah + * @key gc + * @bug 8199868 + * @requires (os.arch =="x86_64" | os.arch == "amd64") & vm.gc.Shenandoah & !vm.graal.enabled + * @summary test argument unpacking nmethod wrapper of critical native method + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:+ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeArgs + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:-ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeArgs + * + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeArgs + * + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xcomp -Xmx256M -XX:+CriticalJNINatives CriticalNativeArgs + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCHeuristics=traversal -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeArgs + */ +public class CriticalNativeArgs { + static { + System.loadLibrary("CriticalNative"); + } + + static native boolean isNull(int[] a); + + public static void main(String[] args) { + int[] arr = new int[2]; + + if (isNull(arr)) { + throw new RuntimeException("Should not be null"); + } + + if (!isNull(null)) { + throw new RuntimeException("Should be null"); + } + } +} --- old/test/hotspot/jtreg/gc/TestFullGCCount.java 2018-11-30 10:21:30.769247070 +0100 +++ new/test/hotspot/jtreg/gc/TestFullGCCount.java 2018-11-30 10:21:30.619248810 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -26,6 +26,7 @@ * @bug 7072527 * @summary CMS: JMM GC counters overcount in some cases * @requires !(vm.gc.ConcMarkSweep & vm.opt.ExplicitGCInvokesConcurrent == true) + * @requires !(vm.gc.Shenandoah & vm.opt.ExplicitGCInvokesConcurrent == true) * @modules java.management * @run main/othervm -Xlog:gc TestFullGCCount */ --- old/test/hotspot/jtreg/gc/TestHumongousReferenceObject.java 2018-11-30 10:21:30.990244506 +0100 +++ new/test/hotspot/jtreg/gc/TestHumongousReferenceObject.java 2018-11-30 10:21:30.833246327 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -35,6 +35,16 @@ * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:ContendedPaddingWidth=8192 TestHumongousReferenceObject * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=8M -XX:ContendedPaddingWidth=8192 TestHumongousReferenceObject */ + +/* + * @test TestHumongousReferenceObjectShenandoah + * @summary Test that verifies that iteration over large, plain Java objects, that potentially cross region boundaries, with references in them works. + * @requires vm.gc.Shenandoah + * @bug 8151499 8153734 + * @modules java.base/jdk.internal.vm.annotation + * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahHeapRegionSize=8M -XX:ContendedPaddingWidth=8192 TestHumongousReferenceObject + * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahHeapRegionSize=8M -XX:ContendedPaddingWidth=8192 -XX:+UnlockDiagnosticVMOptions -XX:+ShenandoahVerify TestHumongousReferenceObject + */ public class TestHumongousReferenceObject { /* --- old/test/hotspot/jtreg/gc/TestSystemGC.java 2018-11-30 10:21:31.207241988 +0100 +++ new/test/hotspot/jtreg/gc/TestSystemGC.java 2018-11-30 10:21:31.057243728 +0100 @@ -45,6 +45,14 @@ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC */ +/* + * @test TestSystemGCShenandoah + * @key gc + * @requires vm.gc.Shenandoah & !vm.graal.enabled + * @summary Runs System.gc() with different flags. + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC TestSystemGC + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC + */ public class TestSystemGC { public static void main(String args[]) throws Exception { System.gc(); --- old/test/hotspot/jtreg/gc/arguments/TestAlignmentToUseLargePages.java 2018-11-30 10:21:31.429239412 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestAlignmentToUseLargePages.java 2018-11-30 10:21:31.274241210 +0100 @@ -48,6 +48,16 @@ * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages */ +/** + * @test TestAlignmentToUseLargePagesShenandoah + * @key gc + * @bug 8024396 + * @comment Graal does not support Shenandoah + * @requires vm.gc.Shenandoah & !vm.graal.enabled + * @run main/othervm -Xms71M -Xmx91M -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UseLargePages TestAlignmentToUseLargePages + * @run main/othervm -Xms71M -Xmx91M -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:-UseLargePages TestAlignmentToUseLargePages + */ + public class TestAlignmentToUseLargePages { public static void main(String args[]) throws Exception { // nothing to do --- old/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java 2018-11-30 10:21:31.644236917 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java 2018-11-30 10:21:31.491238692 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -44,6 +44,7 @@ "-XX:-UseG1GC", "-XX:-UseConcMarkSweepGC", "-XX:+UnlockExperimentalVMOptions", + "-XX:-UseShenandoahGC", "-XX:-UseZGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); --- old/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java 2018-11-30 10:21:31.861234400 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java 2018-11-30 10:21:31.706236198 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -25,7 +25,7 @@ * @test TestMaxMinHeapFreeRatioFlags * @key gc * @summary Verify that heap size changes according to max and min heap free ratios. - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java 2018-11-30 10:21:32.079231870 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java 2018-11-30 10:21:31.927233634 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,7 +26,7 @@ * @key gc * @bug 8025166 * @summary Verify that heap devided among generations according to NewRatio - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java 2018-11-30 10:21:32.292229399 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java 2018-11-30 10:21:32.143231128 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java 2018-11-30 10:21:32.504226939 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java 2018-11-30 10:21:32.356228656 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -25,7 +25,7 @@ * @test TestShrinkHeapInSteps * @key gc * @summary Verify that -XX:-ShrinkHeapInSteps works properly. - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java 2018-11-30 10:21:32.723224398 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java 2018-11-30 10:21:32.568226196 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -25,7 +25,7 @@ * @test TestSurvivorRatioFlag * @key gc * @summary Verify that actual survivor ratio is equal to specified SurvivorRatio value - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java 2018-11-30 10:21:32.946221811 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java 2018-11-30 10:21:32.787223655 +0100 @@ -27,7 +27,7 @@ * @summary Verify that option TargetSurvivorRatio affects survivor space occupancy after minor GC. * @requires vm.opt.ExplicitGCInvokesConcurrent != true * @requires vm.opt.UseJVMCICompiler != true - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgo.java 2018-11-30 10:21:33.174219165 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgo.java 2018-11-30 10:21:33.009221080 +0100 @@ -54,6 +54,21 @@ * @run main/othervm TestUseCompressedOopsErgo -XX:+UseConcMarkSweepGC */ +/* + * @test TestUseCompressedOopsErgoShenandoah + * @key gc + * @bug 8010722 + * @comment Graal does not support Shenandoah + * @requires vm.gc.Shenandoah & !vm.graal.enabled + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management/sun.management + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm TestUseCompressedOopsErgo -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC + */ + public class TestUseCompressedOopsErgo { public static void main(String args[]) throws Exception { --- old/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java 2018-11-30 10:21:33.391216647 +0100 +++ new/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java 2018-11-30 10:21:33.240218399 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -28,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @modules java.base/jdk.internal.misc * @modules java.management * @library /test/lib --- old/test/hotspot/jtreg/gc/class_unloading/TestClassUnloadingDisabled.java 2018-11-30 10:21:33.604214176 +0100 +++ new/test/hotspot/jtreg/gc/class_unloading/TestClassUnloadingDisabled.java 2018-11-30 10:21:33.455215905 +0100 @@ -64,6 +64,24 @@ * -XX:-ClassUnloading -XX:+UseConcMarkSweepGC TestClassUnloadingDisabled */ +/* + * @test TestClassUnloadingDisabledShenandoah + * @key gc + * @bug 8114823 + * @comment Graal does not support Shenandoah + * @requires vm.gc.Shenandoah & !vm.graal.enabled + * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @requires vm.opt.ClassUnloading != true + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:-ClassUnloading -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC TestClassUnloadingDisabled + */ + import java.io.File; import java.io.IOException; import java.nio.file.Files; --- old/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java 2018-11-30 10:21:33.823211635 +0100 +++ new/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java 2018-11-30 10:21:33.668213434 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -29,10 +29,14 @@ * @key gc * @modules java.base/jdk.internal.misc * @library /test/lib + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestDynamicNumberOfGCThreads */ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; +import sun.hotspot.gc.GC; public class TestDynamicNumberOfGCThreads { public static void main(String[] args) throws Exception { @@ -42,6 +46,10 @@ testDynamicNumberOfGCThreads("UseG1GC"); testDynamicNumberOfGCThreads("UseParallelGC"); + + if (GC.Shenandoah.isSupported()) { + testDynamicNumberOfGCThreads("UseShenandoahGC"); + } } private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output) { @@ -51,7 +59,7 @@ private static void testDynamicNumberOfGCThreads(String gcFlag) throws Exception { // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled - String[] baseArgs = {"-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", GCTest.class.getName()}; + String[] baseArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", GCTest.class.getName()}; // Base test with gc and +UseDynamicNumberOfGCThreads: ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs); --- old/test/hotspot/jtreg/gc/ergonomics/TestInitialGCThreadLogging.java 2018-11-30 10:21:34.041209106 +0100 +++ new/test/hotspot/jtreg/gc/ergonomics/TestInitialGCThreadLogging.java 2018-11-30 10:21:33.890210858 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -29,10 +29,14 @@ * @key gc * @modules java.base/jdk.internal.misc * @library /test/lib + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestInitialGCThreadLogging */ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; +import sun.hotspot.gc.GC; public class TestInitialGCThreadLogging { public static void main(String[] args) throws Exception { @@ -42,6 +46,10 @@ testInitialGCThreadLogging("UseG1GC", "GC Thread"); testInitialGCThreadLogging("UseParallelGC", "ParGC Thread"); + + if (GC.Shenandoah.isSupported()) { + testInitialGCThreadLogging("UseShenandoahGC", "Shenandoah GC Thread"); + } } private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output, String threadName) { @@ -51,7 +59,7 @@ private static void testInitialGCThreadLogging(String gcFlag, String threadName) throws Exception { // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled - String[] baseArgs = {"-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", "-version"}; + String[] baseArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", "-version"}; // Base test with gc and +UseDynamicNumberOfGCThreads: ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs); --- /dev/null 2018-11-30 10:10:44.238550338 +0100 +++ new/test/hotspot/jtreg/gc/libCriticalNative.c 2018-11-30 10:21:34.104208375 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. + * + * 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. + * + */ + +#include "jni.h" + +JNIEXPORT jlong JNICALL JavaCritical_CriticalNativeStress_sum1 + (jint length, jlong* a) { + jlong sum = 0; + jint index; + for (index = 0; index < length; index ++) { + sum += a[index]; + } + + return sum; +} + +JNIEXPORT jlong JNICALL JavaCritical_CriticalNativeStress_sum2 + (jlong a1, jint a2_length, jint* a2, jint a4_length, jint* a4, jint a6_length, jlong* a6, jint a8_length, jint* a8) { + jlong sum = a1; + jint index; + for (index = 0; index < a2_length; index ++) { + sum += a2[index]; + } + + for (index = 0; index < a4_length; index ++) { + sum += a4[index]; + } + + for (index = 0; index < a6_length; index ++) { + sum += a6[index]; + } + + for (index = 0; index < a8_length; index ++) { + sum += a8[index]; + } + return sum; +} + +JNIEXPORT jlong JNICALL Java_CriticalNativeStress_sum1 + (JNIEnv *env, jclass jclazz, jlongArray a) { + jlong sum = 0; + jsize len = (*env)->GetArrayLength(env, a); + jsize index; + jlong* arr = (jlong*)(*env)->GetPrimitiveArrayCritical(env, a, 0); + for (index = 0; index < len; index ++) { + sum += arr[index]; + } + + (*env)->ReleasePrimitiveArrayCritical(env, a, arr, 0); + return sum; +} + +JNIEXPORT jlong JNICALL Java_CriticalNativeStress_sum2 + (JNIEnv *env, jclass jclazz, jlong a1, jintArray a2, jintArray a3, jlongArray a4, jintArray a5) { + jlong sum = a1; + jsize index; + jsize len; + jint* a2_arr; + jint* a3_arr; + jlong* a4_arr; + jint* a5_arr; + + len = (*env)->GetArrayLength(env, a2); + a2_arr = (jint*)(*env)->GetPrimitiveArrayCritical(env, a2, 0); + for (index = 0; index < len; index ++) { + sum += a2_arr[index]; + } + (*env)->ReleasePrimitiveArrayCritical(env, a2, a2_arr, 0); + + len = (*env)->GetArrayLength(env, a3); + a3_arr = (jint*)(*env)->GetPrimitiveArrayCritical(env, a3, 0); + for (index = 0; index < len; index ++) { + sum += a3_arr[index]; + } + (*env)->ReleasePrimitiveArrayCritical(env, a3, a3_arr, 0); + + len = (*env)->GetArrayLength(env, a4); + a4_arr = (jlong*)(*env)->GetPrimitiveArrayCritical(env, a4, 0); + for (index = 0; index < len; index ++) { + sum += a4_arr[index]; + } + (*env)->ReleasePrimitiveArrayCritical(env, a4, a4_arr, 0); + + len = (*env)->GetArrayLength(env, a5); + a5_arr = (jint*)(*env)->GetPrimitiveArrayCritical(env, a5, 0); + for (index = 0; index < len; index ++) { + sum += a5_arr[index]; + } + (*env)->ReleasePrimitiveArrayCritical(env, a5, a5_arr, 0); + + return sum; +} + + +JNIEXPORT jboolean JNICALL JavaCritical_CriticalNativeArgs_isNull + (jint length, jint* a) { + return (a == NULL) && (length == 0); +} + +JNIEXPORT jboolean JNICALL Java_CriticalNativeArgs_isNull + (JNIEnv *env, jclass jclazz, jintArray a) { + jboolean is_null; + jsize len = (*env)->GetArrayLength(env, a); + jint* arr = (jint*)(*env)->GetPrimitiveArrayCritical(env, a, 0); + is_null = (arr == NULL) && (len == 0); + (*env)->ReleasePrimitiveArrayCritical(env, a, arr, 0); + return is_null; +} + --- old/test/hotspot/jtreg/gc/logging/TestGCId.java 2018-11-30 10:21:34.496203827 +0100 +++ new/test/hotspot/jtreg/gc/logging/TestGCId.java 2018-11-30 10:21:34.345205579 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -30,10 +30,14 @@ * @library /test/lib * @modules java.base/jdk.internal.misc * java.management + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestGCId */ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; +import sun.hotspot.gc.GC; public class TestGCId { public static void main(String[] args) throws Exception { @@ -41,6 +45,9 @@ testGCId("UseG1GC"); testGCId("UseConcMarkSweepGC"); testGCId("UseSerialGC"); + if (GC.Shenandoah.isSupported()) { + testGCId("UseShenandoahGC"); + } } private static void verifyContainsGCIDs(OutputAnalyzer output) { @@ -51,7 +58,7 @@ private static void testGCId(String gcFlag) throws Exception { ProcessBuilder pb_default = - ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-Xlog:gc", "-Xmx10M", GCTest.class.getName()); + ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xlog:gc", "-Xmx10M", GCTest.class.getName()); verifyContainsGCIDs(new OutputAnalyzer(pb_default.start())); } --- old/test/hotspot/jtreg/gc/metaspace/TestMetaspacePerfCounters.java 2018-11-30 10:21:34.716201274 +0100 +++ new/test/hotspot/jtreg/gc/metaspace/TestMetaspacePerfCounters.java 2018-11-30 10:21:34.561203073 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -53,6 +53,20 @@ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UsePerfData -XX:+UseG1GC TestMetaspacePerfCounters */ + +/* @test TestMetaspacePerfCountersShenandoah + * @bug 8014659 + * @requires vm.gc.Shenandoah + * @library /test/lib / + * @summary Tests that performance counters for metaspace and compressed class + * space exists and works. + * @modules java.base/jdk.internal.misc + * java.compiler + * java.management/sun.management + * jdk.internal.jvmstat/sun.jvmstat.monitor + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC TestMetaspacePerfCounters + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UsePerfData -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC TestMetaspacePerfCounters + */ public class TestMetaspacePerfCounters { public static Class fooClass = null; private static final String[] counterNames = {"minCapacity", "maxCapacity", "capacity", "used"}; --- /dev/null 2018-11-30 10:10:44.238550338 +0100 +++ new/test/hotspot/jtreg/gc/stress/CriticalNativeStress.java 2018-11-30 10:21:34.785200474 +0100 @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. + * + * 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.util.Random; + +/* + * @test CriticalNativeStressEpsilon + * @key gc + * @bug 8199868 + * @requires (os.arch =="x86_64" | os.arch == "amd64") & vm.gc.Epsilon & !vm.graal.enabled + * @summary test argument pinning by nmethod wrapper of critical native method + * @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xcomp -Xmx1G -XX:+CriticalJNINatives CriticalNativeStress + */ + +/* + * @test CriticalNativeStressShenandoah + * @key gc + * @bug 8199868 + * @requires (os.arch =="x86_64" | os.arch == "amd64") & vm.gc.Shenandoah & !vm.graal.enabled + * @summary test argument pinning by nmethod wrapper of critical native method + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:-ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeStress + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:+ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeStress + * + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeStress + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xcomp -Xmx256M -XX:+CriticalJNINatives CriticalNativeStress + * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=traversal -Xcomp -Xmx512M -XX:+CriticalJNINatives CriticalNativeStress + */ +public class CriticalNativeStress { + private static Random rand = new Random(); + static { + System.loadLibrary("CriticalNative"); + } + + // CYCLES and THREAD_PER_CASE are used to tune the tests for different GC settings, + // so that they can execrise enough GC cycles and not OOM + private static int CYCLES = Integer.getInteger("cycles", 3); + private static int THREAD_PER_CASE = Integer.getInteger("threadPerCase", 1); + + static native long sum1(long[] a); + + // More than 6 parameters + static native long sum2(long a1, int[] a2, int[] a3, long[] a4, int[] a5); + + static long sum(long[] a) { + long sum = 0; + for (int index = 0; index < a.length; index ++) { + sum += a[index]; + } + return sum; + } + + static long sum(int[] a) { + long sum = 0; + for (int index = 0; index < a.length; index ++) { + sum += a[index]; + } + return sum; + } + + private static volatile String garbage_array[]; + + // GC potentially moves arrays passed to critical native methods + // if they are not pinned correctly. + // Create enough garbages to exercise GC cycles, verify + // the arrays are pinned correctly. + static void create_garbage(int len) { + len = Math.max(len, 1024); + String array[] = new String[len]; + for (int index = 0; index < len; index ++) { + array[index] = "String " + index; + } + garbage_array = array; + } + + // Two test cases with different method signatures: + // Tests generate arbitrary length of arrays with + // arbitrary values, then calcuate sum of the array + // elements with critical native JNI methods and java + // methods, and compare the results for correctness. + static void run_test_case1() { + // Create testing arary with arbitrary length and + // values + int length = rand.nextInt(50) + 1; + long[] arr = new long[length]; + for (int index = 0; index < length; index ++) { + arr[index] = rand.nextLong() % 1002; + } + + // Generate garbages to trigger GCs + for (int index = 0; index < length; index ++) { + create_garbage(index); + } + + // Compare results for correctness. + long native_sum = sum1(arr); + long java_sum = sum(arr); + if (native_sum != java_sum) { + StringBuffer sb = new StringBuffer("Sums do not match: native = ") + .append(native_sum).append(" java = ").append(java_sum); + + throw new RuntimeException(sb.toString()); + } + } + + static void run_test_case2() { + // Create testing arary with arbitrary length and + // values + int index; + long a1 = rand.nextLong() % 1025; + + int a2_length = rand.nextInt(50) + 1; + int[] a2 = new int[a2_length]; + for (index = 0; index < a2_length; index ++) { + a2[index] = rand.nextInt(106); + } + + int a3_length = rand.nextInt(150) + 1; + int[] a3 = new int[a3_length]; + for (index = 0; index < a3_length; index ++) { + a3[index] = rand.nextInt(3333); + } + + int a4_length = rand.nextInt(200) + 1; + long[] a4 = new long[a4_length]; + for (index = 0; index < a4_length; index ++) { + a4[index] = rand.nextLong() % 122; + } + + int a5_length = rand.nextInt(350) + 1; + int[] a5 = new int[a5_length]; + for (index = 0; index < a5_length; index ++) { + a5[index] = rand.nextInt(333); + } + + // Generate garbages to trigger GCs + for (index = 0; index < a1; index ++) { + create_garbage(index); + } + + // Compare results for correctness. + long native_sum = sum2(a1, a2, a3, a4, a5); + long java_sum = a1 + sum(a2) + sum(a3) + sum(a4) + sum(a5); + if (native_sum != java_sum) { + StringBuffer sb = new StringBuffer("Sums do not match: native = ") + .append(native_sum).append(" java = ").append(java_sum); + + throw new RuntimeException(sb.toString()); + } + } + + static class Case1Runner extends Thread { + public Case1Runner() { + start(); + } + + public void run() { + for (int index = 0; index < CYCLES; index ++) { + run_test_case1(); + } + } + } + + static class Case2Runner extends Thread { + public Case2Runner() { + start(); + } + + public void run() { + for (int index = 0; index < CYCLES; index ++) { + run_test_case2(); + } + } + } + + public static void main(String[] args) { + Thread[] thrs = new Thread[THREAD_PER_CASE * 2]; + for (int index = 0; index < thrs.length; index = index + 2) { + thrs[index] = new Case1Runner(); + thrs[index + 1] = new Case2Runner(); + } + + for (int index = 0; index < thrs.length; index ++) { + try { + thrs[index].join(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} --- old/test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java 2018-11-30 10:21:35.182195867 +0100 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java 2018-11-30 10:21:35.027197666 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -26,7 +26,7 @@ * @bug 8031323 * @summary Verify that object's alignment in eden space is not affected by * SurvivorAlignmentInBytes option. - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java 2018-11-30 10:21:35.397193373 +0100 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java 2018-11-30 10:21:35.246195125 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -26,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java 2018-11-30 10:21:35.612190878 +0100 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java 2018-11-30 10:21:35.462192619 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -26,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2018-11-30 10:21:35.822188442 +0100 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2018-11-30 10:21:35.675190147 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -27,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java 2018-11-30 10:21:36.043185878 +0100 +++ new/test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java 2018-11-30 10:21:35.887187688 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -26,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/gc/whitebox/TestWBGC.java 2018-11-30 10:21:36.262183337 +0100 +++ new/test/hotspot/jtreg/gc/whitebox/TestWBGC.java 2018-11-30 10:21:36.109185112 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -25,7 +25,7 @@ * @test TestWBGC * @bug 8055098 * @summary Test verify that WB methods isObjectInOldGen and youngGC works correctly. - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @library /test/lib * @modules java.base/jdk.internal.misc * java.management --- old/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java 2018-11-30 10:21:36.479180819 +0100 +++ new/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java 2018-11-30 10:21:36.326182594 +0100 @@ -37,6 +37,7 @@ import jdk.test.lib.Platform; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; +import sun.hotspot.gc.GC; import sun.hotspot.code.Compiler; @@ -61,6 +62,9 @@ testCompressedOopsModes(args, "-XX:+UseSerialGC"); testCompressedOopsModes(args, "-XX:+UseParallelGC"); testCompressedOopsModes(args, "-XX:+UseParallelOldGC"); + if (GC.Shenandoah.isSupported()) { + testCompressedOopsModes(args, "-XX:+UseShenandoahGC"); + } } public static void testCompressedOopsModes(ArrayList flags1, String... flags2) throws Exception { --- old/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java 2018-11-30 10:21:36.692178348 +0100 +++ new/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java 2018-11-30 10:21:36.540180111 +0100 @@ -37,6 +37,7 @@ import jdk.test.lib.process.ProcessTools; import sun.hotspot.WhiteBox; import sun.hotspot.code.Compiler; +import sun.hotspot.gc.GC; public class MemberNameLeak { static class Leak { @@ -76,6 +77,7 @@ // Run this Leak class with logging ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xlog:membername+table=trace", + "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xbootclasspath/a:.", @@ -99,6 +101,10 @@ if (!Compiler.isGraalEnabled()) { // Graal does not support CMS test("-XX:+UseConcMarkSweepGC", false); test("-XX:+UseConcMarkSweepGC", true); + if (GC.Shenandoah.isSupported()) { + test("-XX:+UseShenandoahGC", true); + test("-XX:+UseShenandoahGC", false); + } } } } --- old/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java 2018-11-30 10:21:36.909175830 +0100 +++ new/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java 2018-11-30 10:21:36.756177605 +0100 @@ -34,6 +34,7 @@ * @bug 8191658 * @summary Test clhsdb jhisto command * @requires vm.hasSA + * @requires !vm.gc.Shenandoah * @library /test/lib * @run main/othervm ClhsdbJhisto */ --- old/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java 2018-11-30 10:21:37.125173324 +0100 +++ new/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java 2018-11-30 10:21:36.972175099 +0100 @@ -47,6 +47,7 @@ * @library /test/lib * @bug 8171084 * @requires vm.hasSAandCanAttach & (vm.bits == "64" & os.maxMemory > 8g) + * @requires !vm.gc.Shenandoah * @modules java.base/jdk.internal.misc * jdk.hotspot.agent/sun.jvm.hotspot * jdk.hotspot.agent/sun.jvm.hotspot.utilities --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java 2018-11-30 10:21:37.339170841 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCapacityTest.java 2018-11-30 10:21:37.192172546 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,7 +27,7 @@ * @test * @summary Test checks the consistency of the output * displayed with jstat -gccapacity. - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java 2018-11-30 10:21:37.557168311 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest01.java 2018-11-30 10:21:37.405170075 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -32,7 +32,7 @@ * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @run main/othervm -XX:+UsePerfData -Xmx128M GcCauseTest01 */ import utils.*; --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java 2018-11-30 10:21:37.776165770 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java 2018-11-30 10:21:37.621167569 +0100 @@ -28,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java 2018-11-30 10:21:37.994163241 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest03.java 2018-11-30 10:21:37.839165040 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java 2018-11-30 10:21:38.216160665 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcNewTest.java 2018-11-30 10:21:38.057162510 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -29,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java 2018-11-30 10:21:38.434158136 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest01.java 2018-11-30 10:21:38.280159923 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -35,7 +35,7 @@ * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @run main/othervm -XX:+UsePerfData -Xmx128M GcTest01 */ import utils.*; --- old/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java 2018-11-30 10:21:38.650155630 +0100 +++ new/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java 2018-11-30 10:21:38.496157416 +0100 @@ -28,7 +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" + * @requires vm.gc != "Z" & vm.gc != "Shenandoah" * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share --- old/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java 2018-11-30 10:21:38.868153100 +0100 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/TestDriver.java 2018-11-30 10:21:38.715154875 +0100 @@ -72,15 +72,16 @@ Boolean isUseG1GCon = wb.getBooleanVMFlag("UseG1GC"); Boolean isUseConcMarkSweepGCon = wb.getBooleanVMFlag("UseConcMarkSweepGC"); Boolean isUseZGCon = wb.getBooleanVMFlag("UseZGC"); + Boolean isShenandoahGCon = wb.getBooleanVMFlag("UseShenandoahGC"); Boolean isUseEpsilonGCon = wb.getBooleanVMFlag("UseEpsilonGC"); if (Compiler.isGraalEnabled() && - (isUseConcMarkSweepGCon || isUseZGCon || isUseEpsilonGCon)) { + (isUseConcMarkSweepGCon || isUseZGCon || isUseEpsilonGCon || isShenandoahGCon)) { return; // Graal does not support these GCs } String keyPhrase; - if ((isExplicitGCInvokesConcurrentOn && (isUseG1GCon || isUseConcMarkSweepGCon)) || isUseZGCon) { + if ((isExplicitGCInvokesConcurrentOn && (isUseG1GCon || isUseConcMarkSweepGCon)) || isUseZGCon || isShenandoahGCon) { keyPhrase = "GC"; } else { keyPhrase = "Pause Full"; --- old/test/lib/sun/hotspot/gc/GC.java 2018-11-30 10:21:39.082150617 +0100 +++ new/test/lib/sun/hotspot/gc/GC.java 2018-11-30 10:21:38.934152335 +0100 @@ -38,7 +38,8 @@ ConcMarkSweep(3), G1(4), Epsilon(5), - Z(6); + Z(6), + Shenandoah(7); private static final WhiteBox WB = WhiteBox.getWhiteBox();