Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestAllocObjectArrays.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 TestAllocObjectArrays26* @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* TestAllocObjectArrays35*36* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g37* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive38* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify39* TestAllocObjectArrays40*41* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g42* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive43* -XX:+ShenandoahDegeneratedGC44* TestAllocObjectArrays45*46* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g47* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive48* -XX:-ShenandoahDegeneratedGC49* TestAllocObjectArrays50*/5152/*53* @test TestAllocObjectArrays54* @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* TestAllocObjectArrays63*64* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g65* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive66* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify67* TestAllocObjectArrays68*69* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g70* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive71* -XX:+ShenandoahOOMDuringEvacALot72* TestAllocObjectArrays73*74* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g75* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive76* -XX:+ShenandoahAllocFailureALot77* TestAllocObjectArrays78*79* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g80* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive81* TestAllocObjectArrays82*/8384/*85* @test TestAllocObjectArrays86* @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* TestAllocObjectArrays95*96* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g97* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive98* TestAllocObjectArrays99*/100101/*102* @test TestAllocObjectArrays103* @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* TestAllocObjectArrays111*/112113/*114* @test TestAllocObjectArrays115* @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* TestAllocObjectArrays123*/124125/*126* @test TestAllocObjectArrays127* @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* TestAllocObjectArrays136*/137138/*139* @test TestAllocObjectArrays140* @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* TestAllocObjectArrays149*150* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g151* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive152* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify153* TestAllocObjectArrays154*155* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g156* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive157* -XX:+ShenandoahOOMDuringEvacALot158* TestAllocObjectArrays159*160* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g161* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive162* -XX:+ShenandoahAllocFailureALot163* TestAllocObjectArrays164*165* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g166* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive167* TestAllocObjectArrays168*/169170/*171* @test TestAllocObjectArrays172* @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* TestAllocObjectArrays181*182* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g183* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu184* TestAllocObjectArrays185*/186187import java.util.Random;188import jdk.test.lib.Utils;189190public class TestAllocObjectArrays {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 Object[min + r.nextInt(max - min)];204}205}206207}208209210