# HG changeset patch # User goetz # Date 1419000156 -3600 # Node ID 2da04867c170c8633466cfc3f505b5077f364b0d # Parent fd55c0f2c20050b88267989c4c474f935fe504eb 8067941: [TESTBUG] Fix tests for OS with 64K page size. diff --git a/src/share/vm/memory/metaspace.cpp b/src/share/vm/memory/metaspace.cpp --- a/src/share/vm/memory/metaspace.cpp +++ b/src/share/vm/memory/metaspace.cpp @@ -3828,11 +3828,13 @@ assert(cm.sum_free_chunks() == 2*MediumChunk, "sizes should add up"); } - { // 4 pages of VSN is committed, some is used by chunks + const size_t page_chunks = 4 * (size_t)os::vm_page_size() / BytesPerWord; + // This doesn't work for systems with vm_page_size >= 16K. + if (page_chunks < MediumChunk) { + // 4 pages of VSN is committed, some is used by chunks ChunkManager cm(SpecializedChunk, SmallChunk, MediumChunk); VirtualSpaceNode vsn(vsn_test_size_bytes); - const size_t page_chunks = 4 * (size_t)os::vm_page_size() / BytesPerWord; - assert(page_chunks < MediumChunk, "Test expects medium chunks to be at least 4*page_size"); + vsn.initialize(); vsn.expand_by(page_chunks, page_chunks); vsn.get_chunk_vs(SmallChunk); diff --git a/test/compiler/exceptions/TestRecursiveReplacedException.java b/test/compiler/exceptions/TestRecursiveReplacedException.java --- a/test/compiler/exceptions/TestRecursiveReplacedException.java +++ b/test/compiler/exceptions/TestRecursiveReplacedException.java @@ -25,7 +25,7 @@ * @test * @bug 8054224 * @summary Recursive method compiled by C1 is unable to catch StackOverflowError - * @run main/othervm -Xcomp -XX:CompileOnly=Test.run -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss256K TestRecursiveReplacedException + * @run main/othervm -Xcomp -XX:CompileOnly=Test.run -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss392K TestRecursiveReplacedException * */ diff --git a/test/compiler/runtime/6865265/StackOverflowBug.java b/test/compiler/runtime/6865265/StackOverflowBug.java --- a/test/compiler/runtime/6865265/StackOverflowBug.java +++ b/test/compiler/runtime/6865265/StackOverflowBug.java @@ -28,7 +28,7 @@ * @summary JVM crashes with "missing exception handler" error * @author volker.simonis@sap.com * - * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss248k StackOverflowBug + * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss392k StackOverflowBug */ diff --git a/test/compiler/uncommontrap/8009761/Test8009761.java b/test/compiler/uncommontrap/8009761/Test8009761.java --- a/test/compiler/uncommontrap/8009761/Test8009761.java +++ b/test/compiler/uncommontrap/8009761/Test8009761.java @@ -32,7 +32,7 @@ * @build Test8009761 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss392K Test8009761 */ public class Test8009761 { diff --git a/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java b/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java --- a/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java +++ b/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java @@ -25,7 +25,7 @@ * @test * @bug 8029383 * @summary stack overflow if callee is marked for deoptimization causes crash - * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,StackOverflowGuardPagesOff::m1 -XX:CompileCommand=exclude,StackOverflowGuardPagesOff::m2 -Xss256K -XX:-UseOnStackReplacement StackOverflowGuardPagesOff + * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,StackOverflowGuardPagesOff::m1 -XX:CompileCommand=exclude,StackOverflowGuardPagesOff::m2 -Xss392K -XX:-UseOnStackReplacement StackOverflowGuardPagesOff * */ diff --git a/test/compiler/uncommontrap/TestStackBangMonitorOwned.java b/test/compiler/uncommontrap/TestStackBangMonitorOwned.java --- a/test/compiler/uncommontrap/TestStackBangMonitorOwned.java +++ b/test/compiler/uncommontrap/TestStackBangMonitorOwned.java @@ -25,7 +25,7 @@ * @test * @bug 8032410 * @summary Stack overflow at deoptimization doesn't release owned monitors - * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangMonitorOwned::m1 -XX:CompileCommand=exclude,TestStackBangMonitorOwned::m2 -Xss256K -XX:-UseOnStackReplacement TestStackBangMonitorOwned + * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangMonitorOwned::m1 -XX:CompileCommand=exclude,TestStackBangMonitorOwned::m2 -Xss392K -XX:-UseOnStackReplacement TestStackBangMonitorOwned * */ public class TestStackBangMonitorOwned { diff --git a/test/compiler/uncommontrap/TestStackBangRbp.java b/test/compiler/uncommontrap/TestStackBangRbp.java --- a/test/compiler/uncommontrap/TestStackBangRbp.java +++ b/test/compiler/uncommontrap/TestStackBangRbp.java @@ -25,7 +25,7 @@ * @test * @bug 8028308 * @summary rbp not restored when stack overflow is thrown from deopt/uncommon trap blobs - * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss256K -XX:-UseOnStackReplacement TestStackBangRbp + * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss392K -XX:-UseOnStackReplacement TestStackBangRbp * */ public class TestStackBangRbp { diff --git a/test/gc/arguments/TestMaxHeapSizeTools.java b/test/gc/arguments/TestMaxHeapSizeTools.java --- a/test/gc/arguments/TestMaxHeapSizeTools.java +++ b/test/gc/arguments/TestMaxHeapSizeTools.java @@ -112,7 +112,7 @@ } private static void checkInvalidMinInitialHeapCombinations(String gcflag) throws Exception { - expectError(new String[] { gcflag, "-Xms8M", "-XX:InitialHeapSize=4M", "-version" }); + expectError(new String[] { gcflag, "-Xms64M", "-XX:InitialHeapSize=32M", "-version" }); } private static void checkValidMinInitialHeapCombinations(String gcflag) throws Exception { diff --git a/test/gc/g1/TestGCLogMessages.java b/test/gc/g1/TestGCLogMessages.java --- a/test/gc/g1/TestGCLogMessages.java +++ b/test/gc/g1/TestGCLogMessages.java @@ -104,8 +104,8 @@ private static void testWithToSpaceExhaustionLogs() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xmn5M", + "-Xmx32M", + "-Xmn16M", "-XX:+PrintGCDetails", GCTestWithToSpaceExhaustion.class.getName()); @@ -117,8 +117,8 @@ output.shouldHaveExitValue(0); pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xmn5M", + "-Xmx32M", + "-Xmn16M", "-XX:+PrintGCDetails", "-XX:+UnlockExperimentalVMOptions", "-XX:G1LogLevel=finest", @@ -148,7 +148,7 @@ private static byte[] garbage; private static byte[] largeObject; public static void main(String [] args) { - largeObject = new byte[5*1024*1024]; + largeObject = new byte[16*1024*1024]; System.out.println("Creating garbage"); // create 128MB of garbage. This should result in at least one GC, // some of them with to-space exhaustion. diff --git a/test/gc/g1/TestHumongousAllocInitialMark.java b/test/gc/g1/TestHumongousAllocInitialMark.java --- a/test/gc/g1/TestHumongousAllocInitialMark.java +++ b/test/gc/g1/TestHumongousAllocInitialMark.java @@ -31,7 +31,9 @@ import com.oracle.java.testlibrary.*; public class TestHumongousAllocInitialMark { - private static final int heapSize = 200; // MB + // Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to + // fulfill alignment constraints. + private static final int heapSize = 224; // MB private static final int heapRegionSize = 1; // MB private static final int initiatingHeapOccupancyPercent = 50; // % diff --git a/test/runtime/whitebox/WBStackSize.java b/test/runtime/whitebox/WBStackSize.java --- a/test/runtime/whitebox/WBStackSize.java +++ b/test/runtime/whitebox/WBStackSize.java @@ -47,7 +47,7 @@ static final long K = 1024; static final long MIN_STACK_SIZE = 8 * K; - static final long MAX_STACK_SIZE_ALLOCATED_IN_MAIN = 200 * K; // current value is about 130k on 64-bit platforms + static final long MAX_STACK_SIZE_ALLOCATED_IN_MAIN = 150 * K; // current value is about 130k on 64-bit platforms static final WhiteBox wb = WhiteBox.getWhiteBox(); @@ -82,8 +82,10 @@ public static void main(String[] args) { long configStackSize = wb.getIntxVMFlag("ThreadStackSize") * K; + System.out.println("ThreadStackSize VM option: " + configStackSize); - System.out.println("ThreadStackSize VM option: " + configStackSize); + long stackProtectionSize = wb.getIntxVMFlag("StackShadowPages") * wb.getVMPageSize(); + System.out.println("Size of protected shadow pages: " + stackProtectionSize); long actualStackSize = wb.getThreadStackSize(); System.out.println("Full stack size: " + actualStackSize); @@ -96,14 +98,16 @@ long remainingStackSize = wb.getThreadRemainingStackSize(); System.out.println("Remaining stack size in main(): " + remainingStackSize); - // Up to 200k can be already allocated by VM + // Up to 150k can be already allocated by VM and some space is used for stack protection. + long spaceAlreadyOccupied = MAX_STACK_SIZE_ALLOCATED_IN_MAIN + stackProtectionSize; + if (remainingStackSize > configStackSize - || (configStackSize > MAX_STACK_SIZE_ALLOCATED_IN_MAIN - && remainingStackSize < configStackSize - MAX_STACK_SIZE_ALLOCATED_IN_MAIN)) { + || (configStackSize > spaceAlreadyOccupied + && remainingStackSize < configStackSize - spaceAlreadyOccupied)) { throw new RuntimeException("getThreadRemainingStackSize value [" + remainingStackSize + "] should be at least ThreadStackSize value [" + configStackSize + "] minus [" - + MAX_STACK_SIZE_ALLOCATED_IN_MAIN + "]"); + + spaceAlreadyOccupied + "]"); } testStackOverflow();