Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/survivorAlignment/TestAllocationInEden.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 object's alignment in eden space is not affected by27* SurvivorAlignmentInBytes option.28* @requires vm.gc != "Shenandoah"29* @library /testlibrary /testlibrary/whitebox30* @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper31* @run main ClassFileInstaller sun.hotspot.WhiteBox32* sun.hotspot.WhiteBox$WhiteBoxPermission33* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions34* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m35* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions36* -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB37* -XX:OldSize=128m -XX:MaxHeapSize=192m38* -XX:-ExplicitGCInvokesConcurrent39* TestAllocationInEden 10m 9 EDEN40* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions41* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m42* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions43* -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB44* -XX:OldSize=128m -XX:MaxHeapSize=192m45* -XX:-ExplicitGCInvokesConcurrent46* TestAllocationInEden 10m 47 EDEN47* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions48* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m49* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions50* -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB51* -XX:OldSize=128m -XX:MaxHeapSize=192m52* -XX:-ExplicitGCInvokesConcurrent53* TestAllocationInEden 10m 9 EDEN54* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions55* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m56* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions57* -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB58* -XX:OldSize=128m -XX:MaxHeapSize=192m59* -XX:-ExplicitGCInvokesConcurrent60* TestAllocationInEden 10m 87 EDEN61* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions62* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m63* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions64* -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB65* -XX:OldSize=128m -XX:MaxHeapSize=192m66* -XX:-ExplicitGCInvokesConcurrent67* TestAllocationInEden 10m 9 EDEN68* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions69* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m70* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions71* -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB72* -XX:OldSize=128m -XX:MaxHeapSize=192m73* -XX:-ExplicitGCInvokesConcurrent74* TestAllocationInEden 10m 147 EDEN75*/76public class TestAllocationInEden {77public static void main(String args[]) {78SurvivorAlignmentTestMain test79= SurvivorAlignmentTestMain.fromArgs(args);80System.out.println(test);8182long expectedMemoryUsage = test.getExpectedMemoryUsage();83test.baselineMemoryAllocation();84System.gc();8586test.allocate();8788test.verifyMemoryUsage(expectedMemoryUsage);89}90}919293