< prev index next >

src/cpu/x86/vm/templateInterpreter_x86_64.cpp

Print this page




 787     __ movl(len, Address(rsp, wordSize)); // Length
 788 
 789     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
 790     // result in rax
 791 
 792     // _areturn
 793     __ pop(rdi);                // get return address
 794     __ mov(rsp, r13);           // set sp to sender sp
 795     __ jmp(rdi);
 796 
 797     // generate a vanilla native entry as the slow path
 798     __ bind(slow_path);
 799 
 800     (void) generate_native_entry(false);
 801 
 802     return entry;
 803   }
 804   return generate_native_entry(false);
 805 }
 806 



















































 807 // Interpreter stub for calling a native method. (asm interpreter)
 808 // This sets up a somewhat different looking stack for calling the
 809 // native method than the typical interpreter frame setup.
 810 address InterpreterGenerator::generate_native_entry(bool synchronized) {
 811   // determine code generation flags
 812   bool inc_counter  = UseCompiler || CountCompiledCalls;
 813 
 814   // rbx: Method*
 815   // r13: sender sp
 816 
 817   address entry_point = __ pc();
 818 
 819   const Address constMethod       (rbx, Method::const_offset());
 820   const Address access_flags      (rbx, Method::access_flags_offset());
 821   const Address size_of_parameters(rcx, ConstMethod::
 822                                         size_of_parameters_offset());
 823 
 824 
 825   // get parameter size (always needed)
 826   __ movptr(rcx, constMethod);




 787     __ movl(len, Address(rsp, wordSize)); // Length
 788 
 789     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
 790     // result in rax
 791 
 792     // _areturn
 793     __ pop(rdi);                // get return address
 794     __ mov(rsp, r13);           // set sp to sender sp
 795     __ jmp(rdi);
 796 
 797     // generate a vanilla native entry as the slow path
 798     __ bind(slow_path);
 799 
 800     (void) generate_native_entry(false);
 801 
 802     return entry;
 803   }
 804   return generate_native_entry(false);
 805 }
 806 
 807 /**
 808 * Method entry for static native methods:
 809 *   int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end)
 810 *   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
 811 */
 812 address InterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
 813   if (UseCRC32CIntrinsics) {
 814     address entry = __ pc();
 815     // Load parameters
 816     const Register crc = c_rarg0;  // crc
 817     const Register buf = c_rarg1;  // source java byte array address
 818     const Register len = c_rarg2;
 819     const Register off = c_rarg3;  // offset
 820     const Register end = len;
 821 
 822     // Arguments are reversed on java expression stack
 823     // Calculate address of start element
 824     if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
 825       __ movptr(buf, Address(rsp, 3 * wordSize)); // long buf
 826       __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
 827       __ addq(buf, off); // + offset
 828       __ movl(crc, Address(rsp, 5 * wordSize)); // Initial CRC
 829       // Note on 5 * wordSize vs. 4 * wordSize:
 830       // *   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
 831       //                                                   4         2,3          1        0
 832       // end starts at SP + 8
 833       // The JavaŽ Virtual Machine Specification Java SE 7 Edition
 834       // 4.10.2.3. Values of Types long and double
 835       //    "When calculating operand stack length, values of type long and double have length two."
 836     } else {
 837       __ movptr(buf, Address(rsp, 3 * wordSize)); // byte[] array
 838       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 839       __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
 840       __ addq(buf, off); // + offset
 841       __ movl(crc, Address(rsp, 4 * wordSize)); // Initial CRC
 842     }
 843     __ movl(end, Address(rsp, wordSize)); // end
 844     __ subl(end, off); // end - off
 845     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len);
 846     // result in rax
 847     // _areturn
 848     __ pop(rdi);                // get return address
 849     __ mov(rsp, r13);           // set sp to sender sp
 850     __ jmp(rdi);
 851 
 852     return entry;
 853   }
 854 
 855   return generate_native_entry(false);
 856 }
 857 
 858 // Interpreter stub for calling a native method. (asm interpreter)
 859 // This sets up a somewhat different looking stack for calling the
 860 // native method than the typical interpreter frame setup.
 861 address InterpreterGenerator::generate_native_entry(bool synchronized) {
 862   // determine code generation flags
 863   bool inc_counter  = UseCompiler || CountCompiledCalls;
 864 
 865   // rbx: Method*
 866   // r13: sender sp
 867 
 868   address entry_point = __ pc();
 869 
 870   const Address constMethod       (rbx, Method::const_offset());
 871   const Address access_flags      (rbx, Method::access_flags_offset());
 872   const Address size_of_parameters(rcx, ConstMethod::
 873                                         size_of_parameters_offset());
 874 
 875 
 876   // get parameter size (always needed)
 877   __ movptr(rcx, constMethod);


< prev index next >