Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestAllocIntArrays.java
40942 views
/*1* Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324/*25* @test TestAllocIntArrays26* @summary Acceptance tests: collector can withstand allocation27* @key randomness28* @requires vm.gc.Shenandoah29* @library /test/lib30*31* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g32* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive33* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify34* TestAllocIntArrays35*36* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g37* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive38* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify39* TestAllocIntArrays40*41* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g42* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive43* -XX:+ShenandoahDegeneratedGC44* TestAllocIntArrays45*46* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g47* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive48* -XX:-ShenandoahDegeneratedGC49* TestAllocIntArrays50*/5152/*53* @test TestAllocIntArrays54* @summary Acceptance tests: collector can withstand allocation55* @key randomness56* @requires vm.gc.Shenandoah57* @library /test/lib58*59* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g60* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive61* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify62* TestAllocIntArrays63*64* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g65* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive66* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify67* TestAllocIntArrays68*69* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g70* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive71* -XX:+ShenandoahOOMDuringEvacALot72* TestAllocIntArrays73*74* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g75* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive76* -XX:+ShenandoahAllocFailureALot77* TestAllocIntArrays78*79* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g80* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive81* TestAllocIntArrays82*/8384/*85* @test TestAllocIntArrays86* @summary Acceptance tests: collector can withstand allocation87* @key randomness88* @requires vm.gc.Shenandoah89* @library /test/lib90*91* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g92* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive93* -XX:+ShenandoahVerify94* TestAllocIntArrays95*96* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g97* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive98* TestAllocIntArrays99*/100101/*102* @test TestAllocIntArrays103* @summary Acceptance tests: collector can withstand allocation104* @key randomness105* @requires vm.gc.Shenandoah106* @library /test/lib107*108* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g109* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static110* TestAllocIntArrays111*/112113/*114* @test TestAllocIntArrays115* @summary Acceptance tests: collector can withstand allocation116* @key randomness117* @requires vm.gc.Shenandoah118* @library /test/lib119*120* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g121* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact122* TestAllocIntArrays123*/124125/*126* @test TestAllocIntArrays127* @summary Acceptance tests: collector can withstand allocation128* @key randomness129* @requires vm.gc.Shenandoah130* @library /test/lib131*132* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g133* -XX:+UseShenandoahGC134* -XX:-UseTLAB -XX:+ShenandoahVerify135* TestAllocIntArrays136*/137138/*139* @test TestAllocIntArrays140* @summary Acceptance tests: collector can withstand allocation141* @key randomness142* @requires vm.gc.Shenandoah143* @library /test/lib144*145* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g146* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive147* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify148* TestAllocIntArrays149*150* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g151* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive152* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify153* TestAllocIntArrays154*155* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g156* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive157* -XX:+ShenandoahOOMDuringEvacALot158* TestAllocIntArrays159*160* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g161* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive162* -XX:+ShenandoahAllocFailureALot163* TestAllocIntArrays164*165* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g166* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive167* TestAllocIntArrays168*/169170/*171* @test TestAllocIntArrays172* @summary Acceptance tests: collector can withstand allocation173* @key randomness174* @requires vm.gc.Shenandoah175* @library /test/lib176*177* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g178* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu179* -XX:+ShenandoahVerify180* TestAllocIntArrays181*182* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g183* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu184* TestAllocIntArrays185*/186187import java.util.Random;188import jdk.test.lib.Utils;189190public class TestAllocIntArrays {191192static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation193194static volatile Object sink;195196public static void main(String[] args) throws Exception {197final int min = 0;198final int max = 384 * 1024;199long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));200201Random r = Utils.getRandomInstance();202for (long c = 0; c < count; c++) {203sink = new int[min + r.nextInt(max - min)];204}205}206207}208209210