2112 __ trigfunc('s'); 2113 __ ret(0); 2114 } 2115 { 2116 StubCodeMark mark(this, "StubRoutines", "cos"); 2117 StubRoutines::_intrinsic_cos = (double (*)(double)) __ pc(); 2118 2119 __ fld_d(Address(rsp, 4)); 2120 __ trigfunc('c'); 2121 __ ret(0); 2122 } 2123 { 2124 StubCodeMark mark(this, "StubRoutines", "tan"); 2125 StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc(); 2126 2127 __ fld_d(Address(rsp, 4)); 2128 __ trigfunc('t'); 2129 __ ret(0); 2130 } 2131 { 2132 StubCodeMark mark(this, "StubRoutines", "exp"); 2133 StubRoutines::_intrinsic_exp = (double (*)(double)) __ pc(); 2134 2135 __ fld_d(Address(rsp, 4)); 2136 __ exp_with_fallback(0); 2137 __ ret(0); 2138 } 2139 { 2140 StubCodeMark mark(this, "StubRoutines", "pow"); 2141 StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc(); 2142 2143 __ fld_d(Address(rsp, 12)); 2144 __ fld_d(Address(rsp, 4)); 2145 __ pow_with_fallback(0); 2146 __ ret(0); 2147 } 2148 } 2149 2150 // AES intrinsic stubs 2151 enum {AESBlockSize = 16}; 2152 2153 address generate_key_shuffle_mask() { 2154 __ align(16); 2155 StubCodeMark mark(this, "StubRoutines", "key_shuffle_mask"); 2156 address start = __ pc(); 2157 __ emit_data(0x00010203, relocInfo::none, 0 ); 2158 __ emit_data(0x04050607, relocInfo::none, 0 ); 2159 __ emit_data(0x08090a0b, relocInfo::none, 0 ); 2926 Address buf_arg(rbp, 8 + 4); 2927 Address len_arg(rbp, 8 + 8); 2928 2929 // Load up: 2930 __ movl(crc, crc_arg); 2931 __ movptr(buf, buf_arg); 2932 __ movl(len, len_arg); 2933 2934 __ kernel_crc32(crc, buf, len, table, tmp); 2935 2936 __ movl(rax, crc); 2937 __ pop(rbx); 2938 __ pop(rdi); 2939 __ pop(rsi); 2940 __ leave(); // required for proper stackwalking of RuntimeStub frame 2941 __ ret(0); 2942 2943 return start; 2944 } 2945 2946 // Safefetch stubs. 2947 void generate_safefetch(const char* name, int size, address* entry, 2948 address* fault_pc, address* continuation_pc) { 2949 // safefetch signatures: 2950 // int SafeFetch32(int* adr, int errValue); 2951 // intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue); 2952 2953 StubCodeMark mark(this, "StubRoutines", name); 2954 2955 // Entry point, pc or function descriptor. 2956 *entry = __ pc(); 2957 2958 __ movl(rax, Address(rsp, 0x8)); 2959 __ movl(rcx, Address(rsp, 0x4)); 2960 // Load *adr into eax, may fault. 2961 *fault_pc = __ pc(); 2962 switch (size) { 2963 case 4: 2964 // int32_t 2965 __ movl(rax, Address(rcx, 0)); 3138 StubRoutines::_handler_for_unsafe_access_entry = 3139 generate_handler_for_unsafe_access(); 3140 3141 // platform dependent 3142 create_control_words(); 3143 3144 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); 3145 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); 3146 StubRoutines::_d2i_wrapper = generate_d2i_wrapper(T_INT, 3147 CAST_FROM_FN_PTR(address, SharedRuntime::d2i)); 3148 StubRoutines::_d2l_wrapper = generate_d2i_wrapper(T_LONG, 3149 CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); 3150 3151 // Build this early so it's available for the interpreter 3152 StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError)); 3153 3154 if (UseCRC32Intrinsics) { 3155 // set table address before stub generation which use it 3156 StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table; 3157 StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32(); 3158 } 3159 } 3160 3161 3162 void generate_all() { 3163 // Generates all stubs and initializes the entry points 3164 3165 // These entry points require SharedInfo::stack0 to be set up in non-core builds 3166 // and need to be relocatable, so they each fabricate a RuntimeStub internally. 3167 StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError)); 3168 StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError)); 3169 StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call)); 3170 3171 //------------------------------------------------------------------------------------------------------------------------ 3172 // entry points that are platform specific 3173 3174 // support for verify_oop (must happen after universe_init) 3175 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); 3176 3177 // arraycopy stubs used by compilers | 2112 __ trigfunc('s'); 2113 __ ret(0); 2114 } 2115 { 2116 StubCodeMark mark(this, "StubRoutines", "cos"); 2117 StubRoutines::_intrinsic_cos = (double (*)(double)) __ pc(); 2118 2119 __ fld_d(Address(rsp, 4)); 2120 __ trigfunc('c'); 2121 __ ret(0); 2122 } 2123 { 2124 StubCodeMark mark(this, "StubRoutines", "tan"); 2125 StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc(); 2126 2127 __ fld_d(Address(rsp, 4)); 2128 __ trigfunc('t'); 2129 __ ret(0); 2130 } 2131 { 2132 StubCodeMark mark(this, "StubRoutines", "pow"); 2133 StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc(); 2134 2135 __ fld_d(Address(rsp, 12)); 2136 __ fld_d(Address(rsp, 4)); 2137 __ pow_with_fallback(0); 2138 __ ret(0); 2139 } 2140 } 2141 2142 // AES intrinsic stubs 2143 enum {AESBlockSize = 16}; 2144 2145 address generate_key_shuffle_mask() { 2146 __ align(16); 2147 StubCodeMark mark(this, "StubRoutines", "key_shuffle_mask"); 2148 address start = __ pc(); 2149 __ emit_data(0x00010203, relocInfo::none, 0 ); 2150 __ emit_data(0x04050607, relocInfo::none, 0 ); 2151 __ emit_data(0x08090a0b, relocInfo::none, 0 ); 2918 Address buf_arg(rbp, 8 + 4); 2919 Address len_arg(rbp, 8 + 8); 2920 2921 // Load up: 2922 __ movl(crc, crc_arg); 2923 __ movptr(buf, buf_arg); 2924 __ movl(len, len_arg); 2925 2926 __ kernel_crc32(crc, buf, len, table, tmp); 2927 2928 __ movl(rax, crc); 2929 __ pop(rbx); 2930 __ pop(rdi); 2931 __ pop(rsi); 2932 __ leave(); // required for proper stackwalking of RuntimeStub frame 2933 __ ret(0); 2934 2935 return start; 2936 } 2937 2938 address generate_libmExp() { 2939 address start = __ pc(); 2940 2941 const XMMRegister x0 = xmm0; 2942 const XMMRegister x1 = xmm1; 2943 const XMMRegister x2 = xmm2; 2944 const XMMRegister x3 = xmm3; 2945 2946 const XMMRegister x4 = xmm4; 2947 const XMMRegister x5 = xmm5; 2948 const XMMRegister x6 = xmm6; 2949 const XMMRegister x7 = xmm7; 2950 2951 const Register tmp = rbx; 2952 2953 BLOCK_COMMENT("Entry:"); 2954 __ enter(); // required for proper stackwalking of RuntimeStub frame 2955 __ fast_exp(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp); 2956 __ leave(); // required for proper stackwalking of RuntimeStub frame 2957 __ ret(0); 2958 2959 return start; 2960 2961 } 2962 2963 2964 // Safefetch stubs. 2965 void generate_safefetch(const char* name, int size, address* entry, 2966 address* fault_pc, address* continuation_pc) { 2967 // safefetch signatures: 2968 // int SafeFetch32(int* adr, int errValue); 2969 // intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue); 2970 2971 StubCodeMark mark(this, "StubRoutines", name); 2972 2973 // Entry point, pc or function descriptor. 2974 *entry = __ pc(); 2975 2976 __ movl(rax, Address(rsp, 0x8)); 2977 __ movl(rcx, Address(rsp, 0x4)); 2978 // Load *adr into eax, may fault. 2979 *fault_pc = __ pc(); 2980 switch (size) { 2981 case 4: 2982 // int32_t 2983 __ movl(rax, Address(rcx, 0)); 3156 StubRoutines::_handler_for_unsafe_access_entry = 3157 generate_handler_for_unsafe_access(); 3158 3159 // platform dependent 3160 create_control_words(); 3161 3162 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); 3163 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); 3164 StubRoutines::_d2i_wrapper = generate_d2i_wrapper(T_INT, 3165 CAST_FROM_FN_PTR(address, SharedRuntime::d2i)); 3166 StubRoutines::_d2l_wrapper = generate_d2i_wrapper(T_LONG, 3167 CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); 3168 3169 // Build this early so it's available for the interpreter 3170 StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError)); 3171 3172 if (UseCRC32Intrinsics) { 3173 // set table address before stub generation which use it 3174 StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table; 3175 StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32(); 3176 } 3177 if (VM_Version::supports_sse2()) { 3178 StubRoutines::_dexp = generate_libmExp(); 3179 } 3180 } 3181 3182 3183 void generate_all() { 3184 // Generates all stubs and initializes the entry points 3185 3186 // These entry points require SharedInfo::stack0 to be set up in non-core builds 3187 // and need to be relocatable, so they each fabricate a RuntimeStub internally. 3188 StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError)); 3189 StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError)); 3190 StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call)); 3191 3192 //------------------------------------------------------------------------------------------------------------------------ 3193 // entry points that are platform specific 3194 3195 // support for verify_oop (must happen after universe_init) 3196 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); 3197 3198 // arraycopy stubs used by compilers |