--- old/test/jdk/jfr/event/compiler/TestCodeCacheConfig.java 2019-08-16 11:54:26.135740412 +0800 +++ new/test/jdk/jfr/event/compiler/TestCodeCacheConfig.java 2019-08-16 11:54:25.996735568 +0800 @@ -44,10 +44,10 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache jdk.jfr.event.compiler.TestCodeCacheConfig + * jdk.jfr.event.compiler.TestCodeCacheConfig * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-SegmentedCodeCache jdk.jfr.event.compiler.TestCodeCacheConfig + * jdk.jfr.event.compiler.TestCodeCacheConfig * @summary check "Code Cache Configuration" jfr event */ public class TestCodeCacheConfig { --- old/test/jdk/jfr/event/compiler/TestCodeCacheFull.java 2019-08-16 11:54:26.539754490 +0800 +++ new/test/jdk/jfr/event/compiler/TestCodeCacheFull.java 2019-08-16 11:54:26.402749716 +0800 @@ -39,18 +39,17 @@ * @test TestCodeCacheFull * * - * @library /lib / + * @library /lib * - * jdk.management.jfr * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+SegmentedCodeCache -XX:-UseLargePages jdk.jfr.event.compiler.TestCodeCacheFull + * -XX:-UseLargePages jdk.jfr.event.compiler.TestCodeCacheFull * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-SegmentedCodeCache jdk.jfr.event.compiler.TestCodeCacheFull + * jdk.jfr.event.compiler.TestCodeCacheFull */ public class TestCodeCacheFull { @@ -85,7 +84,7 @@ private static BlobType blobTypeFromName(String codeBlobTypeName) throws Exception { for (BlobType t : BlobType.getAvailable()) { - if (t.beanName.equals(codeBlobTypeName)) { + if (t.name.equals(codeBlobTypeName)) { return t; } } --- old/test/jdk/jfr/event/compiler/TestCodeSweeper.java 2019-08-16 11:54:26.940768464 +0800 +++ new/test/jdk/jfr/event/compiler/TestCodeSweeper.java 2019-08-16 11:54:26.802763655 +0800 @@ -59,7 +59,7 @@ * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:-SegmentedCodeCache -XX:+WhiteBoxAPI jdk.jfr.event.compiler.TestCodeSweeper + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI jdk.jfr.event.compiler.TestCodeSweeper */ public class TestCodeSweeper { @@ -159,15 +159,12 @@ // Trigger the vm/code_cache/full event by compiling one more // method. This also triggers the vm/compiler/failure event. - Asserts.assertTrue(WHITE_BOX.addCompilerDirective(directive) == 1); - try { - if (!WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_FULL_OPTIMIZATION)) { - WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_SIMPLE); - } - } finally { - WHITE_BOX.removeCompilerDirective(1); + if (!WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_FULL_OPTIMIZATION)) { + WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_SIMPLE); } + Thread.sleep(5000); + // Free memory for (Long blob : blobs) { WHITE_BOX.freeCodeBlob(blob); --- old/test/jdk/jfr/event/gc/heapsummary/HeapSummaryEventAllGcs.java 2019-08-16 11:54:27.347782647 +0800 +++ new/test/jdk/jfr/event/gc/heapsummary/HeapSummaryEventAllGcs.java 2019-08-16 11:54:27.210777873 +0800 @@ -41,6 +41,7 @@ Recording recording = new Recording(); recording.enable(EventNames.GCConfiguration); recording.enable(EventNames.GCHeapSummary); + recording.enable(EventNames.G1HeapSummary); recording.enable(EventNames.PSHeapSummary); recording.enable(EventNames.MetaspaceSummary).withThreshold(Duration.ofMillis(0)); @@ -62,6 +63,7 @@ Asserts.assertEquals(events.size() % 2, 0, "Events should come in pairs"); int lastHeapGcId = -1; + int lastG1GcId = -1; int lastPSGcId = -1; int lastMetaspaceGcId = -1; @@ -72,6 +74,10 @@ lastHeapGcId = checkGcId(event, lastHeapGcId); checkHeapEventContent(event); break; + case EventNames.G1HeapSummary: + lastG1GcId = checkGcId(event, lastG1GcId); + checkG1EventContent(event); + break; case EventNames.PSHeapSummary: lastPSGcId = checkGcId(event, lastPSGcId); checkPSEventContent(event); @@ -127,6 +133,14 @@ Asserts.assertLessThanOrEqual(heapUsed, committedEnd- start, "used can not exceed size"); } + private static void checkG1EventContent(RecordedEvent event) { + long edenUsedSize = Events.assertField(event, "edenUsedSize").atLeast(0L).getValue(); + long edenTotalSize = Events.assertField(event, "edenTotalSize").atLeast(0L).getValue(); + Asserts.assertLessThanOrEqual(edenUsedSize, edenTotalSize, "used can not exceed size"); + Events.assertField(event, "survivorUsedSize").atLeast(0L); + Events.assertField(event, "numberOfRegions").atLeast(0); + } + private static void checkPSEventContent(RecordedEvent event) { checkVirtualSpace(event, "oldSpace"); checkVirtualSpace(event, "youngSpace"); --- old/test/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java 2019-08-16 11:54:27.758796969 +0800 +++ new/test/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java 2019-08-16 11:54:27.618792091 +0800 @@ -43,7 +43,7 @@ * * @library /lib / * - * @run main/othervm jdk.jfr.event.runtime.TestBiasedLockRevocationEvents + * @run main/othervm -XX:BiasedLockingStartupDelay=0 jdk.jfr.event.runtime.TestBiasedLockRevocationEvents */ public class TestBiasedLockRevocationEvents { --- old/test/lib/sun/hotspot/WhiteBox.java 2019-08-16 11:54:28.164811118 +0800 +++ new/test/lib/sun/hotspot/WhiteBox.java 2019-08-16 11:54:28.028806378 +0800 @@ -31,6 +31,7 @@ import java.util.function.Function; import java.security.BasicPermission; import java.util.Objects; +import java.net.URL; import sun.hotspot.parser.DiagnosticCommand; @@ -72,12 +73,7 @@ public native void printHeapSizes(); // Memory - private native long getObjectAddress0(Object o); - public long getObjectAddress(Object o) { - Objects.requireNonNull(o); - return getObjectAddress0(o); - } - + public native long getObjectAddress(Object o); public native int getHeapOopSize(); public native int getVMPageSize(); public native long getVMAllocationGranularity(); @@ -85,17 +81,12 @@ public native long getHeapSpaceAlignment(); public native long getHeapAlignment(); - private native boolean isObjectInOldGen0(Object o); - public boolean isObjectInOldGen(Object o) { - Objects.requireNonNull(o); - return isObjectInOldGen0(o); - } + public native boolean isObjectInOldGen(Object o); + public native long getObjectSize(Object o); - private native long getObjectSize0(Object o); - public long getObjectSize(Object o) { - Objects.requireNonNull(o); - return getObjectSize0(o); - } + public native boolean classKnownToNotExist(ClassLoader loader, String name); + public native URL[] getLookupCacheURLs(ClassLoader loader); + public native int[] getLookupCacheMatches(ClassLoader loader, String name); // Runtime // Make sure class name is in the correct format @@ -104,11 +95,7 @@ } private native boolean isClassAlive0(String name); - private native boolean isMonitorInflated0(Object obj); - public boolean isMonitorInflated(Object obj) { - Objects.requireNonNull(obj); - return isMonitorInflated0(obj); - } + public native boolean isMonitorInflated(Object obj); public native void forceSafepoint(); @@ -141,52 +128,19 @@ } // JVMTI - private native void addToBootstrapClassLoaderSearch0(String segment); - public void addToBootstrapClassLoaderSearch(String segment){ - Objects.requireNonNull(segment); - addToBootstrapClassLoaderSearch0(segment); - } - - private native void addToSystemClassLoaderSearch0(String segment); - public void addToSystemClassLoaderSearch(String segment) { - Objects.requireNonNull(segment); - addToSystemClassLoaderSearch0(segment); - } + public native void addToBootstrapClassLoaderSearch(String segment); + public native void addToSystemClassLoaderSearch(String segment); // G1 public native boolean g1InConcurrentMark(); - private native boolean g1IsHumongous0(Object o); - public boolean g1IsHumongous(Object o) { - Objects.requireNonNull(o); - return g1IsHumongous0(o); - } - - private native boolean g1BelongsToHumongousRegion0(long adr); - public boolean g1BelongsToHumongousRegion(long adr) { - if (adr == 0) { - throw new IllegalArgumentException("adr argument should not be null"); - } - return g1BelongsToHumongousRegion0(adr); - } - - - private native boolean g1BelongsToFreeRegion0(long adr); - public boolean g1BelongsToFreeRegion(long adr) { - if (adr == 0) { - throw new IllegalArgumentException("adr argument should not be null"); - } - return g1BelongsToFreeRegion0(adr); - } - + public native boolean g1IsHumongous(Object o); + public native boolean g1BelongsToHumongousRegion(long adr); + public native boolean g1BelongsToFreeRegion(long adr); public native long g1NumMaxRegions(); public native long g1NumFreeRegions(); public native int g1RegionSize(); public native MemoryUsage g1AuxiliaryMemoryUsage(); - private native Object[] parseCommandLine0(String commandline, char delim, DiagnosticCommand[] args); - public Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args) { - Objects.requireNonNull(args); - return parseCommandLine0(commandline, delim, args); - } + public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args); // Parallel GC public native long psVirtualSpaceAlignment(); @@ -211,6 +165,8 @@ public native void NMTUncommitMemory(long addr, long size); public native void NMTReleaseMemory(long addr, long size); public native long NMTMallocWithPseudoStack(long size, int index); + public native long NMTMallocWithPseudoStackAndType(long size, int index, int type); + public native boolean NMTIsDetailSupported(); public native boolean NMTChangeTrackingLevel(); public native int NMTGetHashSize(); @@ -224,27 +180,17 @@ public boolean isMethodCompiled(Executable method) { return isMethodCompiled(method, false /*not osr*/); } - private native boolean isMethodCompiled0(Executable method, boolean isOsr); - public boolean isMethodCompiled(Executable method, boolean isOsr){ - Objects.requireNonNull(method); - return isMethodCompiled0(method, isOsr); - } + public native boolean isMethodCompiled(Executable method, boolean isOsr); public boolean isMethodCompilable(Executable method) { return isMethodCompilable(method, -2 /*any*/); } public boolean isMethodCompilable(Executable method, int compLevel) { return isMethodCompilable(method, compLevel, false /*not osr*/); } - private native boolean isMethodCompilable0(Executable method, int compLevel, boolean isOsr); - public boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr) { - Objects.requireNonNull(method); - return isMethodCompilable0(method, compLevel, isOsr); - } - private native boolean isMethodQueuedForCompilation0(Executable method); - public boolean isMethodQueuedForCompilation(Executable method) { - Objects.requireNonNull(method); - return isMethodQueuedForCompilation0(method); - } + public native boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr); + + public native boolean isMethodQueuedForCompilation(Executable method); + // Determine if the compiler corresponding to the compilation level 'compLevel' // and to the compilation context 'compilation_context' provides an intrinsic // for the method 'method'. An intrinsic is available for method 'method' if: @@ -272,74 +218,35 @@ public int deoptimizeMethod(Executable method) { return deoptimizeMethod(method, false /*not osr*/); } - private native int deoptimizeMethod0(Executable method, boolean isOsr); - public int deoptimizeMethod(Executable method, boolean isOsr) { - Objects.requireNonNull(method); - return deoptimizeMethod0(method, isOsr); - } + public native int deoptimizeMethod(Executable method, boolean isOsr); public void makeMethodNotCompilable(Executable method) { makeMethodNotCompilable(method, -2 /*any*/); } public void makeMethodNotCompilable(Executable method, int compLevel) { makeMethodNotCompilable(method, compLevel, false /*not osr*/); } - private native void makeMethodNotCompilable0(Executable method, int compLevel, boolean isOsr); - public void makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr) { - Objects.requireNonNull(method); - makeMethodNotCompilable0(method, compLevel, isOsr); - } + public native void makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr); public int getMethodCompilationLevel(Executable method) { return getMethodCompilationLevel(method, false /*not ost*/); } - private native int getMethodCompilationLevel0(Executable method, boolean isOsr); - public int getMethodCompilationLevel(Executable method, boolean isOsr) { - Objects.requireNonNull(method); - return getMethodCompilationLevel0(method, isOsr); - } - private native boolean testSetDontInlineMethod0(Executable method, boolean value); - public boolean testSetDontInlineMethod(Executable method, boolean value) { - Objects.requireNonNull(method); - return testSetDontInlineMethod0(method, value); - } + public native int getMethodCompilationLevel(Executable method, boolean isOsr); + public native boolean testSetDontInlineMethod(Executable method, boolean value); public int getCompileQueuesSize() { return getCompileQueueSize(-2 /*any*/); } public native int getCompileQueueSize(int compLevel); - private native boolean testSetForceInlineMethod0(Executable method, boolean value); - public boolean testSetForceInlineMethod(Executable method, boolean value) { - Objects.requireNonNull(method); - return testSetForceInlineMethod0(method, value); - } + public native boolean testSetForceInlineMethod(Executable method, boolean value); + public boolean enqueueMethodForCompilation(Executable method, int compLevel) { return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/); } - private native boolean enqueueMethodForCompilation0(Executable method, int compLevel, int entry_bci); - public boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci) { - Objects.requireNonNull(method); - return enqueueMethodForCompilation0(method, compLevel, entry_bci); - } - private native boolean enqueueInitializerForCompilation0(Class aClass, int compLevel); - public boolean enqueueInitializerForCompilation(Class aClass, int compLevel) { - Objects.requireNonNull(aClass); - return enqueueInitializerForCompilation0(aClass, compLevel); - } - private native void clearMethodState0(Executable method); - public void clearMethodState(Executable method) { - Objects.requireNonNull(method); - clearMethodState0(method); - } + public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); + public native boolean enqueueInitializerForCompilation(Class aClass, int compLevel); + public native void clearMethodState(Executable method); public native void lockCompilation(); public native void unlockCompilation(); - private native int getMethodEntryBci0(Executable method); - public int getMethodEntryBci(Executable method) { - Objects.requireNonNull(method); - return getMethodEntryBci0(method); - } - private native Object[] getNMethod0(Executable method, boolean isOsr); - public Object[] getNMethod(Executable method, boolean isOsr) { - Objects.requireNonNull(method); - return getNMethod0(method, isOsr); - } + public native int getMethodEntryBci(Executable method); + public native Object[] getNMethod(Executable method, boolean isOsr); public native long allocateCodeBlob(int size, int type); public long allocateCodeBlob(long size, int type) { int intSize = (int) size; --- old/test/lib/sun/hotspot/code/BlobType.java 2019-08-16 11:54:28.581825649 +0800 +++ new/test/lib/sun/hotspot/code/BlobType.java 2019-08-16 11:54:28.443820840 +0800 @@ -30,40 +30,17 @@ import sun.hotspot.WhiteBox; public enum BlobType { - // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods) - MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'", "NonProfiledCodeHeapSize") { - @Override - public boolean allowTypeWhenOverflow(BlobType type) { - return super.allowTypeWhenOverflow(type) - || type == BlobType.MethodProfiled; - } - }, - // Execution level 2 and 3 (profiled) nmethods - MethodProfiled(1, "CodeHeap 'profiled nmethods'", "ProfiledCodeHeapSize") { - @Override - public boolean allowTypeWhenOverflow(BlobType type) { - return super.allowTypeWhenOverflow(type) - || type == BlobType.MethodNonProfiled; - } - }, - // Non-nmethods like Buffers, Adapters and Runtime Stubs - NonNMethod(2, "CodeHeap 'non-nmethods'", "NonNMethodCodeHeapSize") { - @Override - public boolean allowTypeWhenOverflow(BlobType type) { - return super.allowTypeWhenOverflow(type) - || type == BlobType.MethodNonProfiled - || type == BlobType.MethodProfiled; - } - }, // All types (No code cache segmentation) - All(3, "CodeCache", "ReservedCodeCacheSize"); + All(0, "CodeCache", "Code Cache", "ReservedCodeCacheSize"); public final int id; public final String sizeOptionName; public final String beanName; + public final String name; - private BlobType(int id, String beanName, String sizeOptionName) { + private BlobType(int id, String name, String beanName, String sizeOptionName) { this.id = id; + this.name = name; this.beanName = beanName; this.sizeOptionName = sizeOptionName; } @@ -83,23 +60,7 @@ } public static EnumSet getAvailable() { - WhiteBox whiteBox = WhiteBox.getWhiteBox(); - if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) { - // only All for non segmented world - return EnumSet.of(All); - } - if (System.getProperty("java.vm.info").startsWith("interpreted ")) { - // only NonNMethod for -Xint - return EnumSet.of(NonNMethod); - } - - EnumSet result = EnumSet.complementOf(EnumSet.of(All)); - if (!whiteBox.getBooleanVMFlag("TieredCompilation") - || whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) { - // there is no MethodProfiled in non tiered world or pure C1 - result.remove(MethodProfiled); - } - return result; + return EnumSet.of(All); } public long getSize() {