Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestHumongousThreshold.java
40942 views
/*1* Copyright (c) 2017, 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 TestHumongousThreshold26* @key randomness27* @requires vm.gc.Shenandoah28* @library /test/lib29*30* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g31* -XX:+ShenandoahVerify32* TestHumongousThreshold33* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g34* -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=5035* TestHumongousThreshold36* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g37* -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=9038* TestHumongousThreshold39* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g40* -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=9941* TestHumongousThreshold42* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g43* -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=10044* TestHumongousThreshold45*46* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g47* -XX:-UseTLAB -XX:+ShenandoahVerify48* TestHumongousThreshold49* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g50* -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=5051* TestHumongousThreshold52* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g53* -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=9054* TestHumongousThreshold55* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g56* -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=9957* TestHumongousThreshold58* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g59* -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=10060* TestHumongousThreshold61*62* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g63* -XX:ShenandoahHumongousThreshold=90 -XX:ShenandoahGCHeuristics=aggressive64* TestHumongousThreshold65* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g66* -XX:-UseTLAB -XX:ShenandoahHumongousThreshold=90 -XX:ShenandoahGCHeuristics=aggressive67* TestHumongousThreshold68*/6970/*71* @test TestHumongousThreshold72* @key randomness73* @requires vm.gc.Shenandoah74* @requires vm.bits == "64"75* @library /test/lib76*77* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g78* -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify79* TestHumongousThreshold80* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g81* -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=5082* TestHumongousThreshold83* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g84* -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=9085* TestHumongousThreshold86* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g87* -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=9988* TestHumongousThreshold89* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g90* -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=10091* TestHumongousThreshold92*93* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g94* -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify95* TestHumongousThreshold96* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g97* -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=5098* TestHumongousThreshold99* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g100* -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=90101* TestHumongousThreshold102* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g103* -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=99104* TestHumongousThreshold105* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g106* -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=100107* TestHumongousThreshold108*/109110import java.util.Random;111import jdk.test.lib.Utils;112113public class TestHumongousThreshold {114115static final long TARGET_MB = Long.getLong("target", 20_000); // 20 Gb allocation116117static volatile Object sink;118119public static void main(String[] args) throws Exception {120final int min = 0;121final int max = 384 * 1024;122long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));123124Random r = Utils.getRandomInstance();125for (long c = 0; c < count; c++) {126sink = new int[min + r.nextInt(max - min)];127}128}129130}131132133