Path: blob/jdk8u272-b10-aarch32-20201026/hotspot/test/gc/survivorAlignment/TestAllocationInEden.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 object's alignment in eden space is not affected by27* SurvivorAlignmentInBytes option.28* @library /testlibrary /testlibrary/whitebox29* @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper30* @run main ClassFileInstaller sun.hotspot.WhiteBox31* sun.hotspot.WhiteBox$WhiteBoxPermission32* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions33* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m34* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions35* -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB36* -XX:OldSize=128m -XX:MaxHeapSize=192m37* -XX:-ExplicitGCInvokesConcurrent38* TestAllocationInEden 10m 9 EDEN39* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions40* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m41* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions42* -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB43* -XX:OldSize=128m -XX:MaxHeapSize=192m44* -XX:-ExplicitGCInvokesConcurrent45* TestAllocationInEden 10m 47 EDEN46* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions47* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m48* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions49* -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB50* -XX:OldSize=128m -XX:MaxHeapSize=192m51* -XX:-ExplicitGCInvokesConcurrent52* TestAllocationInEden 10m 9 EDEN53* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions54* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m55* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions56* -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB57* -XX:OldSize=128m -XX:MaxHeapSize=192m58* -XX:-ExplicitGCInvokesConcurrent59* TestAllocationInEden 10m 87 EDEN60* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions61* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m62* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions63* -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB64* -XX:OldSize=128m -XX:MaxHeapSize=192m65* -XX:-ExplicitGCInvokesConcurrent66* TestAllocationInEden 10m 9 EDEN67* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions68* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m69* -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions70* -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB71* -XX:OldSize=128m -XX:MaxHeapSize=192m72* -XX:-ExplicitGCInvokesConcurrent73* TestAllocationInEden 10m 147 EDEN74*/75public class TestAllocationInEden {76public static void main(String args[]) {77SurvivorAlignmentTestMain test78= SurvivorAlignmentTestMain.fromArgs(args);79System.out.println(test);8081long expectedMemoryUsage = test.getExpectedMemoryUsage();82test.baselineMemoryAllocation();83System.gc();8485test.allocate();8687test.verifyMemoryUsage(expectedMemoryUsage);88}89}909192