Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/TestAllocObjectArrays.java
32284 views
/*1* Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223/*24* @test TestAllocObjectArrays25* @summary Acceptance tests: collector can withstand allocation26* @key gc27*28* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g29* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive30* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify31* TestAllocObjectArrays32*33* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g34* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive35* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify36* TestAllocObjectArrays37*38* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g39* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive40* -XX:+ShenandoahDegeneratedGC41* TestAllocObjectArrays42*43* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g44* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive45* -XX:-ShenandoahDegeneratedGC46* TestAllocObjectArrays4748/*49* @test TestAllocObjectArrays50* @summary Acceptance tests: collector can withstand allocation51* @key gc52*53* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g54* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive55* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify56* TestAllocObjectArrays57*58* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g59* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive60* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify61* TestAllocObjectArrays62*63* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g64* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive65* -XX:+ShenandoahOOMDuringEvacALot66* TestAllocObjectArrays67*68* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g69* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive70* -XX:+ShenandoahAllocFailureALot71* TestAllocObjectArrays72*73* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g74* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive75* TestAllocObjectArrays76*/7778/*79* @test TestAllocObjectArrays80* @summary Acceptance tests: collector can withstand allocation81* @key gc82*83* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g84* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive85* -XX:+ShenandoahVerify86* TestAllocObjectArrays87*88* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g89* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive90* TestAllocObjectArrays91*/9293/*94* @test TestAllocObjectArrays95* @summary Acceptance tests: collector can withstand allocation96* @key gc97*98* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g99* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static100* TestAllocObjectArrays101*/102103/*104* @test TestAllocObjectArrays105* @summary Acceptance tests: collector can withstand allocation106* @key gc107*108* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g109* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact110* TestAllocObjectArrays111*/112113/*114* @test TestAllocObjectArrays115* @summary Acceptance tests: collector can withstand allocation116* @key gc117*118* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g119* -XX:+UseShenandoahGC120* -XX:-UseTLAB -XX:+ShenandoahVerify121* TestAllocObjectArrays122*/123124/*125* @test TestAllocObjectArrays126* @summary Acceptance tests: collector can withstand allocation127* @key gc128*129* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g130* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive131* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify132* TestAllocObjectArrays133*134* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g135* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive136* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify137* TestAllocObjectArrays138*139* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g140* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive141* -XX:+ShenandoahOOMDuringEvacALot142* TestAllocObjectArrays143*144* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g145* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive146* -XX:+ShenandoahAllocFailureALot147* TestAllocObjectArrays148*149* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g150* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive151* TestAllocObjectArrays152*/153154/*155* @test TestAllocObjectArrays156* @summary Acceptance tests: collector can withstand allocation157* @key gc158*159* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g160* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu161* -XX:+ShenandoahVerify162* TestAllocObjectArrays163*164* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g165* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu166* TestAllocObjectArrays167*/168169import java.util.Random;170171public class TestAllocObjectArrays {172173static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation174175static volatile Object sink;176177public static void main(String[] args) throws Exception {178final int min = 0;179final int max = 384 * 1024;180long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));181182Random r = new Random();183for (long c = 0; c < count; c++) {184sink = new Object[min + r.nextInt(max - min)];185}186}187188}189190191