Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/TestAllocIntArrays.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 TestAllocIntArrays25* @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* TestAllocIntArrays32*33* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g34* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive35* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify36* TestAllocIntArrays37*38* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g39* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive40* -XX:+ShenandoahDegeneratedGC41* TestAllocIntArrays42*43* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g44* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive45* -XX:-ShenandoahDegeneratedGC46* TestAllocIntArrays47*/4849/*50* @test TestAllocIntArrays51* @summary Acceptance tests: collector can withstand allocation52* @key gc53*54* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g55* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive56* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify57* TestAllocIntArrays58*59* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g60* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive61* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify62* TestAllocIntArrays63*64* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g65* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive66* -XX:+ShenandoahOOMDuringEvacALot67* TestAllocIntArrays68*69* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g70* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive71* -XX:+ShenandoahAllocFailureALot72* TestAllocIntArrays73*74* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g75* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive76* TestAllocIntArrays77*/7879/*80* @test TestAllocIntArrays81* @summary Acceptance tests: collector can withstand allocation82* @key gc83*84* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g85* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive86* -XX:+ShenandoahVerify87* TestAllocIntArrays88*89* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g90* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive91* TestAllocIntArrays92*/9394/*95* @test TestAllocIntArrays96* @summary Acceptance tests: collector can withstand allocation97* @key gc98*99* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g100* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static101* TestAllocIntArrays102*/103104/*105* @test TestAllocIntArrays106* @summary Acceptance tests: collector can withstand allocation107* @key gc108*109* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g110* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact111* TestAllocIntArrays112*/113114/*115* @test TestAllocIntArrays116* @summary Acceptance tests: collector can withstand allocation117* @key gc118*119* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g120* -XX:+UseShenandoahGC121* -XX:-UseTLAB -XX:+ShenandoahVerify122* TestAllocIntArrays123*/124125/*126* @test TestAllocIntArrays127* @summary Acceptance tests: collector can withstand allocation128* @key gc129*130* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g131* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive132* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify133* TestAllocIntArrays134*135* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g136* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive137* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify138* TestAllocIntArrays139*140* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g141* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive142* -XX:+ShenandoahOOMDuringEvacALot143* TestAllocIntArrays144*145* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g146* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive147* -XX:+ShenandoahAllocFailureALot148* TestAllocIntArrays149*150* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g151* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive152* TestAllocIntArrays153*/154155/*156* @test TestAllocIntArrays157* @summary Acceptance tests: collector can withstand allocation158* @key gc159*160* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g161* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu162* -XX:+ShenandoahVerify163* TestAllocIntArrays164*165* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g166* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu167* TestAllocIntArrays168*/169170import java.util.Random;171172public class TestAllocIntArrays {173174static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation175176static volatile Object sink;177178public static void main(String[] args) throws Exception {179final int min = 0;180final int max = 384 * 1024;181long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));182183Random r = new Random();184for (long c = 0; c < count; c++) {185sink = new int[min + r.nextInt(max - min)];186}187}188189}190191192