6957080: MethodComparator needs stress testing

Add a stress-test flag for running MethodComparator over many inputs.  Fix bugs that crop up.

Reviewed-by: kvn
This commit is contained in:
John R Rose 2010-05-29 19:22:32 -07:00
parent 49cbc41c82
commit be95b163a6
5 changed files with 40 additions and 15 deletions

View file

@ -307,5 +307,19 @@ Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, objArray
// 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
}
}