Path: blob/jdk8u272-b10-aarch32-20201026/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java
48799 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* @library /testlibrary /testlibrary/whitebox29* @build TestPromotionToSurvivor30* SurvivorAlignmentTestMain AlignmentHelper31* @run main ClassFileInstaller sun.hotspot.WhiteBox32* sun.hotspot.WhiteBox$WhiteBoxPermission33* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions34* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m35* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions36* -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m37* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent38* TestPromotionToSurvivor 10m 9 SURVIVOR39* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions40* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m41* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions42* -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m43* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent44* TestPromotionToSurvivor 20m 47 SURVIVOR45* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions46* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m47* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions48* -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m49* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent50* TestPromotionToSurvivor 8m 9 SURVIVOR51* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions52* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m53* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions54* -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m55* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent56* TestPromotionToSurvivor 20m 87 SURVIVOR57* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions58* -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m59* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions60* -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m61* -XX:MaxHeapSize=384m -XX:-ExplicitGCInvokesConcurrent62* TestPromotionToSurvivor 10m 9 SURVIVOR63* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions64* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m65* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions66* -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m67* -XX:MaxHeapSize=256m -XX:-ExplicitGCInvokesConcurrent68* TestPromotionToSurvivor 20m 147 SURVIVOR69*/70public class TestPromotionToSurvivor {71public static void main(String args[]) {72SurvivorAlignmentTestMain test73= SurvivorAlignmentTestMain.fromArgs(args);74System.out.println(test);7576long expectedUsage = test.getExpectedMemoryUsage();77test.baselineMemoryAllocation();78SurvivorAlignmentTestMain.WHITE_BOX.fullGC();7980test.allocate();81SurvivorAlignmentTestMain.WHITE_BOX.youngGC();8283test.verifyMemoryUsage(expectedUsage);84}85}868788