Path: blob/jdk8u272-b10-aarch32-20201026/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.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 tenured space during27* full GC are not aligned to SurvivorAlignmentInBytes value.28* @library /testlibrary /testlibrary/whitebox29* @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain30* 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:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=136* -XX:-ExplicitGCInvokesConcurrent37* -XX:+UnlockExperimentalVMOptions38* -XX:SurvivorAlignmentInBytes=3239* TestPromotionFromEdenToTenured 10m 9 TENURED40* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions41* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m42* -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=143* -XX:-ExplicitGCInvokesConcurrent44* -XX:+UnlockExperimentalVMOptions45* -XX:SurvivorAlignmentInBytes=3246* TestPromotionFromEdenToTenured 10m 47 TENURED47* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions48* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m49* -XX:OldSize=32m -XX:MaxHeapSize=96m50* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent51* -XX:+UnlockExperimentalVMOptions52* -XX:SurvivorAlignmentInBytes=6453* TestPromotionFromEdenToTenured 10m 9 TENURED54* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions55* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m56* -XX:OldSize=32m -XX:MaxHeapSize=128m57* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent58* -XX:+UnlockExperimentalVMOptions59* -XX:SurvivorAlignmentInBytes=6460* TestPromotionFromEdenToTenured 10m 87 TENURED61* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions62* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m63* -XX:OldSize=32M -XX:MaxHeapSize=96m -XX:SurvivorRatio=164* -XX:-ExplicitGCInvokesConcurrent65* -XX:+UnlockExperimentalVMOptions66* -XX:SurvivorAlignmentInBytes=12867* TestPromotionFromEdenToTenured 10m 9 TENURED68* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions69* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m70* -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=171* -XX:-ExplicitGCInvokesConcurrent72* -XX:+UnlockExperimentalVMOptions73* -XX:SurvivorAlignmentInBytes=12874* TestPromotionFromEdenToTenured 10m 147 TENURED75*/76public class TestPromotionFromEdenToTenured {77public static void main(String args[]) {78SurvivorAlignmentTestMain test79= SurvivorAlignmentTestMain.fromArgs(args);80System.out.println(test);8182long expectedMemoryUsage = test.getExpectedMemoryUsage();83test.baselineMemoryAllocation();84System.gc();85// increase expected usage by current old gen usage86expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(87SurvivorAlignmentTestMain.HeapSpace.TENURED)88.getActualMemoryUsage();8990test.allocate();91System.gc();9293test.verifyMemoryUsage(expectedMemoryUsage);94}95}969798