test/compiler/whitebox/AllocationCodeBlobTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff test/compiler/whitebox/AllocationCodeBlobTest.java

test/compiler/whitebox/AllocationCodeBlobTest.java

Print this page
rev 7349 : 8064669: compiler/whitebox/AllocationCodeBlobTest.java crashes / asserts
Reviewed-by:

*** 27,40 **** import java.util.ArrayList; import sun.hotspot.WhiteBox; import sun.hotspot.code.BlobType; import com.oracle.java.testlibrary.Asserts; /* * @test AllocationCodeBlobTest ! * @bug 8059624 * @library /testlibrary /testlibrary/whitebox * @build AllocationCodeBlobTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions --- 27,41 ---- import java.util.ArrayList; import sun.hotspot.WhiteBox; import sun.hotspot.code.BlobType; import com.oracle.java.testlibrary.Asserts; + import com.oracle.java.testlibrary.InfiniteLoop; /* * @test AllocationCodeBlobTest ! * @bug 8059624 8064669 * @library /testlibrary /testlibrary/whitebox * @build AllocationCodeBlobTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
*** 51,65 **** = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize"); private static final int SIZE = 1; public static void main(String[] args) { // check that Sweeper handels dummy blobs correctly ! new ForcedSweeper(500).start(); EnumSet<BlobType> blobTypes = BlobType.getAvailable(); for (BlobType type : blobTypes) { new AllocationCodeBlobTest(type).test(); } } private final BlobType type; private final MemoryPoolMXBean bean; private AllocationCodeBlobTest(BlobType type) { --- 52,87 ---- = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize"); private static final int SIZE = 1; public static void main(String[] args) { // check that Sweeper handels dummy blobs correctly ! Thread t = new Thread( ! new InfiniteLoop(WHITE_BOX::forceNMethodSweep, 1L), ! "ForcedSweeper"); ! t.setDaemon(true); ! System.out.println("Starting " + t.getName()); ! t.start(); ! EnumSet<BlobType> blobTypes = BlobType.getAvailable(); for (BlobType type : blobTypes) { new AllocationCodeBlobTest(type).test(); } + + // check that deoptimization works well w/ dummy blobs + t = new Thread( + new InfiniteLoop(WHITE_BOX::deoptimizeAll, 1L), + "Deoptimize Thread"); + t.setDaemon(true); + System.out.println("Starting " + t.getName()); + t.start(); + + for (int i = 0; i < 10_000; ++i) { + for (BlobType type : blobTypes) { + long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id); + } + } + } private final BlobType type; private final MemoryPoolMXBean bean; private AllocationCodeBlobTest(BlobType type) {
*** 103,128 **** } private long getUsage() { return bean.getUsage().getUsed(); } - - private static class ForcedSweeper extends Thread { - private final int millis; - public ForcedSweeper(int millis) { - super("ForcedSweeper"); - setDaemon(true); - this.millis = millis; - } - public void run() { - try { - while (true) { - WHITE_BOX.forceNMethodSweep(); - Thread.sleep(millis); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Error(e); - } - } - } } --- 125,130 ----
test/compiler/whitebox/AllocationCodeBlobTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File