8210300: runtime/MemberName/MemberNameLeak.java fails with RuntimeException

Added flag -XX:+UnlockDiagnosticVMOptions to tests failing in product builds

Reviewed-by: dcubed, dholmes
This commit is contained in:
Patricio Chilano Mateo 2018-09-11 13:34:13 -04:00
parent fe326ad022
commit 891765ee5e
2 changed files with 24 additions and 9 deletions

View File

@ -45,6 +45,7 @@ public class CleanProtectionDomain {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-Xlog:protectiondomain+table=debug",
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-Xbootclasspath/a:.",
Test.class.getName());
@ -70,13 +71,20 @@ public class CleanProtectionDomain {
test();
System.gc();
// Wait until ServiceThread cleans ProtectionDomain table.
// When the TestClassLoader is unloaded by GC, at least one
// ProtectionDomainCacheEntry will be eligible for removal.
do {
removedCount = wb.protectionDomainRemovedCount();
} while (removedCountOrig == removedCount);
int cnt = 0;
while (true) {
if (cnt++ % 30 == 0) {
System.gc();
}
removedCount = wb.resolvedMethodRemovedCount();
if (removedCountOrig != removedCount) {
break;
}
Thread.sleep(100);
}
}
private static class TestClassLoader extends ClassLoader {

View File

@ -56,19 +56,26 @@ public class MemberNameLeak {
mh.invokeExact(leak);
}
System.gc(); // make mh unused
// Wait until ServiceThread cleans ResolvedMethod table
do {
int cnt = 0;
while (true) {
if (cnt++ % 30 == 0) {
System.gc(); // make mh unused
}
removedCount = wb.resolvedMethodRemovedCount();
} while (removedCountOrig == removedCount);
if (removedCountOrig != removedCount) {
break;
}
Thread.sleep(100);
}
}
}
public static void test(String gc) throws Throwable {
// Run this Leak class with logging
// Run this Leak class with logging
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-Xlog:membername+table=trace",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-Xbootclasspath/a:.",
gc, Leak.class.getName());