< prev index next >
test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java
Print this page
rev 52404 : imported patch 8213307-rmt-cleanup
@@ -21,12 +21,13 @@
* questions.
*/
/*
* @test
- * @bug 8174749
+ * @bug 8174749 8213307
* @summary MemberNameTable should reuse entries
+ * @requires vm.gc == "null"
* @library /test/lib
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MemberNameLeak
*/
@@ -56,11 +57,11 @@
mh.invokeExact(leak);
}
// Wait until ServiceThread cleans ResolvedMethod table
int cnt = 0;
- while (true) {
+ for (int i = 0; i < 5; i++) {
if (cnt++ % 30 == 0) {
System.gc(); // make mh unused
}
removedCount = wb.resolvedMethodRemovedCount();
if (removedCountOrig != removedCount) {
@@ -69,29 +70,34 @@
Thread.sleep(100);
}
}
}
- public static void test(String gc) throws Throwable {
+ public static void test(String gc, boolean doConcurrent) throws Throwable {
// Run this Leak class with logging
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-Xlog:membername+table=trace",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-Xbootclasspath/a:.",
+ doConcurrent ? "-XX:+ExplicitGCInvokesConcurrent" : "-XX:-ExplicitGCInvokesConcurrent",
+ "-XX:+ClassUnloadingWithConcurrentMark",
gc, Leak.class.getName());
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("ResolvedMethod entry added for MemberNameLeak$Leak.callMe()V");
output.shouldContain("ResolvedMethod entry found for MemberNameLeak$Leak.callMe()V");
output.shouldContain("ResolvedMethod entry removed");
output.shouldHaveExitValue(0);
}
public static void main(java.lang.String[] unused) throws Throwable {
- test("-XX:+UseG1GC");
- test("-XX:+UseParallelGC");
- test("-XX:+UseSerialGC");
+ test("-XX:+UseG1GC", false);
+ test("-XX:+UseG1GC", true);
+
+ test("-XX:+UseParallelGC", false);
+ test("-XX:+UseSerialGC", false);
if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
- test("-XX:+UseConcMarkSweepGC");
+ test("-XX:+UseConcMarkSweepGC", false);
+ test("-XX:+UseConcMarkSweepGC", true);
}
}
}
< prev index next >