Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.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 tenured space during27* full GC are not aligned to SurvivorAlignmentInBytes value.28* @requires vm.gc != "Shenandoah"29* @library /testlibrary /testlibrary/whitebox30* @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain31* AlignmentHelper32* @run main ClassFileInstaller sun.hotspot.WhiteBox33* sun.hotspot.WhiteBox$WhiteBoxPermission34* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions35* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m36* -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=137* -XX:-ExplicitGCInvokesConcurrent38* -XX:+UnlockExperimentalVMOptions39* -XX:SurvivorAlignmentInBytes=3240* TestPromotionFromEdenToTenured 10m 9 TENURED41* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions42* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m43* -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=144* -XX:-ExplicitGCInvokesConcurrent45* -XX:+UnlockExperimentalVMOptions46* -XX:SurvivorAlignmentInBytes=3247* TestPromotionFromEdenToTenured 10m 47 TENURED48* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions49* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m50* -XX:OldSize=32m -XX:MaxHeapSize=96m51* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent52* -XX:+UnlockExperimentalVMOptions53* -XX:SurvivorAlignmentInBytes=6454* TestPromotionFromEdenToTenured 10m 9 TENURED55* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions56* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m57* -XX:OldSize=32m -XX:MaxHeapSize=128m58* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent59* -XX:+UnlockExperimentalVMOptions60* -XX:SurvivorAlignmentInBytes=6461* TestPromotionFromEdenToTenured 10m 87 TENURED62* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions63* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m64* -XX:OldSize=32M -XX:MaxHeapSize=96m -XX:SurvivorRatio=165* -XX:-ExplicitGCInvokesConcurrent66* -XX:+UnlockExperimentalVMOptions67* -XX:SurvivorAlignmentInBytes=12868* TestPromotionFromEdenToTenured 10m 9 TENURED69* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions70* -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m71* -XX:OldSize=32m -XX:MaxHeapSize=96m -XX:SurvivorRatio=172* -XX:-ExplicitGCInvokesConcurrent73* -XX:+UnlockExperimentalVMOptions74* -XX:SurvivorAlignmentInBytes=12875* TestPromotionFromEdenToTenured 10m 147 TENURED76*/77public class TestPromotionFromEdenToTenured {78public static void main(String args[]) {79SurvivorAlignmentTestMain test80= SurvivorAlignmentTestMain.fromArgs(args);81System.out.println(test);8283long expectedMemoryUsage = test.getExpectedMemoryUsage();84test.baselineMemoryAllocation();85System.gc();86// increase expected usage by current old gen usage87expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(88SurvivorAlignmentTestMain.HeapSpace.TENURED)89.getActualMemoryUsage();9091test.allocate();92System.gc();9394test.verifyMemoryUsage(expectedMemoryUsage);95}96}979899