7009600: JSR 292 Server compiler crashes in Compile::find_intrinsic(ciMethod*, bool)

Catch errors during the compile-time processing of method handles; back out cleanly

Reviewed-by: twisti
This commit is contained in:
John R Rose 2011-04-07 17:12:23 -07:00
parent b95f04efbf
commit f8fe3457a5
2 changed files with 21 additions and 7 deletions

View file

@ -42,9 +42,20 @@ ciMethod* ciMethodHandle::get_adapter(bool is_invokedynamic) const {
methodHandle callee(_callee->get_methodOop());
// We catch all exceptions here that could happen in the method
// handle compiler and stop the VM.
MethodHandleCompiler mhc(h, callee, is_invokedynamic, CATCH);
methodHandle m = mhc.compile(CATCH);
return CURRENT_ENV->get_object(m())->as_method();
MethodHandleCompiler mhc(h, callee, is_invokedynamic, THREAD);
if (!HAS_PENDING_EXCEPTION) {
methodHandle m = mhc.compile(THREAD);
if (!HAS_PENDING_EXCEPTION) {
return CURRENT_ENV->get_object(m())->as_method();
}
}
if (PrintMiscellaneous && (Verbose || WizardMode)) {
tty->print("*** ciMethodHandle::get_adapter => ");
PENDING_EXCEPTION->print();
tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); //@@
}
CLEAR_PENDING_EXCEPTION;
return NULL;
}