src/share/vm/c1/c1_LIRGenerator.cpp

changeset 3848
e2fe93124108
parent 3846
8b0a4867acf0
child 3969
1d7922586cf6
equal deleted inserted replaced
3847:5e990493719e 3848:e2fe93124108
2805 2805
2806 // Get CallSite offset from constant pool cache pointer. 2806 // Get CallSite offset from constant pool cache pointer.
2807 int index = bcs.get_method_index(); 2807 int index = bcs.get_method_index();
2808 size_t call_site_offset = cpcache->get_f1_offset(index); 2808 size_t call_site_offset = cpcache->get_f1_offset(index);
2809 2809
2810 // Load CallSite object from constant pool cache.
2811 LIR_Opr call_site = new_register(objectType);
2812 __ oop2reg(cpcache->constant_encoding(), call_site);
2813 __ move_wide(new LIR_Address(call_site, call_site_offset, T_OBJECT), call_site);
2814
2810 // If this invokedynamic call site hasn't been executed yet in 2815 // If this invokedynamic call site hasn't been executed yet in
2811 // the interpreter, the CallSite object in the constant pool 2816 // the interpreter, the CallSite object in the constant pool
2812 // cache is still null and we need to deoptimize. 2817 // cache is still null and we need to deoptimize.
2813 if (cpcache->is_f1_null_at(index)) { 2818 if (cpcache->is_f1_null_at(index)) {
2814 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so 2819 // Only deoptimize if the CallSite object is still null; we don't
2815 // clone all handlers. This is handled transparently in other 2820 // recompile methods in C1 after deoptimization so this call site
2816 // places by the CodeEmitInfo cloning logic but is handled 2821 // might be resolved the next time we execute it after OSR.
2817 // specially here because a stub isn't being used.
2818 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
2819
2820 DeoptimizeStub* deopt_stub = new DeoptimizeStub(deopt_info); 2822 DeoptimizeStub* deopt_stub = new DeoptimizeStub(deopt_info);
2821 __ jump(deopt_stub); 2823 __ cmp(lir_cond_equal, call_site, LIR_OprFact::oopConst(NULL));
2824 __ branch(lir_cond_equal, T_OBJECT, deopt_stub);
2822 } 2825 }
2823 2826
2824 // Use the receiver register for the synthetic MethodHandle 2827 // Use the receiver register for the synthetic MethodHandle
2825 // argument. 2828 // argument.
2826 receiver = LIR_Assembler::receiverOpr(); 2829 receiver = LIR_Assembler::receiverOpr();
2827 LIR_Opr tmp = new_register(objectType);
2828
2829 // Load CallSite object from constant pool cache.
2830 __ oop2reg(cpcache->constant_encoding(), tmp);
2831 __ move_wide(new LIR_Address(tmp, call_site_offset, T_OBJECT), tmp);
2832 2830
2833 // Load target MethodHandle from CallSite object. 2831 // Load target MethodHandle from CallSite object.
2834 __ load(new LIR_Address(tmp, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver); 2832 __ load(new LIR_Address(call_site, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
2835 2833
2836 __ call_dynamic(target, receiver, result_register, 2834 __ call_dynamic(target, receiver, result_register,
2837 SharedRuntime::get_resolve_opt_virtual_call_stub(), 2835 SharedRuntime::get_resolve_opt_virtual_call_stub(),
2838 arg_list, info); 2836 arg_list, info);
2839 break; 2837 break;
2840 } 2838 }
2841 default: 2839 default:
2842 ShouldNotReachHere(); 2840 fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(x->code())));
2843 break; 2841 break;
2844 } 2842 }
2845 2843
2846 // JSR 292 2844 // JSR 292
2847 // Restore the SP after MethodHandle call sites. 2845 // Restore the SP after MethodHandle call sites.

mercurial