Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestResizeTLAB.java
40942 views
/*1* Copyright (c) 2020, 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 TestResizeTLAB26* @key randomness27* @summary Test that Shenandoah is able to work with(out) resizeable TLABs28* @requires vm.gc.Shenandoah29* @library /test/lib30*31* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions32* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive33* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify34* -XX:+ShenandoahVerify35* -XX:+ResizeTLAB36* TestResizeTLAB37*38* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions39* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive40* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify41* -XX:+ShenandoahVerify42* -XX:-ResizeTLAB43* TestResizeTLAB44*45* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions46* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive47* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify48* -XX:+ShenandoahVerify49* -XX:+ResizeTLAB50* TestResizeTLAB51*52* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions53* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive54* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify55* -XX:+ShenandoahVerify56* -XX:-ResizeTLAB57* TestResizeTLAB58*/5960/*61* @test TestResizeTLAB62* @key randomness63* @summary Test that Shenandoah is able to work with(out) resizeable TLABs64* @requires vm.gc.Shenandoah65* @library /test/lib66*67* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions68* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive69* -XX:+ShenandoahVerify70* -XX:+ResizeTLAB71* TestResizeTLAB72*73* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions74* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive75* -XX:+ShenandoahVerify76* -XX:-ResizeTLAB77* TestResizeTLAB78*/7980/*81* @test TestResizeTLAB82* @key randomness83* @summary Test that Shenandoah is able to work with(out) resizeable TLABs84* @requires vm.gc.Shenandoah85* @library /test/lib86*87* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions88* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive89* -XX:+ShenandoahVerify90* -XX:+ResizeTLAB91* TestResizeTLAB92*93* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions94* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive95* -XX:+ShenandoahVerify96* -XX:-ResizeTLAB97* TestResizeTLAB98*/99100/*101* @test TestResizeTLAB102* @key randomness103* @summary Test that Shenandoah is able to work with(out) resizeable TLABs104* @requires vm.gc.Shenandoah105* @library /test/lib106*107* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions108* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static109* -XX:+ShenandoahVerify110* -XX:+ResizeTLAB111* TestResizeTLAB112*113* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions114* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static115* -XX:+ShenandoahVerify116* -XX:-ResizeTLAB117* TestResizeTLAB118*/119120/*121* @test TestResizeTLAB122* @key randomness123* @summary Test that Shenandoah is able to work with(out) resizeable TLABs124* @requires vm.gc.Shenandoah125* @library /test/lib126*127* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions128* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact129* -XX:+ShenandoahVerify130* -XX:+ResizeTLAB131* TestResizeTLAB132*133* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions134* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact135* -XX:+ShenandoahVerify136* -XX:-ResizeTLAB137* TestResizeTLAB138*/139140/*141* @test TestResizeTLAB142* @key randomness143* @summary Test that Shenandoah is able to work with(out) resizeable TLABs144* @requires vm.gc.Shenandoah145* @library /test/lib146*147* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions148* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive149* -XX:+ShenandoahVerify150* -XX:+ResizeTLAB151* TestResizeTLAB152*153* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions154* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive155* -XX:+ShenandoahVerify156* -XX:-ResizeTLAB157* TestResizeTLAB158*/159160/*161* @test TestResizeTLAB162* @key randomness163* @summary Test that Shenandoah is able to work with(out) resizeable TLABs164* @requires vm.gc.Shenandoah165* @library /test/lib166*167* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions168* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu169* -XX:+ShenandoahVerify170* -XX:+ResizeTLAB171* TestResizeTLAB172*173* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions174* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu175* -XX:+ShenandoahVerify176* -XX:-ResizeTLAB177* TestResizeTLAB178*/179180import java.util.Random;181import jdk.test.lib.Utils;182183public class TestResizeTLAB {184185static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation186187static volatile Object sink;188189public static void main(String[] args) throws Exception {190final int min = 0;191final int max = 384 * 1024;192long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));193194Random r = Utils.getRandomInstance();195for (long c = 0; c < count; c++) {196sink = new int[min + r.nextInt(max - min)];197}198}199200}201202203