< prev index next >

src/cpu/x86/vm/templateInterpreter_x86_32.cpp

Print this page




 792     // rbx,: Method*
 793     // rsi: senderSP must preserved for slow path, set SP to it on fast path
 794     // rdx: scratch
 795     // rdi: scratch
 796 
 797     Label slow_path;
 798     // If we need a safepoint check, generate full interpreter entry.
 799     ExternalAddress state(SafepointSynchronize::address_of_state());
 800     __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
 801              SafepointSynchronize::_not_synchronized);
 802     __ jcc(Assembler::notEqual, slow_path);
 803 
 804     // We don't generate local frame and don't align stack because
 805     // we call stub code and there is no safepoint on this path.
 806 
 807     // Load parameters
 808     const Register crc = rax;  // crc
 809     const Register buf = rdx;  // source java byte array address
 810     const Register len = rdi;  // length
 811 







 812     // Arguments are reversed on java expression stack
 813     __ movl(len,   Address(rsp,   wordSize)); // Length
 814     // Calculate address of start element
 815     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
 816       __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
 817       __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
 818       __ movl(crc,   Address(rsp, 5*wordSize)); // Initial CRC
 819     } else {
 820       __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
 821       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 822       __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
 823       __ movl(crc,   Address(rsp, 4*wordSize)); // Initial CRC
 824     }
 825 
 826     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
 827     // result in rax
 828 
 829     // _areturn
 830     __ pop(rdi);                // get return address
 831     __ mov(rsp, rsi);           // set sp to sender sp
 832     __ jmp(rdi);
 833 
 834     // generate a vanilla native entry as the slow path
 835     __ bind(slow_path);
 836 
 837     (void) generate_native_entry(false);















































 838 
 839     return entry;
 840   }
 841   return generate_native_entry(false);
 842 }
 843 
 844 //
 845 // Interpreter stub for calling a native method. (asm interpreter)
 846 // This sets up a somewhat different looking stack for calling the native method
 847 // than the typical interpreter frame setup.
 848 //
 849 
 850 address InterpreterGenerator::generate_native_entry(bool synchronized) {
 851   // determine code generation flags
 852   bool inc_counter  = UseCompiler || CountCompiledCalls;
 853 
 854   // rbx,: Method*
 855   // rsi: sender sp
 856   // rsi: previous interpreter state (C++ interpreter) must preserve
 857   address entry_point = __ pc();




 792     // rbx,: Method*
 793     // rsi: senderSP must preserved for slow path, set SP to it on fast path
 794     // rdx: scratch
 795     // rdi: scratch
 796 
 797     Label slow_path;
 798     // If we need a safepoint check, generate full interpreter entry.
 799     ExternalAddress state(SafepointSynchronize::address_of_state());
 800     __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
 801              SafepointSynchronize::_not_synchronized);
 802     __ jcc(Assembler::notEqual, slow_path);
 803 
 804     // We don't generate local frame and don't align stack because
 805     // we call stub code and there is no safepoint on this path.
 806 
 807     // Load parameters
 808     const Register crc = rax;  // crc
 809     const Register buf = rdx;  // source java byte array address
 810     const Register len = rdi;  // length
 811 
 812     // value              x86_32
 813     // interp. arg ptr    ESP + 4
 814     // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
 815     //                                         3           2      1        0
 816     // int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
 817     //                                              4         2,3      1        0
 818 
 819     // Arguments are reversed on java expression stack
 820     __ movl(len,   Address(rsp,   4 + 0)); // Length
 821     // Calculate address of start element
 822     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
 823       __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long buf
 824       __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
 825       __ movl(crc,   Address(rsp, 4 + 4 * wordSize)); // Initial CRC
 826     } else {
 827       __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array
 828       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 829       __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
 830       __ movl(crc,   Address(rsp, 4 + 3 * wordSize)); // Initial CRC
 831     }
 832 
 833     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
 834     // result in rax
 835 
 836     // _areturn
 837     __ pop(rdi);                // get return address
 838     __ mov(rsp, rsi);           // set sp to sender sp
 839     __ jmp(rdi);
 840 
 841     // generate a vanilla native entry as the slow path
 842     __ bind(slow_path);
 843 
 844     (void) generate_native_entry(false);
 845 
 846     return entry;
 847   }
 848   return generate_native_entry(false);
 849 }
 850 
 851 /**
 852 * Method entry for static native methods:
 853 *   int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end)
 854 *   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
 855 */
 856 address InterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
 857   if (UseCRC32CIntrinsics) {
 858     address entry = __ pc();
 859     // Load parameters
 860     const Register crc = rax;  // crc
 861     const Register buf = rcx;  // source java byte array address
 862     const Register len = rdx;  // length
 863     const Register end = len;
 864 
 865     // value              x86_32
 866     // interp. arg ptr    ESP + 4
 867     // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int end)
 868     //                                         3           2      1        0
 869     // int java.util.zip.CRC32.updateByteBuffer(int crc, long address, int off, int end)
 870     //                                              4         2,3          1        0
 871 
 872     // Arguments are reversed on java expression stack
 873     __ movl(end, Address(rsp, 4 + 0)); // end
 874     __ subl(len, Address(rsp, 4 + 1 * wordSize));  // end - offset == length
 875     // Calculate address of start element
 876     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
 877       __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long address
 878       __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
 879       __ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC
 880     } else {
 881       __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array
 882       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 883       __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
 884       __ movl(crc, Address(rsp, 4 + 3 * wordSize)); // Initial CRC
 885     }
 886     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len);
 887     // result in rax
 888     // _areturn
 889     __ pop(rdi);                // get return address
 890     __ mov(rsp, rsi);           // set sp to sender sp
 891     __ jmp(rdi);
 892 
 893     return entry;
 894   }
 895   return generate_native_entry(false);
 896 }
 897 
 898 //
 899 // Interpreter stub for calling a native method. (asm interpreter)
 900 // This sets up a somewhat different looking stack for calling the native method
 901 // than the typical interpreter frame setup.
 902 //
 903 
 904 address InterpreterGenerator::generate_native_entry(bool synchronized) {
 905   // determine code generation flags
 906   bool inc_counter  = UseCompiler || CountCompiledCalls;
 907 
 908   // rbx,: Method*
 909   // rsi: sender sp
 910   // rsi: previous interpreter state (C++ interpreter) must preserve
 911   address entry_point = __ pc();


< prev index next >