Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java
32284 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. 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*/2223/**24* @test25* @bug 803132326* @summary Verify that objects promoted from eden space to survivor space after27* minor GC are aligned to SurvivorAlignmentInBytes.28* @requires vm.gc != "Shenandoah"29* @library /testlibrary /testlibrary/whitebox30* @build TestPromotionToSurvivor31* SurvivorAlignmentTestMain AlignmentHelper32* @run main ClassFileInstaller sun.hotspot.WhiteBox33* sun.hotspot.WhiteBox$WhiteBoxPermission34* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions35* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m36* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions37* -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m38* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent39* TestPromotionToSurvivor 10m 9 SURVIVOR40* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions41* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m42* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions43* -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m44* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent45* TestPromotionToSurvivor 20m 47 SURVIVOR46* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions47* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m48* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions49* -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m50* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent51* TestPromotionToSurvivor 8m 9 SURVIVOR52* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions53* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m54* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions55* -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m56* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent57* TestPromotionToSurvivor 20m 87 SURVIVOR58* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions59* -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m60* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions61* -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m62* -XX:MaxHeapSize=384m -XX:-ExplicitGCInvokesConcurrent63* TestPromotionToSurvivor 10m 9 SURVIVOR64* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions65* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m66* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions67* -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m68* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent69* TestPromotionToSurvivor 20m 147 SURVIVOR70*/71public class TestPromotionToSurvivor {72public static void main(String args[]) {73SurvivorAlignmentTestMain test74= SurvivorAlignmentTestMain.fromArgs(args);75System.out.println(test);7677long expectedUsage = test.getExpectedMemoryUsage();78test.baselineMemoryAllocation();79SurvivorAlignmentTestMain.WHITE_BOX.fullGC();8081test.allocate();82SurvivorAlignmentTestMain.WHITE_BOX.youngGC();8384test.verifyMemoryUsage(expectedUsage);85}86}878889