39 // Return an adapter for this MethodHandle. |
39 // Return an adapter for this MethodHandle. |
40 ciMethod* ciMethodHandle::get_adapter_impl(bool is_invokedynamic) const { |
40 ciMethod* ciMethodHandle::get_adapter_impl(bool is_invokedynamic) const { |
41 VM_ENTRY_MARK; |
41 VM_ENTRY_MARK; |
42 Handle h(get_oop()); |
42 Handle h(get_oop()); |
43 methodHandle callee(_callee->get_methodOop()); |
43 methodHandle callee(_callee->get_methodOop()); |
|
44 assert(callee->is_method_handle_invoke(), ""); |
|
45 oop mt1 = callee->method_handle_type(); |
|
46 oop mt2 = java_lang_invoke_MethodHandle::type(h()); |
|
47 if (!java_lang_invoke_MethodType::equals(mt1, mt2)) { |
|
48 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
|
49 tty->print_cr("ciMethodHandle::get_adapter: types not equal"); |
|
50 mt1->print(); mt2->print(); |
|
51 } |
|
52 return NULL; |
|
53 } |
44 // We catch all exceptions here that could happen in the method |
54 // We catch all exceptions here that could happen in the method |
45 // handle compiler and stop the VM. |
55 // handle compiler and stop the VM. |
46 MethodHandleCompiler mhc(h, callee->name(), callee->signature(), _profile.count(), is_invokedynamic, THREAD); |
56 MethodHandleCompiler mhc(h, callee->name(), callee->signature(), _profile.count(), is_invokedynamic, THREAD); |
47 if (!HAS_PENDING_EXCEPTION) { |
57 if (!HAS_PENDING_EXCEPTION) { |
48 methodHandle m = mhc.compile(THREAD); |
58 methodHandle m = mhc.compile(THREAD); |
51 } |
61 } |
52 } |
62 } |
53 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
63 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
54 tty->print("*** ciMethodHandle::get_adapter => "); |
64 tty->print("*** ciMethodHandle::get_adapter => "); |
55 PENDING_EXCEPTION->print(); |
65 PENDING_EXCEPTION->print(); |
56 tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); //@@ |
66 tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); |
57 } |
67 } |
58 CLEAR_PENDING_EXCEPTION; |
68 CLEAR_PENDING_EXCEPTION; |
59 return NULL; |
69 return NULL; |
60 } |
70 } |
61 |
71 |