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 * @requires vm.gc.Shenandoah 30 * 31 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 32 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 33 * -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify 34 * TestAllocObjects 35 * 36 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 37 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 38 * -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify 39 * TestAllocObjects 40 * 41 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 42 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 43 * -XX:+ShenandoahDegeneratedGC 44 * TestAllocObjects 45 * 46 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 47 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 48 * -XX:-ShenandoahDegeneratedGC 49 * TestAllocObjects 50 */ 51 52 /* 53 * @test id=aggressive 54 * @summary Acceptance tests: collector can withstand allocation 55 * @requires vm.gc.Shenandoah 56 * 57 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 58 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 59 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 60 * TestAllocObjects 61 * 62 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 63 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 64 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 65 * TestAllocObjects 66 * 67 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 68 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 69 * -XX:+ShenandoahOOMDuringEvacALot 70 * TestAllocObjects 71 * 72 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 73 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 74 * -XX:+ShenandoahAllocFailureALot 75 * TestAllocObjects 76 * 77 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 78 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 79 * TestAllocObjects 80 * 81 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 83 * -XX:+ShenandoahSuspendibleWorkers 84 * TestAllocObjects 85 * 86 */ 87 88 /* 89 * @test id=adaptive 90 * @summary Acceptance tests: collector can withstand allocation 91 * @requires vm.gc.Shenandoah 92 * 93 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 94 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 95 * -XX:+ShenandoahVerify 96 * TestAllocObjects 97 * 98 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 99 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 100 * TestAllocObjects 101 * 102 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 103 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 104 * -XX:+ShenandoahSuspendibleWorkers 105 * TestAllocObjects 106 */ 107 108 /* 109 * @test id=generational 110 * @summary Acceptance tests: collector can withstand allocation 111 * @requires vm.gc.Shenandoah 112 * 113 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 114 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational 115 * -XX:+ShenandoahVerify 116 * TestAllocObjects 117 * 118 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 119 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational 120 * TestAllocObjects 121 * 122 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 123 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational 124 * -XX:+ShenandoahSuspendibleWorkers 125 * TestAllocObjects 126 */ 127 128 /* 129 * @test id=static 130 * @summary Acceptance tests: collector can withstand allocation 131 * @requires vm.gc.Shenandoah 132 * 133 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 134 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 135 * TestAllocObjects 136 * 137 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 138 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 139 * -XX:+ShenandoahSuspendibleWorkers 140 * TestAllocObjects 141 */ 142 143 /* 144 * @test id=compact 145 * @summary Acceptance tests: collector can withstand allocation 146 * @requires vm.gc.Shenandoah 147 * 148 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 149 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 150 * TestAllocObjects 151 * 152 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 153 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 154 * -XX:+ShenandoahSuspendibleWorkers 155 * TestAllocObjects 156 */ 157 158 /* 159 * @test id=iu-aggressive 160 * @summary Acceptance tests: collector can withstand allocation 161 * @requires vm.gc.Shenandoah 162 * 163 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 164 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 165 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 166 * TestAllocObjects 167 * 168 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 169 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 170 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 171 * TestAllocObjects 172 * 173 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 174 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 175 * -XX:+ShenandoahOOMDuringEvacALot 176 * TestAllocObjects 177 * 178 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 179 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 180 * -XX:+ShenandoahAllocFailureALot 181 * TestAllocObjects 182 * 183 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 184 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 185 * TestAllocObjects 186 */ 187 188 /* 189 * @test id=iu 190 * @summary Acceptance tests: collector can withstand allocation 191 * @requires vm.gc.Shenandoah 192 * 193 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 194 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 195 * -XX:+ShenandoahVerify 196 * TestAllocObjects 197 * 198 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 199 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 200 * TestAllocObjects 201 * 202 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 203 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 204 * -XX:+ShenandoahSuspendibleWorkers 205 * TestAllocObjects 206 */ 207 208 public class TestAllocObjects { 209 210 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation 211 212 static volatile Object sink; 213 214 public static void main(String[] args) throws Exception { 215 long count = TARGET_MB * 1024 * 1024 / 16; 216 for (long c = 0; c < count; c++) { 217 sink = new Object(); 218 } 219 } 220 221 }