1.1 --- a/src/share/vm/ci/ciMethodHandle.cpp Mon Jul 23 13:04:59 2012 -0700 1.2 +++ b/src/share/vm/ci/ciMethodHandle.cpp Tue Jul 24 10:51:00 2012 -0700 1.3 @@ -24,84 +24,18 @@ 1.4 1.5 #include "precompiled.hpp" 1.6 #include "ci/ciClassList.hpp" 1.7 -#include "ci/ciInstance.hpp" 1.8 -#include "ci/ciMethodData.hpp" 1.9 #include "ci/ciMethodHandle.hpp" 1.10 #include "ci/ciUtilities.hpp" 1.11 -#include "prims/methodHandleWalk.hpp" 1.12 -#include "prims/methodHandles.hpp" 1.13 - 1.14 -// ciMethodHandle 1.15 +#include "classfile/javaClasses.hpp" 1.16 1.17 // ------------------------------------------------------------------ 1.18 -// ciMethodHandle::get_adapter 1.19 +// ciMethodHandle::get_vmtarget 1.20 // 1.21 -// Return an adapter for this MethodHandle. 1.22 -ciMethod* ciMethodHandle::get_adapter_impl(bool is_invokedynamic) { 1.23 +// Return: MH.form -> LF.vmentry -> MN.vmtarget 1.24 +ciMethod* ciMethodHandle::get_vmtarget() const { 1.25 VM_ENTRY_MARK; 1.26 - Handle h(get_oop()); 1.27 - methodHandle callee(_callee->get_methodOop()); 1.28 - assert(callee->is_method_handle_invoke(), ""); 1.29 - oop mt1 = callee->method_handle_type(); 1.30 - oop mt2 = java_lang_invoke_MethodHandle::type(h()); 1.31 - if (!java_lang_invoke_MethodType::equals(mt1, mt2)) { 1.32 - if (PrintMiscellaneous && (Verbose || WizardMode)) { 1.33 - tty->print_cr("ciMethodHandle::get_adapter: types not equal"); 1.34 - mt1->print(); mt2->print(); 1.35 - } 1.36 - return NULL; 1.37 - } 1.38 - // We catch all exceptions here that could happen in the method 1.39 - // handle compiler and stop the VM. 1.40 - MethodHandleCompiler mhc(h, callee->name(), callee->signature(), _profile.count(), is_invokedynamic, THREAD); 1.41 - if (!HAS_PENDING_EXCEPTION) { 1.42 - methodHandle m = mhc.compile(THREAD); 1.43 - if (!HAS_PENDING_EXCEPTION) { 1.44 - return CURRENT_ENV->get_object(m())->as_method(); 1.45 - } 1.46 - } 1.47 - if (PrintMiscellaneous && (Verbose || WizardMode)) { 1.48 - tty->print("*** ciMethodHandle::get_adapter => "); 1.49 - PENDING_EXCEPTION->print(); 1.50 - tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); 1.51 - } 1.52 - CLEAR_PENDING_EXCEPTION; 1.53 - return NULL; 1.54 + oop form_oop = java_lang_invoke_MethodHandle::form(get_oop()); 1.55 + oop vmentry_oop = java_lang_invoke_LambdaForm::vmentry(form_oop); 1.56 + oop vmtarget_oop = java_lang_invoke_MemberName::vmtarget(vmentry_oop); 1.57 + return CURRENT_ENV->get_object(vmtarget_oop)->as_method(); 1.58 } 1.59 - 1.60 -// ------------------------------------------------------------------ 1.61 -// ciMethodHandle::get_adapter 1.62 -// 1.63 -// Return an adapter for this MethodHandle. 1.64 -ciMethod* ciMethodHandle::get_adapter(bool is_invokedynamic) { 1.65 - ciMethod* result = get_adapter_impl(is_invokedynamic); 1.66 - if (result) { 1.67 - // Fake up the MDO maturity. 1.68 - ciMethodData* mdo = result->method_data(); 1.69 - if (mdo != NULL && _caller->method_data() != NULL && _caller->method_data()->is_mature()) { 1.70 - mdo->set_mature(); 1.71 - } 1.72 - } 1.73 - return result; 1.74 -} 1.75 - 1.76 - 1.77 -#ifdef ASSERT 1.78 -// ------------------------------------------------------------------ 1.79 -// ciMethodHandle::print_chain_impl 1.80 -// 1.81 -// Implementation of the print method. 1.82 -void ciMethodHandle::print_chain_impl() { 1.83 - ASSERT_IN_VM; 1.84 - MethodHandleChain::print(get_oop()); 1.85 -} 1.86 - 1.87 - 1.88 -// ------------------------------------------------------------------ 1.89 -// ciMethodHandle::print_chain 1.90 -// 1.91 -// Implementation of the print_chain method. 1.92 -void ciMethodHandle::print_chain() { 1.93 - GUARDED_VM_ENTRY(print_chain_impl();); 1.94 -} 1.95 -#endif