3774 3775 3776 void TemplateTable::fast_invokevfinal(int byte_no) { 3777 transition(vtos, vtos); 3778 assert(byte_no == f2_byte, "use this argument"); 3779 __ stop("fast_invokevfinal not used on x86"); 3780 } 3781 3782 3783 void TemplateTable::invokeinterface(int byte_no) { 3784 transition(vtos, vtos); 3785 assert(byte_no == f1_byte, "use this argument"); 3786 prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 Method* 3787 rcx, rdx); // recv, flags 3788 3789 // rax: reference klass (from f1) 3790 // rbx: method (from f2) 3791 // rcx: receiver 3792 // rdx: flags 3793 3794 // Check for private method invocation - indicated by vfinal 3795 Label notVFinal; 3796 __ movl(rlocals, rdx); 3797 __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_vfinal_shift)); 3798 __ jcc(Assembler::zero, notVFinal); 3799 3800 // do the call - rbx is actually the method to call 3801 3802 __ null_check(rcx); 3803 3804 __ profile_final_call(rdx); 3805 __ profile_arguments_type(rdx, rbx, rbcp, true); 3806 3807 __ jump_from_interpreted(rbx, rdx); 3808 3809 __ bind(notVFinal); 3810 3811 // Special case of invokeinterface called for virtual method of 3812 // java.lang.Object. See cpCacheOop.cpp for details. 3813 // This code isn't produced by javac, but could be produced by 3814 // another compliant java compiler. 3815 Label notMethod; 3816 __ movl(rlocals, rdx); 3817 __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift)); 3818 3819 __ jcc(Assembler::zero, notMethod); 3820 3821 invokevirtual_helper(rbx, rcx, rdx); 3822 __ bind(notMethod); 3823 3824 // Get receiver klass into rdx - also a null check 3825 __ restore_locals(); // restore r14 3826 __ null_check(rcx, oopDesc::klass_offset_in_bytes()); 3827 __ load_klass(rdx, rcx); 3828 3829 Label no_such_interface, no_such_method; 3830 3831 // Preserve method for throw_AbstractMethodErrorVerbose. 3832 __ mov(rcx, rbx); 3833 // Receiver subtype check against REFC. 3834 // Superklass in rax. Subklass in rdx. Blows rcx, rdi. 3835 __ lookup_interface_method(// inputs: rec. class, interface, itable index 3836 rdx, rax, noreg, 3837 // outputs: scan temp. reg, scan temp. reg 3838 rbcp, rlocals, 3839 no_such_interface, 3840 /*return_method=*/false); 3841 3842 // profile this call 3843 __ restore_bcp(); // rbcp was destroyed by receiver type check 3844 __ profile_virtual_call(rdx, rbcp, rlocals); 3845 3846 // Get declaring interface class from method, and itable index 3847 __ movptr(rax, Address(rbx, Method::const_offset())); 3848 __ movptr(rax, Address(rax, ConstMethod::constants_offset())); 3849 __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes())); 3871 __ profile_called_method(rbx, rbcp, rdx); 3872 __ profile_arguments_type(rdx, rbx, rbcp, true); 3873 3874 // do the call 3875 // rcx: receiver 3876 // rbx,: Method* 3877 __ jump_from_interpreted(rbx, rdx); 3878 __ should_not_reach_here(); 3879 3880 // exception handling code follows... 3881 // note: must restore interpreter registers to canonical 3882 // state for exception handling to work correctly! 3883 3884 __ bind(no_such_method); 3885 // throw exception 3886 __ pop(rbx); // pop return address (pushed by prepare_invoke) 3887 __ restore_bcp(); // rbcp must be correct for exception handler (was destroyed) 3888 __ restore_locals(); // make sure locals pointer is correct as well (was destroyed) 3889 // Pass arguments for generating a verbose error message. 3890 #ifdef _LP64 3891 Register recvKlass = c_rarg1; 3892 Register method = c_rarg2; 3893 if (recvKlass != rdx) { __ movq(recvKlass, rdx); } 3894 if (method != rcx) { __ movq(method, rcx); } 3895 #else 3896 Register recvKlass = rdx; 3897 Register method = rcx; 3898 #endif 3899 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose), 3900 recvKlass, method); 3901 // The call_VM checks for exception, so we should never return here. 3902 __ should_not_reach_here(); 3903 3904 __ bind(no_such_interface); 3905 // throw exception 3906 __ pop(rbx); // pop return address (pushed by prepare_invoke) 3907 __ restore_bcp(); // rbcp must be correct for exception handler (was destroyed) 3908 __ restore_locals(); // make sure locals pointer is correct as well (was destroyed) 3909 // Pass arguments for generating a verbose error message. 3910 LP64_ONLY( if (recvKlass != rdx) { __ movq(recvKlass, rdx); } ) 3911 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose), 3912 recvKlass, rax); 3913 // the call_VM checks for exception, so we should never return here. 3914 __ should_not_reach_here(); 3915 } 3916 | 3774 3775 3776 void TemplateTable::fast_invokevfinal(int byte_no) { 3777 transition(vtos, vtos); 3778 assert(byte_no == f2_byte, "use this argument"); 3779 __ stop("fast_invokevfinal not used on x86"); 3780 } 3781 3782 3783 void TemplateTable::invokeinterface(int byte_no) { 3784 transition(vtos, vtos); 3785 assert(byte_no == f1_byte, "use this argument"); 3786 prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 Method* 3787 rcx, rdx); // recv, flags 3788 3789 // rax: reference klass (from f1) 3790 // rbx: method (from f2) 3791 // rcx: receiver 3792 // rdx: flags 3793 3794 Label no_such_interface; // for receiver subtype check 3795 Register recvKlass; // used for exception processing 3796 3797 // Check for private method invocation - indicated by vfinal 3798 Label notVFinal; 3799 __ movl(rlocals, rdx); 3800 __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_vfinal_shift)); 3801 __ jcc(Assembler::zero, notVFinal); 3802 3803 // Get receiver klass into rlocals - also a null check 3804 __ null_check(rcx, oopDesc::klass_offset_in_bytes()); 3805 __ load_klass(rlocals, rcx); 3806 3807 Label subtype; 3808 __ check_klass_subtype(rlocals, rax, rbcp, subtype); 3809 // If we get here the typecheck failed 3810 recvKlass = rdx; 3811 __ mov(recvKlass, rlocals); // shuffle receiver class for exception use 3812 __ jmp(no_such_interface); 3813 3814 __ bind(subtype); 3815 3816 // do the call - rbx is actually the method to call 3817 3818 __ profile_final_call(rdx); 3819 __ profile_arguments_type(rdx, rbx, rbcp, true); 3820 3821 __ jump_from_interpreted(rbx, rdx); 3822 3823 __ bind(notVFinal); 3824 3825 // Special case of invokeinterface called for virtual method of 3826 // java.lang.Object. See cpCacheOop.cpp for details. 3827 // This code isn't produced by javac, but could be produced by 3828 // another compliant java compiler. 3829 Label notMethod; 3830 __ movl(rlocals, rdx); 3831 __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift)); 3832 3833 __ jcc(Assembler::zero, notMethod); 3834 3835 invokevirtual_helper(rbx, rcx, rdx); 3836 __ bind(notMethod); 3837 3838 // Get receiver klass into rdx - also a null check 3839 __ restore_locals(); // restore r14 3840 __ null_check(rcx, oopDesc::klass_offset_in_bytes()); 3841 __ load_klass(rdx, rcx); 3842 3843 Label no_such_method; 3844 3845 // Preserve method for throw_AbstractMethodErrorVerbose. 3846 __ mov(rcx, rbx); 3847 // Receiver subtype check against REFC. 3848 // Superklass in rax. Subklass in rdx. Blows rcx, rdi. 3849 __ lookup_interface_method(// inputs: rec. class, interface, itable index 3850 rdx, rax, noreg, 3851 // outputs: scan temp. reg, scan temp. reg 3852 rbcp, rlocals, 3853 no_such_interface, 3854 /*return_method=*/false); 3855 3856 // profile this call 3857 __ restore_bcp(); // rbcp was destroyed by receiver type check 3858 __ profile_virtual_call(rdx, rbcp, rlocals); 3859 3860 // Get declaring interface class from method, and itable index 3861 __ movptr(rax, Address(rbx, Method::const_offset())); 3862 __ movptr(rax, Address(rax, ConstMethod::constants_offset())); 3863 __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes())); 3885 __ profile_called_method(rbx, rbcp, rdx); 3886 __ profile_arguments_type(rdx, rbx, rbcp, true); 3887 3888 // do the call 3889 // rcx: receiver 3890 // rbx,: Method* 3891 __ jump_from_interpreted(rbx, rdx); 3892 __ should_not_reach_here(); 3893 3894 // exception handling code follows... 3895 // note: must restore interpreter registers to canonical 3896 // state for exception handling to work correctly! 3897 3898 __ bind(no_such_method); 3899 // throw exception 3900 __ pop(rbx); // pop return address (pushed by prepare_invoke) 3901 __ restore_bcp(); // rbcp must be correct for exception handler (was destroyed) 3902 __ restore_locals(); // make sure locals pointer is correct as well (was destroyed) 3903 // Pass arguments for generating a verbose error message. 3904 #ifdef _LP64 3905 recvKlass = c_rarg1; 3906 Register method = c_rarg2; 3907 if (recvKlass != rdx) { __ movq(recvKlass, rdx); } 3908 if (method != rcx) { __ movq(method, rcx); } 3909 #else 3910 recvKlass = rdx; 3911 Register method = rcx; 3912 #endif 3913 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose), 3914 recvKlass, method); 3915 // The call_VM checks for exception, so we should never return here. 3916 __ should_not_reach_here(); 3917 3918 __ bind(no_such_interface); 3919 // throw exception 3920 __ pop(rbx); // pop return address (pushed by prepare_invoke) 3921 __ restore_bcp(); // rbcp must be correct for exception handler (was destroyed) 3922 __ restore_locals(); // make sure locals pointer is correct as well (was destroyed) 3923 // Pass arguments for generating a verbose error message. 3924 LP64_ONLY( if (recvKlass != rdx) { __ movq(recvKlass, rdx); } ) 3925 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose), 3926 recvKlass, rax); 3927 // the call_VM checks for exception, so we should never return here. 3928 __ should_not_reach_here(); 3929 } 3930 |