773 // rbx,: Method* 774 // rsi: senderSP must preserved for slow path, set SP to it on fast path 775 // rdx: scratch 776 // rdi: scratch 777 778 Label slow_path; 779 // If we need a safepoint check, generate full interpreter entry. 780 ExternalAddress state(SafepointSynchronize::address_of_state()); 781 __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), 782 SafepointSynchronize::_not_synchronized); 783 __ jcc(Assembler::notEqual, slow_path); 784 785 // We don't generate local frame and don't align stack because 786 // we call stub code and there is no safepoint on this path. 787 788 // Load parameters 789 const Register crc = rax; // crc 790 const Register buf = rdx; // source java byte array address 791 const Register len = rdi; // length 792 793 // Arguments are reversed on java expression stack 794 __ movl(len, Address(rsp, wordSize)); // Length 795 // Calculate address of start element 796 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { 797 __ movptr(buf, Address(rsp, 3*wordSize)); // long buf 798 __ addptr(buf, Address(rsp, 2*wordSize)); // + offset 799 __ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC 800 } else { 801 __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array 802 __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size 803 __ addptr(buf, Address(rsp, 2*wordSize)); // + offset 804 __ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC 805 } 806 807 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len); 808 // result in rax 809 810 // _areturn 811 __ pop(rdi); // get return address 812 __ mov(rsp, rsi); // set sp to sender sp 813 __ jmp(rdi); 814 815 // generate a vanilla native entry as the slow path 816 __ bind(slow_path); 817 818 (void) generate_native_entry(false); 819 820 return entry; 821 } 822 return generate_native_entry(false); 823 } 824 825 /** 826 * Method entry for static native method: 827 * java.lang.Float.intBitsToFloat(int bits) 828 */ 829 address InterpreterGenerator::generate_Float_intBitsToFloat_entry() { 830 address entry; 831 832 if (UseSSE >= 1) { 833 entry = __ pc(); 834 835 // rsi: the sender's SP 836 837 // Skip safepoint check (compiler intrinsic versions of this method 838 // do not perform safepoint checks either). | 773 // rbx,: Method* 774 // rsi: senderSP must preserved for slow path, set SP to it on fast path 775 // rdx: scratch 776 // rdi: scratch 777 778 Label slow_path; 779 // If we need a safepoint check, generate full interpreter entry. 780 ExternalAddress state(SafepointSynchronize::address_of_state()); 781 __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), 782 SafepointSynchronize::_not_synchronized); 783 __ jcc(Assembler::notEqual, slow_path); 784 785 // We don't generate local frame and don't align stack because 786 // we call stub code and there is no safepoint on this path. 787 788 // Load parameters 789 const Register crc = rax; // crc 790 const Register buf = rdx; // source java byte array address 791 const Register len = rdi; // length 792 793 // value x86_32 794 // interp. arg ptr ESP + 4 795 // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len) 796 // 3 2 1 0 797 // int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) 798 // 4 2,3 1 0 799 800 // Arguments are reversed on java expression stack 801 __ movl(len, Address(rsp, 4 + 0)); // Length 802 // Calculate address of start element 803 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { 804 __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long buf 805 __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset 806 __ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC 807 } else { 808 __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array 809 __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size 810 __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset 811 __ movl(crc, Address(rsp, 4 + 3 * wordSize)); // Initial CRC 812 } 813 814 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len); 815 // result in rax 816 817 // _areturn 818 __ pop(rdi); // get return address 819 __ mov(rsp, rsi); // set sp to sender sp 820 __ jmp(rdi); 821 822 // generate a vanilla native entry as the slow path 823 __ bind(slow_path); 824 825 (void) generate_native_entry(false); 826 827 return entry; 828 } 829 return generate_native_entry(false); 830 } 831 832 /** 833 * Method entry for static native methods: 834 * int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end) 835 * int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end) 836 */ 837 address InterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { 838 if (UseCRC32CIntrinsics) { 839 address entry = __ pc(); 840 // Load parameters 841 const Register crc = rax; // crc 842 const Register buf = rcx; // source java byte array address 843 const Register len = rdx; // length 844 const Register end = len; 845 846 // value x86_32 847 // interp. arg ptr ESP + 4 848 // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int end) 849 // 3 2 1 0 850 // int java.util.zip.CRC32.updateByteBuffer(int crc, long address, int off, int end) 851 // 4 2,3 1 0 852 853 // Arguments are reversed on java expression stack 854 __ movl(end, Address(rsp, 4 + 0)); // end 855 __ subl(len, Address(rsp, 4 + 1 * wordSize)); // end - offset == length 856 // Calculate address of start element 857 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { 858 __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long address 859 __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset 860 __ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC 861 } else { 862 __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array 863 __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size 864 __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset 865 __ movl(crc, Address(rsp, 4 + 3 * wordSize)); // Initial CRC 866 } 867 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len); 868 // result in rax 869 // _areturn 870 __ pop(rdi); // get return address 871 __ mov(rsp, rsi); // set sp to sender sp 872 __ jmp(rdi); 873 874 return entry; 875 } 876 return generate_native_entry(false); 877 } 878 879 /** 880 * Method entry for static native method: 881 * java.lang.Float.intBitsToFloat(int bits) 882 */ 883 address InterpreterGenerator::generate_Float_intBitsToFloat_entry() { 884 address entry; 885 886 if (UseSSE >= 1) { 887 entry = __ pc(); 888 889 // rsi: the sender's SP 890 891 // Skip safepoint check (compiler intrinsic versions of this method 892 // do not perform safepoint checks either). |