< prev index next >

test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java

Print this page




  59 
  60         // Wait until ServiceThread cleans ResolvedMethod table
  61         int cnt = 0;
  62         while (true) {
  63           if (cnt++ % 30 == 0) {
  64             System.gc();  // make mh unused
  65           }
  66           removedCount = wb.resolvedMethodRemovedCount();
  67           if (removedCountOrig != removedCount) {
  68             break;
  69           }
  70           Thread.sleep(100);
  71         }
  72       }
  73     }
  74 
  75     public static void test(String gc, boolean doConcurrent) throws Throwable {
  76         // Run this Leak class with logging
  77         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  78                                       "-Xlog:membername+table=trace",

  79                                       "-XX:+UnlockDiagnosticVMOptions",
  80                                       "-XX:+WhiteBoxAPI",
  81                                       "-Xbootclasspath/a:.",
  82                                       doConcurrent ? "-XX:+ExplicitGCInvokesConcurrent" : "-XX:-ExplicitGCInvokesConcurrent",
  83                                       "-XX:+ClassUnloading",
  84                                       "-XX:+ClassUnloadingWithConcurrentMark",
  85                                       gc, Leak.class.getName());
  86         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  87         output.shouldContain("ResolvedMethod entry added for MemberNameLeak$Leak.callMe()V");
  88         output.shouldContain("ResolvedMethod entry found for MemberNameLeak$Leak.callMe()V");
  89         output.shouldContain("ResolvedMethod entry removed");
  90         output.shouldHaveExitValue(0);
  91     }
  92 
  93     public static void main(java.lang.String[] unused) throws Throwable {
  94         test("-XX:+UseG1GC", false);
  95         test("-XX:+UseG1GC", true);
  96 
  97         test("-XX:+UseParallelGC", false);
  98         test("-XX:+UseSerialGC", false);
  99         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
 100             test("-XX:+UseConcMarkSweepGC", false);
 101             test("-XX:+UseConcMarkSweepGC", true);


 102         }
 103     }
 104 }


  59 
  60         // Wait until ServiceThread cleans ResolvedMethod table
  61         int cnt = 0;
  62         while (true) {
  63           if (cnt++ % 30 == 0) {
  64             System.gc();  // make mh unused
  65           }
  66           removedCount = wb.resolvedMethodRemovedCount();
  67           if (removedCountOrig != removedCount) {
  68             break;
  69           }
  70           Thread.sleep(100);
  71         }
  72       }
  73     }
  74 
  75     public static void test(String gc, boolean doConcurrent) throws Throwable {
  76         // Run this Leak class with logging
  77         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  78                                       "-Xlog:membername+table=trace",
  79                                       "-XX:+UnlockExperimentalVMOptions",
  80                                       "-XX:+UnlockDiagnosticVMOptions",
  81                                       "-XX:+WhiteBoxAPI",
  82                                       "-Xbootclasspath/a:.",
  83                                       doConcurrent ? "-XX:+ExplicitGCInvokesConcurrent" : "-XX:-ExplicitGCInvokesConcurrent",
  84                                       "-XX:+ClassUnloading",
  85                                       "-XX:+ClassUnloadingWithConcurrentMark",
  86                                       gc, Leak.class.getName());
  87         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  88         output.shouldContain("ResolvedMethod entry added for MemberNameLeak$Leak.callMe()V");
  89         output.shouldContain("ResolvedMethod entry found for MemberNameLeak$Leak.callMe()V");
  90         output.shouldContain("ResolvedMethod entry removed");
  91         output.shouldHaveExitValue(0);
  92     }
  93 
  94     public static void main(java.lang.String[] unused) throws Throwable {
  95         test("-XX:+UseG1GC", false);
  96         test("-XX:+UseG1GC", true);
  97 
  98         test("-XX:+UseParallelGC", false);
  99         test("-XX:+UseSerialGC", false);
 100         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
 101             test("-XX:+UseConcMarkSweepGC", false);
 102             test("-XX:+UseConcMarkSweepGC", true);
 103             test("-XX:+UseShenandoahGC", true);
 104             test("-XX:+UseShenandoahGC", false);
 105         }
 106     }
 107 }
< prev index next >