1 /* 2 * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package gc.epsilon; 25 26 /** 27 * @test id=default 28 * @key randomness 29 * @requires vm.gc.Epsilon & !vm.graal.enabled 30 * @summary Epsilon sliding GC works 31 * @library /test/lib 32 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 33 * gc.epsilon.TestSlidingGC 34 */ 35 36 /** 37 * @test id=default-verify 38 * @key randomness 39 * @requires vm.gc.Epsilon & !vm.graal.enabled 40 * @summary Epsilon sliding GC works 41 * @library /test/lib 42 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 43 * -XX:+EpsilonVerify 44 * gc.epsilon.TestSlidingGC 45 */ 46 47 /** 48 * @test id=default-uncommit 49 * @key randomness 50 * @requires vm.gc.Epsilon & !vm.graal.enabled 51 * @summary Epsilon sliding GC works 52 * @library /test/lib 53 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 54 * -XX:+EpsilonUncommit 55 * gc.epsilon.TestSlidingGC 56 */ 57 58 /** 59 * @test id=default-uncommit-verify 60 * @key randomness 61 * @requires vm.gc.Epsilon & !vm.graal.enabled 62 * @summary Epsilon sliding GC works 63 * @library /test/lib 64 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 65 * -XX:+EpsilonUncommit 66 * -XX:+EpsilonVerify 67 * gc.epsilon.TestSlidingGC 68 */ 69 70 /** 71 * @test id=coh 72 * @key randomness 73 * @requires vm.gc.Epsilon & !vm.graal.enabled 74 * @summary Epsilon sliding GC works 75 * @library /test/lib 76 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 77 * -XX:+UseCompactObjectHeaders 78 * gc.epsilon.TestSlidingGC 79 */ 80 81 /** 82 * @test id=coh-verify 83 * @key randomness 84 * @requires vm.gc.Epsilon & !vm.graal.enabled 85 * @summary Epsilon sliding GC works 86 * @library /test/lib 87 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 88 * -XX:+UseCompactObjectHeaders 89 * -XX:+EpsilonVerify 90 * gc.epsilon.TestSlidingGC 91 */ 92 93 /** 94 * @test id=coh-uncommit 95 * @key randomness 96 * @requires vm.gc.Epsilon & !vm.graal.enabled 97 * @summary Epsilon sliding GC works 98 * @library /test/lib 99 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 100 * -XX:+UseCompactObjectHeaders 101 * -XX:+EpsilonUncommit 102 * gc.epsilon.TestSlidingGC 103 */ 104 105 /** 106 * @test id=coh-uncommit-verify 107 * @key randomness 108 * @requires vm.gc.Epsilon & !vm.graal.enabled 109 * @summary Epsilon sliding GC works 110 * @library /test/lib 111 * @run main/othervm/timeout=960 -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+EpsilonSlidingGC 112 * -XX:+UseCompactObjectHeaders 113 * -XX:+EpsilonUncommit 114 * -XX:+EpsilonVerify 115 * gc.epsilon.TestSlidingGC 116 */ 117 118 import java.util.concurrent.*; 119 import java.util.Random; 120 121 import jdk.test.lib.process.OutputAnalyzer; 122 import jdk.test.lib.process.ProcessTools; 123 import jdk.test.lib.Utils; 124 125 public class TestSlidingGC { 126 127 static int SIZE = Integer.getInteger("size", 10_000_000); // ~160 MB retained 128 static int COUNT = Integer.getInteger("count", 1_000_000_000); // ~240 GB allocation 129 130 static Object[] sink; 131 132 public static void main(String... args) { 133 Random r = Utils.getRandomInstance(); 134 sink = new Object[SIZE]; 135 for (int c = 0; c < COUNT; c++) { 136 sink[r.nextInt(SIZE)] = new Object(); 137 } 138 } 139 140 }