hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
changeset 19329 eccb1e520c66
parent 18507 61bfc8995bb3
child 19335 ad762bd4ff48
equal deleted inserted replaced
19283:4df251ee863c 19329:eccb1e520c66
   847 address InterpreterGenerator::generate_CRC32_update_entry() {
   847 address InterpreterGenerator::generate_CRC32_update_entry() {
   848   if (UseCRC32Intrinsics) {
   848   if (UseCRC32Intrinsics) {
   849     address entry = __ pc();
   849     address entry = __ pc();
   850 
   850 
   851     // rbx,: Method*
   851     // rbx,: Method*
   852     // rsi: senderSP must preserved for slow path, set SP to it on fast path
   852     // r13: senderSP must preserved for slow path, set SP to it on fast path
   853     // rdx: scratch
   853     // c_rarg0: scratch (rdi on non-Win64, rcx on Win64)
   854     // rdi: scratch
   854     // c_rarg1: scratch (rsi on non-Win64, rdx on Win64)
   855 
   855 
   856     Label slow_path;
   856     Label slow_path;
   857     // If we need a safepoint check, generate full interpreter entry.
   857     // If we need a safepoint check, generate full interpreter entry.
   858     ExternalAddress state(SafepointSynchronize::address_of_state());
   858     ExternalAddress state(SafepointSynchronize::address_of_state());
   859     __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
   859     __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
   863     // We don't generate local frame and don't align stack because
   863     // We don't generate local frame and don't align stack because
   864     // we call stub code and there is no safepoint on this path.
   864     // we call stub code and there is no safepoint on this path.
   865 
   865 
   866     // Load parameters
   866     // Load parameters
   867     const Register crc = rax;  // crc
   867     const Register crc = rax;  // crc
   868     const Register val = rdx;  // source java byte value
   868     const Register val = c_rarg0;  // source java byte value
   869     const Register tbl = rdi;  // scratch
   869     const Register tbl = c_rarg1;  // scratch
   870 
   870 
   871     // Arguments are reversed on java expression stack
   871     // Arguments are reversed on java expression stack
   872     __ movl(val, Address(rsp,   wordSize)); // byte value
   872     __ movl(val, Address(rsp,   wordSize)); // byte value
   873     __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
   873     __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
   874 
   874 
   878     __ notl(crc); // ~crc
   878     __ notl(crc); // ~crc
   879     // result in rax
   879     // result in rax
   880 
   880 
   881     // _areturn
   881     // _areturn
   882     __ pop(rdi);                // get return address
   882     __ pop(rdi);                // get return address
   883     __ mov(rsp, rsi);           // set sp to sender sp
   883     __ mov(rsp, r13);           // set sp to sender sp
   884     __ jmp(rdi);
   884     __ jmp(rdi);
   885 
   885 
   886     // generate a vanilla native entry as the slow path
   886     // generate a vanilla native entry as the slow path
   887     __ bind(slow_path);
   887     __ bind(slow_path);
   888 
   888 
   917 
   917 
   918     // Load parameters
   918     // Load parameters
   919     const Register crc = c_rarg0;  // crc
   919     const Register crc = c_rarg0;  // crc
   920     const Register buf = c_rarg1;  // source java byte array address
   920     const Register buf = c_rarg1;  // source java byte array address
   921     const Register len = c_rarg2;  // length
   921     const Register len = c_rarg2;  // length
       
   922     const Register off = len;      // offset (never overlaps with 'len')
   922 
   923 
   923     // Arguments are reversed on java expression stack
   924     // Arguments are reversed on java expression stack
   924     __ movl(len,   Address(rsp,   wordSize)); // Length
       
   925     // Calculate address of start element
   925     // Calculate address of start element
   926     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
   926     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
   927       __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
   927       __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
   928       __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
   928       __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
       
   929       __ addq(buf, off); // + offset
   929       __ movl(crc,   Address(rsp, 5*wordSize)); // Initial CRC
   930       __ movl(crc,   Address(rsp, 5*wordSize)); // Initial CRC
   930     } else {
   931     } else {
   931       __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
   932       __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
   932       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
   933       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
   933       __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
   934       __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
       
   935       __ addq(buf, off); // + offset
   934       __ movl(crc,   Address(rsp, 4*wordSize)); // Initial CRC
   936       __ movl(crc,   Address(rsp, 4*wordSize)); // Initial CRC
   935     }
   937     }
       
   938     // Can now load 'len' since we're finished with 'off'
       
   939     __ movl(len, Address(rsp, wordSize)); // Length
   936 
   940 
   937     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
   941     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
   938     // result in rax
   942     // result in rax
   939 
   943 
   940     // _areturn
   944     // _areturn