1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Sep 09 19:18:13 2014 +0000 1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Sep 02 12:48:45 2014 -0700 1.3 @@ -3677,6 +3677,70 @@ 1.4 return start; 1.5 } 1.6 1.7 + 1.8 + /** 1.9 + * Arguments: 1.10 + * 1.11 + * Input: 1.12 + * c_rarg0 - x address 1.13 + * c_rarg1 - x length 1.14 + * c_rarg2 - y address 1.15 + * c_rarg3 - y lenth 1.16 + * not Win64 1.17 + * c_rarg4 - z address 1.18 + * c_rarg5 - z length 1.19 + * Win64 1.20 + * rsp+40 - z address 1.21 + * rsp+48 - z length 1.22 + */ 1.23 + address generate_multiplyToLen() { 1.24 + __ align(CodeEntryAlignment); 1.25 + StubCodeMark mark(this, "StubRoutines", "multiplyToLen"); 1.26 + 1.27 + address start = __ pc(); 1.28 + // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...) 1.29 + // Unix: rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...) 1.30 + const Register x = rdi; 1.31 + const Register xlen = rax; 1.32 + const Register y = rsi; 1.33 + const Register ylen = rcx; 1.34 + const Register z = r8; 1.35 + const Register zlen = r11; 1.36 + 1.37 + // Next registers will be saved on stack in multiply_to_len(). 1.38 + const Register tmp1 = r12; 1.39 + const Register tmp2 = r13; 1.40 + const Register tmp3 = r14; 1.41 + const Register tmp4 = r15; 1.42 + const Register tmp5 = rbx; 1.43 + 1.44 + BLOCK_COMMENT("Entry:"); 1.45 + __ enter(); // required for proper stackwalking of RuntimeStub frame 1.46 + 1.47 +#ifndef _WIN64 1.48 + __ movptr(zlen, r9); // Save r9 in r11 - zlen 1.49 +#endif 1.50 + setup_arg_regs(4); // x => rdi, xlen => rsi, y => rdx 1.51 + // ylen => rcx, z => r8, zlen => r11 1.52 + // r9 and r10 may be used to save non-volatile registers 1.53 +#ifdef _WIN64 1.54 + // last 2 arguments (#4, #5) are on stack on Win64 1.55 + __ movptr(z, Address(rsp, 6 * wordSize)); 1.56 + __ movptr(zlen, Address(rsp, 7 * wordSize)); 1.57 +#endif 1.58 + 1.59 + __ movptr(xlen, rsi); 1.60 + __ movptr(y, rdx); 1.61 + __ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5); 1.62 + 1.63 + restore_arg_regs(); 1.64 + 1.65 + __ leave(); // required for proper stackwalking of RuntimeStub frame 1.66 + __ ret(0); 1.67 + 1.68 + return start; 1.69 + } 1.70 + 1.71 #undef __ 1.72 #define __ masm-> 1.73 1.74 @@ -3917,6 +3981,11 @@ 1.75 generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry, 1.76 &StubRoutines::_safefetchN_fault_pc, 1.77 &StubRoutines::_safefetchN_continuation_pc); 1.78 +#ifdef COMPILER2 1.79 + if (UseMultiplyToLenIntrinsic) { 1.80 + StubRoutines::_multiplyToLen = generate_multiplyToLen(); 1.81 + } 1.82 +#endif 1.83 } 1.84 1.85 public: