diff src/share/vm/interpreter/rewriter.cpp @ 1574:1eb493f33423

6957080: MethodComparator needs stress testing Summary: Add a stress-test flag for running MethodComparator over many inputs. Fix bugs that crop up. Reviewed-by: kvn
author jrose
date Sat, 29 May 2010 19:22:32 -0700
parents ab102d5d923e
children e9ff18c4ace7
line wrap: on
line diff
--- a/src/share/vm/interpreter/rewriter.cpp	Fri May 28 16:23:51 2010 -0700
+++ b/src/share/vm/interpreter/rewriter.cpp	Sat May 29 19:22:32 2010 -0700
@@ -307,5 +307,19 @@
 
     // Set up method entry points for compiler and interpreter.
     m->link_method(m, CHECK);
+
+#ifdef ASSERT
+    if (StressMethodComparator) {
+      static int nmc = 0;
+      for (int j = i; j >= 0 && j >= i-4; j--) {
+        if ((++nmc % 1000) == 0)  tty->print_cr("Have run MethodComparator %d times...", nmc);
+        bool z = MethodComparator::methods_EMCP(m(), (methodOop)_methods->obj_at(j));
+        if (j == i && !z) {
+          tty->print("MethodComparator FAIL: "); m->print(); m->print_codes();
+          assert(z, "method must compare equal to itself");
+        }
+      }
+    }
+#endif //ASSERT
   }
 }