diff src/share/vm/ci/ciMethodHandle.cpp @ 3785:ddd894528dbc

7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path Reviewed-by: never
author jrose
date Thu, 23 Jun 2011 17:14:06 -0700
parents f918d6096e23
children c26de9aef2ed
line wrap: on
line diff
--- a/src/share/vm/ci/ciMethodHandle.cpp	Wed Jun 22 14:45:37 2011 -0700
+++ b/src/share/vm/ci/ciMethodHandle.cpp	Thu Jun 23 17:14:06 2011 -0700
@@ -41,6 +41,16 @@
   VM_ENTRY_MARK;
   Handle h(get_oop());
   methodHandle callee(_callee->get_methodOop());
+  assert(callee->is_method_handle_invoke(), "");
+  oop mt1 = callee->method_handle_type();
+  oop mt2 = java_lang_invoke_MethodHandle::type(h());
+  if (!java_lang_invoke_MethodType::equals(mt1, mt2)) {
+    if (PrintMiscellaneous && (Verbose || WizardMode)) {
+      tty->print_cr("ciMethodHandle::get_adapter: types not equal");
+      mt1->print(); mt2->print();
+    }
+    return NULL;
+  }
   // We catch all exceptions here that could happen in the method
   // handle compiler and stop the VM.
   MethodHandleCompiler mhc(h, callee->name(), callee->signature(), _profile.count(), is_invokedynamic, THREAD);
@@ -53,7 +63,7 @@
   if (PrintMiscellaneous && (Verbose || WizardMode)) {
     tty->print("*** ciMethodHandle::get_adapter => ");
     PENDING_EXCEPTION->print();
-    tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); //@@
+    tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print();
   }
   CLEAR_PENDING_EXCEPTION;
   return NULL;