< prev index next >

## src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page

    3750                        // ylen => rcx, z => r8, zlen => r11
    3751                        // r9 and r10 may be used to save non-volatile registers
    3752 #ifdef _WIN64
    3753     // last 2 arguments (#4, #5) are on stack on Win64
    3754     __ movptr(z, Address(rsp, 6 * wordSize));
    3755     __ movptr(zlen, Address(rsp, 7 * wordSize));
    3756 #endif
    3757
    3758     __ movptr(xlen, rsi);
    3759     __ movptr(y,    rdx);
    3760     __ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5);
    3761
    3762     restore_arg_regs();
    3763
    3764     __ leave(); // required for proper stackwalking of RuntimeStub frame
    3765     __ ret(0);
    3766
    3767     return start;
    3768   }
    3769

    3770 #undef __
    3771 #define __ masm->
    3772
    3773   // Continuation point for throwing of implicit exceptions that are
    3774   // not handled in the current activation. Fabricates an exception
    3775   // oop and initiates normal exception dispatching in this
    3776   // frame. Since we need to preserve callee-saved values (currently
    3777   // only for C2, but done for C1 as well) we need a callee-saved oop
    3778   // map and therefore have to make these stubs into RuntimeStubs
    3779   // rather than BufferBlobs.  If the compiler needs all registers to
    3780   // be preserved between the fault point and the exception handler
    3781   // then it must assume responsibility for that in
    3782   // AbstractCompiler::continuation_for_implicit_null_exception or
    3783   // continuation_for_implicit_division_by_zero_exception. All other
    3784   // implicit exceptions (e.g., NullPointerException or
    3785   // AbstractMethodError on entry) are either at call sites or
    3786   // otherwise assume that stack unwinding will be initiated, so
    3787   // caller saved registers were assumed volatile in the compiler.
    3788   address generate_throw_exception(const char* name,
    3789                                    address runtime_entry,
    3994     // don't bother generating these AES intrinsic stubs unless global flag is set
    3995     if (UseAESIntrinsics) {
    3996       StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask();  // needed by the others
    3997
    3998       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
    3999       StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
    4000       StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
    4001       StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
    4002     }
    4003
    4004     // Safefetch stubs.
    4005     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
    4006                                                        &StubRoutines::_safefetch32_fault_pc,
    4007                                                        &StubRoutines::_safefetch32_continuation_pc);
    4008     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
    4009                                                        &StubRoutines::_safefetchN_fault_pc,
    4010                                                        &StubRoutines::_safefetchN_continuation_pc);
    4011 #ifdef COMPILER2
    4012     if (UseMultiplyToLenIntrinsic) {
    4013       StubRoutines::_multiplyToLen = generate_multiplyToLen();

    4014     }
    4015 #endif
    4016   }
    4017
    4018  public:
    4019   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
    4020     if (all) {
    4021       generate_all();
    4022     } else {
    4023       generate_initial();
    4024     }
    4025   }
    4026 }; // end class declaration
    4027
    4028 void StubGenerator_generate(CodeBuffer* code, bool all) {
    4029   StubGenerator g(code, all);
    4030 }
    3750                        // ylen => rcx, z => r8, zlen => r11
    3751                        // r9 and r10 may be used to save non-volatile registers
    3752 #ifdef _WIN64
    3753     // last 2 arguments (#4, #5) are on stack on Win64
    3754     __ movptr(z, Address(rsp, 6 * wordSize));
    3755     __ movptr(zlen, Address(rsp, 7 * wordSize));
    3756 #endif
    3757
    3758     __ movptr(xlen, rsi);
    3759     __ movptr(y,    rdx);
    3760     __ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5);
    3761
    3762     restore_arg_regs();
    3763
    3764     __ leave(); // required for proper stackwalking of RuntimeStub frame
    3765     __ ret(0);
    3766
    3767     return start;
    3768   }
    3769
    3770 /**
    3771    *  Arguments:
    3772    *
    3773   //  Input:
    3774   //    c_rarg0   - x address
    3775   //    c_rarg1   - x length
    3776   //    c_rarg2   - z address
    3777   //    c_rarg3   - z lenth
    3778    *
    3779    */
    3780   address generate_squareToLen() {
    3781
    3782     __ align(CodeEntryAlignment);
    3783     StubCodeMark mark(this, "StubRoutines", "squareToLen");
    3784
    3785     address start = __ pc();
    3786     // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
    3787     // Unix:  rdi, rsi, rdx, rcx (c_rarg0, c_rarg1, ...)
    3788     const Register x      = rdi;
    3789     const Register len    = rsi;
    3790     const Register z      = r8;
    3791     const Register zlen   = rcx;
    3792
    3793    const Register tmp1      = r12;
    3794    const Register tmp2      = r13;
    3795    const Register tmp3      = r14;
    3796    const Register tmp4      = r15;
    3797    const Register tmp5      = rbx;
    3798
    3799     BLOCK_COMMENT("Entry:");
    3800     __ enter(); // required for proper stackwalking of RuntimeStub frame
    3801
    3802        setup_arg_regs(4); // x => rdi, len => rsi, z => rdx
    3803                           // zlen => rcx
    3804                           // r9 and r10 may be used to save non-volatile registers
    3805     __ movptr(r8, rdx);
    3806     __ square_to_len(x, len, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5, rdx, rax);
    3807
    3808     restore_arg_regs();
    3809
    3810     __ leave(); // required for proper stackwalking of RuntimeStub frame
    3811     __ ret(0);
    3812
    3813     return start;
    3814   }
    3815
    3816    /**
    3817    *  Arguments:
    3818    *
    3819    *  Input:
    3820    *    c_rarg0   - out address
    3821    *    c_rarg1   - in address
    3822    *    c_rarg2   - offset
    3823    *    c_rarg3   - len
    3824    * not Win64
    3825    *    c_rarg4   - k
    3826    * Win64
    3827    *    rsp+40    - k
    3828    */
    3829   address generate_mulAdd() {
    3830     __ align(CodeEntryAlignment);
    3831     StubCodeMark mark(this, "StubRoutines", "mulAdd");
    3832
    3833     address start = __ pc();
    3834     // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
    3835     // Unix:  rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...)
    3836     const Register out     = rdi;
    3837     const Register in      = rsi;
    3838     const Register offset  = r11;
    3839     const Register len     = rcx;
    3840     const Register k       = r8;
    3841
    3842     // Next registers will be saved on stack in mul_add().
    3843     const Register tmp1  = r12;
    3844     const Register tmp2  = r13;
    3845     const Register tmp3  = r14;
    3846     const Register tmp4  = r15;
    3847     const Register tmp5  = rbx;
    3848
    3849     BLOCK_COMMENT("Entry:");
    3850     __ enter(); // required for proper stackwalking of RuntimeStub frame
    3851
    3852     setup_arg_regs(4); // out => rdi, in => rsi, offset => rdx
    3853                        // len => rcx, k => r8
    3854                        // r9 and r10 may be used to save non-volatile registers
    3855 #ifdef _WIN64
    3856     // last argument is on stack on Win64
    3857     __ movl(k, Address(rsp, 6 * wordSize));
    3858 #endif
    3859     __ movptr(r11, rdx);  // move offset in rdx to offset(r11)
    3860     __ mul_add(out, in, offset, len, k, tmp1, tmp2, tmp3, tmp4, tmp5, rdx, rax);
    3861
    3862     restore_arg_regs();
    3863
    3864     __ leave(); // required for proper stackwalking of RuntimeStub frame
    3865     __ ret(0);
    3866
    3867     return start;
    3868   }
    3869
    3870
    3871 #undef __
    3872 #define __ masm->
    3873
    3874   // Continuation point for throwing of implicit exceptions that are
    3875   // not handled in the current activation. Fabricates an exception
    3876   // oop and initiates normal exception dispatching in this
    3877   // frame. Since we need to preserve callee-saved values (currently
    3878   // only for C2, but done for C1 as well) we need a callee-saved oop
    3879   // map and therefore have to make these stubs into RuntimeStubs
    3880   // rather than BufferBlobs.  If the compiler needs all registers to
    3881   // be preserved between the fault point and the exception handler
    3882   // then it must assume responsibility for that in
    3883   // AbstractCompiler::continuation_for_implicit_null_exception or
    3884   // continuation_for_implicit_division_by_zero_exception. All other
    3885   // implicit exceptions (e.g., NullPointerException or
    3886   // AbstractMethodError on entry) are either at call sites or
    3887   // otherwise assume that stack unwinding will be initiated, so
    3888   // caller saved registers were assumed volatile in the compiler.
    3889   address generate_throw_exception(const char* name,
    3890                                    address runtime_entry,
    4095     // don't bother generating these AES intrinsic stubs unless global flag is set
    4096     if (UseAESIntrinsics) {
    4097       StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask();  // needed by the others
    4098
    4099       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
    4100       StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
    4101       StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
    4102       StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
    4103     }
    4104
    4105     // Safefetch stubs.
    4106     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
    4107                                                        &StubRoutines::_safefetch32_fault_pc,
    4108                                                        &StubRoutines::_safefetch32_continuation_pc);
    4109     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
    4110                                                        &StubRoutines::_safefetchN_fault_pc,
    4111                                                        &StubRoutines::_safefetchN_continuation_pc);
    4112 #ifdef COMPILER2
    4113     if (UseMultiplyToLenIntrinsic) {
    4114       StubRoutines::_multiplyToLen = generate_multiplyToLen();
    4115     }
    4116     if (UseSquareToLenIntrinsic) {
    4117       StubRoutines::_squareToLen = generate_squareToLen();
    4118     }
    4119     if (UseMulAddIntrinsic) {
    4120       StubRoutines::_mulAdd = generate_mulAdd();
    4121     }
    4122 #endif
    4123   }
    4124
    4125  public:
    4126   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
    4127     if (all) {
    4128       generate_all();
    4129     } else {
    4130       generate_initial();
    4131     }
    4132   }
    4133 }; // end class declaration
    4134
    4135 void StubGenerator_generate(CodeBuffer* code, bool all) {
    4136   StubGenerator g(code, all);
    4137 }

< prev index next >