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