1 /* 2 * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved. 3 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 /* 27 * @test id=passive 28 * @summary Acceptance tests: collector can withstand allocation 29 * @key randomness 30 * @requires vm.gc.Shenandoah 31 * @library /test/lib 32 * 33 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 34 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 35 * -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify 36 * TestAllocIntArrays 37 * 38 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 39 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 40 * -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify 41 * TestAllocIntArrays 42 * 43 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 44 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 45 * -XX:+ShenandoahDegeneratedGC 46 * TestAllocIntArrays 47 * 48 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 49 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 50 * -XX:-ShenandoahDegeneratedGC 51 * TestAllocIntArrays 52 */ 53 54 /* 55 * @test id=aggressive 56 * @summary Acceptance tests: collector can withstand allocation 57 * @key randomness 58 * @requires vm.gc.Shenandoah 59 * @library /test/lib 60 * 61 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 62 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 63 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 64 * TestAllocIntArrays 65 * 66 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 67 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 68 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 69 * TestAllocIntArrays 70 * 71 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 72 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 73 * -XX:+ShenandoahOOMDuringEvacALot 74 * TestAllocIntArrays 75 * 76 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 77 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 78 * -XX:+ShenandoahAllocFailureALot 79 * TestAllocIntArrays 80 * 81 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 83 * TestAllocIntArrays 84 */ 85 86 /* 87 * @test id=adaptive 88 * @summary Acceptance tests: collector can withstand allocation 89 * @key randomness 90 * @requires vm.gc.Shenandoah 91 * @library /test/lib 92 * 93 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 94 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 95 * -XX:+ShenandoahVerify 96 * TestAllocIntArrays 97 * 98 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 99 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 100 * TestAllocIntArrays 101 * 102 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 103 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational 104 * -XX:+ShenandoahVerify 105 * TestAllocIntArrays 106 * 107 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 108 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational 109 * TestAllocIntArrays 110 */ 111 112 /* 113 * @test id=static 114 * @summary Acceptance tests: collector can withstand allocation 115 * @key randomness 116 * @requires vm.gc.Shenandoah 117 * @library /test/lib 118 * 119 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 120 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 121 * TestAllocIntArrays 122 */ 123 124 /* 125 * @test id=compact 126 * @summary Acceptance tests: collector can withstand allocation 127 * @key randomness 128 * @requires vm.gc.Shenandoah 129 * @library /test/lib 130 * 131 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 132 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 133 * TestAllocIntArrays 134 */ 135 136 /* 137 * @test id=no-tlab 138 * @summary Acceptance tests: collector can withstand allocation 139 * @key randomness 140 * @requires vm.gc.Shenandoah 141 * @library /test/lib 142 * 143 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 144 * -XX:+UseShenandoahGC 145 * -XX:-UseTLAB -XX:+ShenandoahVerify 146 * TestAllocIntArrays 147 */ 148 149 /* 150 * @test id=iu-aggressive 151 * @summary Acceptance tests: collector can withstand allocation 152 * @key randomness 153 * @requires vm.gc.Shenandoah 154 * @library /test/lib 155 * 156 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 157 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 158 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 159 * TestAllocIntArrays 160 * 161 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 162 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 163 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 164 * TestAllocIntArrays 165 * 166 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 167 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 168 * -XX:+ShenandoahOOMDuringEvacALot 169 * TestAllocIntArrays 170 * 171 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 172 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 173 * -XX:+ShenandoahAllocFailureALot 174 * TestAllocIntArrays 175 * 176 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 177 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 178 * TestAllocIntArrays 179 */ 180 181 /* 182 * @test id=iu 183 * @summary Acceptance tests: collector can withstand allocation 184 * @key randomness 185 * @requires vm.gc.Shenandoah 186 * @library /test/lib 187 * 188 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 189 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 190 * -XX:+ShenandoahVerify 191 * TestAllocIntArrays 192 * 193 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 194 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 195 * TestAllocIntArrays 196 */ 197 198 import java.util.Random; 199 import jdk.test.lib.Utils; 200 201 public class TestAllocIntArrays { 202 203 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation 204 205 static volatile Object sink; 206 207 public static void main(String[] args) throws Exception { 208 final int min = 0; 209 final int max = 384 * 1024; 210 long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2)); 211 212 Random r = Utils.getRandomInstance(); 213 for (long c = 0; c < count; c++) { 214 sink = new int[min + r.nextInt(max - min)]; 215 } 216 } 217 218 }