src/share/vm/runtime/stubRoutines.hpp

Fri, 29 Apr 2016 00:06:10 +0800

author
aoqi
date
Fri, 29 Apr 2016 00:06:10 +0800
changeset 1
2d8a650513c2
parent 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added MIPS 64-bit port.

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@1 25 /*
aoqi@1 26 * This file has been modified by Loongson Technology in 2015. These
aoqi@1 27 * modifications are Copyright (c) 2015 Loongson Technology, and are made
aoqi@1 28 * available on the same license terms set forth above.
aoqi@1 29 */
aoqi@1 30
aoqi@0 31 #ifndef SHARE_VM_RUNTIME_STUBROUTINES_HPP
aoqi@0 32 #define SHARE_VM_RUNTIME_STUBROUTINES_HPP
aoqi@0 33
aoqi@0 34 #include "code/codeBlob.hpp"
aoqi@0 35 #include "memory/allocation.hpp"
aoqi@0 36 #include "runtime/frame.hpp"
aoqi@0 37 #include "runtime/mutexLocker.hpp"
aoqi@0 38 #include "runtime/stubCodeGenerator.hpp"
aoqi@0 39 #include "utilities/top.hpp"
aoqi@0 40 #ifdef TARGET_ARCH_x86
aoqi@0 41 # include "nativeInst_x86.hpp"
aoqi@0 42 #endif
aoqi@0 43 #ifdef TARGET_ARCH_sparc
aoqi@0 44 # include "nativeInst_sparc.hpp"
aoqi@0 45 #endif
aoqi@0 46 #ifdef TARGET_ARCH_zero
aoqi@0 47 # include "nativeInst_zero.hpp"
aoqi@0 48 #endif
aoqi@0 49 #ifdef TARGET_ARCH_arm
aoqi@0 50 # include "nativeInst_arm.hpp"
aoqi@0 51 #endif
aoqi@0 52 #ifdef TARGET_ARCH_ppc
aoqi@0 53 # include "nativeInst_ppc.hpp"
aoqi@0 54 #endif
aoqi@1 55 #ifdef TARGET_ARCH_mips
aoqi@1 56 # include "nativeInst_mips.hpp"
aoqi@1 57 #endif
aoqi@0 58
aoqi@0 59 // StubRoutines provides entry points to assembly routines used by
aoqi@0 60 // compiled code and the run-time system. Platform-specific entry
aoqi@0 61 // points are defined in the platform-specific inner class.
aoqi@0 62 //
aoqi@0 63 // Class scheme:
aoqi@0 64 //
aoqi@0 65 // platform-independent platform-dependent
aoqi@0 66 //
aoqi@0 67 // stubRoutines.hpp <-- included -- stubRoutines_<arch>.hpp
aoqi@0 68 // ^ ^
aoqi@0 69 // | |
aoqi@0 70 // implements implements
aoqi@0 71 // | |
aoqi@0 72 // | |
aoqi@0 73 // stubRoutines.cpp stubRoutines_<arch>.cpp
aoqi@0 74 // stubRoutines_<os_family>.cpp stubGenerator_<arch>.cpp
aoqi@0 75 // stubRoutines_<os_arch>.cpp
aoqi@0 76 //
aoqi@0 77 // Note 1: The important thing is a clean decoupling between stub
aoqi@0 78 // entry points (interfacing to the whole vm; i.e., 1-to-n
aoqi@0 79 // relationship) and stub generators (interfacing only to
aoqi@0 80 // the entry points implementation; i.e., 1-to-1 relationship).
aoqi@0 81 // This significantly simplifies changes in the generator
aoqi@0 82 // structure since the rest of the vm is not affected.
aoqi@0 83 //
aoqi@0 84 // Note 2: stubGenerator_<arch>.cpp contains a minimal portion of
aoqi@0 85 // machine-independent code; namely the generator calls of
aoqi@0 86 // the generator functions that are used platform-independently.
aoqi@0 87 // However, it comes with the advantage of having a 1-file
aoqi@0 88 // implementation of the generator. It should be fairly easy
aoqi@0 89 // to change, should it become a problem later.
aoqi@0 90 //
aoqi@0 91 // Scheme for adding a new entry point:
aoqi@0 92 //
aoqi@0 93 // 1. determine if it's a platform-dependent or independent entry point
aoqi@0 94 // a) if platform independent: make subsequent changes in the independent files
aoqi@0 95 // b) if platform dependent: make subsequent changes in the dependent files
aoqi@0 96 // 2. add a private instance variable holding the entry point address
aoqi@0 97 // 3. add a public accessor function to the instance variable
aoqi@0 98 // 4. implement the corresponding generator function in the platform-dependent
aoqi@0 99 // stubGenerator_<arch>.cpp file and call the function in generate_all() of that file
aoqi@0 100
aoqi@0 101
aoqi@0 102 class StubRoutines: AllStatic {
aoqi@0 103
aoqi@0 104 public:
aoqi@0 105 enum platform_independent_constants {
aoqi@0 106 max_size_of_parameters = 256 // max. parameter size supported by megamorphic lookups
aoqi@0 107 };
aoqi@0 108
aoqi@0 109 // Dependencies
aoqi@0 110 friend class StubGenerator;
aoqi@0 111 #ifdef TARGET_ARCH_MODEL_x86_32
aoqi@0 112 # include "stubRoutines_x86_32.hpp"
aoqi@0 113 #endif
aoqi@0 114 #ifdef TARGET_ARCH_MODEL_x86_64
aoqi@0 115 # include "stubRoutines_x86_64.hpp"
aoqi@0 116 #endif
aoqi@1 117 #ifdef TARGET_ARCH_MODEL_mips_64
aoqi@1 118 # include "stubRoutines_mips_64.hpp"
aoqi@1 119 #endif
aoqi@0 120 #ifdef TARGET_ARCH_MODEL_sparc
aoqi@0 121 # include "stubRoutines_sparc.hpp"
aoqi@0 122 #endif
aoqi@0 123 #ifdef TARGET_ARCH_MODEL_zero
aoqi@0 124 # include "stubRoutines_zero.hpp"
aoqi@0 125 #endif
aoqi@0 126 #ifdef TARGET_ARCH_MODEL_arm
aoqi@0 127 # include "stubRoutines_arm.hpp"
aoqi@0 128 #endif
aoqi@0 129 #ifdef TARGET_ARCH_MODEL_ppc_32
aoqi@0 130 # include "stubRoutines_ppc_32.hpp"
aoqi@0 131 #endif
aoqi@0 132 #ifdef TARGET_ARCH_MODEL_ppc_64
aoqi@0 133 # include "stubRoutines_ppc_64.hpp"
aoqi@0 134 #endif
aoqi@0 135
aoqi@0 136
aoqi@0 137 static jint _verify_oop_count;
aoqi@0 138 static address _verify_oop_subroutine_entry;
aoqi@0 139
aoqi@0 140 static address _call_stub_return_address; // the return PC, when returning to a call stub
aoqi@0 141 static address _call_stub_entry;
aoqi@0 142 static address _forward_exception_entry;
aoqi@0 143 static address _catch_exception_entry;
aoqi@0 144 static address _throw_AbstractMethodError_entry;
aoqi@0 145 static address _throw_IncompatibleClassChangeError_entry;
aoqi@0 146 static address _throw_NullPointerException_at_call_entry;
aoqi@0 147 static address _throw_StackOverflowError_entry;
aoqi@0 148 static address _handler_for_unsafe_access_entry;
aoqi@0 149
aoqi@0 150 static address _atomic_xchg_entry;
aoqi@0 151 static address _atomic_xchg_ptr_entry;
aoqi@0 152 static address _atomic_store_entry;
aoqi@0 153 static address _atomic_store_ptr_entry;
aoqi@0 154 static address _atomic_cmpxchg_entry;
aoqi@0 155 static address _atomic_cmpxchg_ptr_entry;
aoqi@0 156 static address _atomic_cmpxchg_long_entry;
aoqi@0 157 static address _atomic_add_entry;
aoqi@0 158 static address _atomic_add_ptr_entry;
aoqi@0 159 static address _fence_entry;
aoqi@0 160 static address _d2i_wrapper;
aoqi@0 161 static address _d2l_wrapper;
aoqi@0 162
aoqi@0 163 static jint _fpu_cntrl_wrd_std;
aoqi@0 164 static jint _fpu_cntrl_wrd_24;
aoqi@0 165 static jint _fpu_cntrl_wrd_64;
aoqi@0 166 static jint _fpu_cntrl_wrd_trunc;
aoqi@0 167 static jint _mxcsr_std;
aoqi@0 168 static jint _fpu_subnormal_bias1[3];
aoqi@0 169 static jint _fpu_subnormal_bias2[3];
aoqi@0 170
aoqi@0 171 static BufferBlob* _code1; // code buffer for initial routines
aoqi@0 172 static BufferBlob* _code2; // code buffer for all other routines
aoqi@0 173
aoqi@0 174 // Leaf routines which implement arraycopy and their addresses
aoqi@0 175 // arraycopy operands aligned on element type boundary
aoqi@0 176 static address _jbyte_arraycopy;
aoqi@0 177 static address _jshort_arraycopy;
aoqi@0 178 static address _jint_arraycopy;
aoqi@0 179 static address _jlong_arraycopy;
aoqi@0 180 static address _oop_arraycopy, _oop_arraycopy_uninit;
aoqi@0 181 static address _jbyte_disjoint_arraycopy;
aoqi@0 182 static address _jshort_disjoint_arraycopy;
aoqi@0 183 static address _jint_disjoint_arraycopy;
aoqi@0 184 static address _jlong_disjoint_arraycopy;
aoqi@0 185 static address _oop_disjoint_arraycopy, _oop_disjoint_arraycopy_uninit;
aoqi@0 186
aoqi@0 187 // arraycopy operands aligned on zero'th element boundary
aoqi@0 188 // These are identical to the ones aligned aligned on an
aoqi@0 189 // element type boundary, except that they assume that both
aoqi@0 190 // source and destination are HeapWord aligned.
aoqi@0 191 static address _arrayof_jbyte_arraycopy;
aoqi@0 192 static address _arrayof_jshort_arraycopy;
aoqi@0 193 static address _arrayof_jint_arraycopy;
aoqi@0 194 static address _arrayof_jlong_arraycopy;
aoqi@0 195 static address _arrayof_oop_arraycopy, _arrayof_oop_arraycopy_uninit;
aoqi@0 196 static address _arrayof_jbyte_disjoint_arraycopy;
aoqi@0 197 static address _arrayof_jshort_disjoint_arraycopy;
aoqi@0 198 static address _arrayof_jint_disjoint_arraycopy;
aoqi@0 199 static address _arrayof_jlong_disjoint_arraycopy;
aoqi@0 200 static address _arrayof_oop_disjoint_arraycopy, _arrayof_oop_disjoint_arraycopy_uninit;
aoqi@0 201
aoqi@0 202 // these are recommended but optional:
aoqi@0 203 static address _checkcast_arraycopy, _checkcast_arraycopy_uninit;
aoqi@0 204 static address _unsafe_arraycopy;
aoqi@0 205 static address _generic_arraycopy;
aoqi@0 206
aoqi@0 207 static address _jbyte_fill;
aoqi@0 208 static address _jshort_fill;
aoqi@0 209 static address _jint_fill;
aoqi@0 210 static address _arrayof_jbyte_fill;
aoqi@0 211 static address _arrayof_jshort_fill;
aoqi@0 212 static address _arrayof_jint_fill;
aoqi@0 213
aoqi@0 214 // zero heap space aligned to jlong (8 bytes)
aoqi@0 215 static address _zero_aligned_words;
aoqi@0 216
aoqi@0 217 static address _aescrypt_encryptBlock;
aoqi@0 218 static address _aescrypt_decryptBlock;
aoqi@0 219 static address _cipherBlockChaining_encryptAESCrypt;
aoqi@0 220 static address _cipherBlockChaining_decryptAESCrypt;
aoqi@0 221
aoqi@0 222 static address _updateBytesCRC32;
aoqi@0 223 static address _crc_table_adr;
aoqi@0 224
aoqi@0 225 // These are versions of the java.lang.Math methods which perform
aoqi@0 226 // the same operations as the intrinsic version. They are used for
aoqi@0 227 // constant folding in the compiler to ensure equivalence. If the
aoqi@0 228 // intrinsic version returns the same result as the strict version
aoqi@0 229 // then they can be set to the appropriate function from
aoqi@0 230 // SharedRuntime.
aoqi@0 231 static double (*_intrinsic_log)(double);
aoqi@0 232 static double (*_intrinsic_log10)(double);
aoqi@0 233 static double (*_intrinsic_exp)(double);
aoqi@0 234 static double (*_intrinsic_pow)(double, double);
aoqi@0 235 static double (*_intrinsic_sin)(double);
aoqi@0 236 static double (*_intrinsic_cos)(double);
aoqi@0 237 static double (*_intrinsic_tan)(double);
aoqi@0 238
aoqi@0 239 // Safefetch stubs.
aoqi@0 240 static address _safefetch32_entry;
aoqi@0 241 static address _safefetch32_fault_pc;
aoqi@0 242 static address _safefetch32_continuation_pc;
aoqi@0 243 static address _safefetchN_entry;
aoqi@0 244 static address _safefetchN_fault_pc;
aoqi@0 245 static address _safefetchN_continuation_pc;
aoqi@0 246
aoqi@0 247 public:
aoqi@0 248 // Initialization/Testing
aoqi@0 249 static void initialize1(); // must happen before universe::genesis
aoqi@0 250 static void initialize2(); // must happen after universe::genesis
aoqi@0 251
aoqi@0 252 static bool is_stub_code(address addr) { return contains(addr); }
aoqi@0 253
aoqi@0 254 static bool contains(address addr) {
aoqi@0 255 return
aoqi@0 256 (_code1 != NULL && _code1->blob_contains(addr)) ||
aoqi@0 257 (_code2 != NULL && _code2->blob_contains(addr)) ;
aoqi@0 258 }
aoqi@0 259
aoqi@0 260 static CodeBlob* code1() { return _code1; }
aoqi@0 261 static CodeBlob* code2() { return _code2; }
aoqi@0 262
aoqi@0 263 // Debugging
aoqi@0 264 static jint verify_oop_count() { return _verify_oop_count; }
aoqi@0 265 static jint* verify_oop_count_addr() { return &_verify_oop_count; }
aoqi@0 266 // a subroutine for debugging the GC
aoqi@0 267 static address verify_oop_subroutine_entry_address() { return (address)&_verify_oop_subroutine_entry; }
aoqi@0 268
aoqi@0 269 static address catch_exception_entry() { return _catch_exception_entry; }
aoqi@0 270
aoqi@0 271 // Calls to Java
aoqi@0 272 typedef void (*CallStub)(
aoqi@0 273 address link,
aoqi@0 274 intptr_t* result,
aoqi@0 275 BasicType result_type,
aoqi@0 276 Method* method,
aoqi@0 277 address entry_point,
aoqi@0 278 intptr_t* parameters,
aoqi@0 279 int size_of_parameters,
aoqi@0 280 TRAPS
aoqi@0 281 );
aoqi@0 282
aoqi@0 283 static CallStub call_stub() { return CAST_TO_FN_PTR(CallStub, _call_stub_entry); }
aoqi@0 284
aoqi@0 285 // Exceptions
aoqi@0 286 static address forward_exception_entry() { return _forward_exception_entry; }
aoqi@0 287 // Implicit exceptions
aoqi@0 288 static address throw_AbstractMethodError_entry() { return _throw_AbstractMethodError_entry; }
aoqi@0 289 static address throw_IncompatibleClassChangeError_entry(){ return _throw_IncompatibleClassChangeError_entry; }
aoqi@0 290 static address throw_NullPointerException_at_call_entry(){ return _throw_NullPointerException_at_call_entry; }
aoqi@0 291 static address throw_StackOverflowError_entry() { return _throw_StackOverflowError_entry; }
aoqi@0 292
aoqi@0 293 // Exceptions during unsafe access - should throw Java exception rather
aoqi@0 294 // than crash.
aoqi@0 295 static address handler_for_unsafe_access() { return _handler_for_unsafe_access_entry; }
aoqi@0 296
aoqi@0 297 static address atomic_xchg_entry() { return _atomic_xchg_entry; }
aoqi@0 298 static address atomic_xchg_ptr_entry() { return _atomic_xchg_ptr_entry; }
aoqi@0 299 static address atomic_store_entry() { return _atomic_store_entry; }
aoqi@0 300 static address atomic_store_ptr_entry() { return _atomic_store_ptr_entry; }
aoqi@0 301 static address atomic_cmpxchg_entry() { return _atomic_cmpxchg_entry; }
aoqi@0 302 static address atomic_cmpxchg_ptr_entry() { return _atomic_cmpxchg_ptr_entry; }
aoqi@0 303 static address atomic_cmpxchg_long_entry() { return _atomic_cmpxchg_long_entry; }
aoqi@0 304 static address atomic_add_entry() { return _atomic_add_entry; }
aoqi@0 305 static address atomic_add_ptr_entry() { return _atomic_add_ptr_entry; }
aoqi@0 306 static address fence_entry() { return _fence_entry; }
aoqi@0 307
aoqi@0 308 static address d2i_wrapper() { return _d2i_wrapper; }
aoqi@0 309 static address d2l_wrapper() { return _d2l_wrapper; }
aoqi@0 310 static jint fpu_cntrl_wrd_std() { return _fpu_cntrl_wrd_std; }
aoqi@0 311 static address addr_fpu_cntrl_wrd_std() { return (address)&_fpu_cntrl_wrd_std; }
aoqi@0 312 static address addr_fpu_cntrl_wrd_24() { return (address)&_fpu_cntrl_wrd_24; }
aoqi@0 313 static address addr_fpu_cntrl_wrd_64() { return (address)&_fpu_cntrl_wrd_64; }
aoqi@0 314 static address addr_fpu_cntrl_wrd_trunc() { return (address)&_fpu_cntrl_wrd_trunc; }
aoqi@0 315 static address addr_mxcsr_std() { return (address)&_mxcsr_std; }
aoqi@0 316 static address addr_fpu_subnormal_bias1() { return (address)&_fpu_subnormal_bias1; }
aoqi@0 317 static address addr_fpu_subnormal_bias2() { return (address)&_fpu_subnormal_bias2; }
aoqi@0 318
aoqi@0 319
aoqi@0 320 static address select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized);
aoqi@0 321
aoqi@0 322 static address jbyte_arraycopy() { return _jbyte_arraycopy; }
aoqi@0 323 static address jshort_arraycopy() { return _jshort_arraycopy; }
aoqi@0 324 static address jint_arraycopy() { return _jint_arraycopy; }
aoqi@0 325 static address jlong_arraycopy() { return _jlong_arraycopy; }
aoqi@0 326 static address oop_arraycopy(bool dest_uninitialized = false) {
aoqi@0 327 return dest_uninitialized ? _oop_arraycopy_uninit : _oop_arraycopy;
aoqi@0 328 }
aoqi@0 329 static address jbyte_disjoint_arraycopy() { return _jbyte_disjoint_arraycopy; }
aoqi@0 330 static address jshort_disjoint_arraycopy() { return _jshort_disjoint_arraycopy; }
aoqi@0 331 static address jint_disjoint_arraycopy() { return _jint_disjoint_arraycopy; }
aoqi@0 332 static address jlong_disjoint_arraycopy() { return _jlong_disjoint_arraycopy; }
aoqi@0 333 static address oop_disjoint_arraycopy(bool dest_uninitialized = false) {
aoqi@0 334 return dest_uninitialized ? _oop_disjoint_arraycopy_uninit : _oop_disjoint_arraycopy;
aoqi@0 335 }
aoqi@0 336
aoqi@0 337 static address arrayof_jbyte_arraycopy() { return _arrayof_jbyte_arraycopy; }
aoqi@0 338 static address arrayof_jshort_arraycopy() { return _arrayof_jshort_arraycopy; }
aoqi@0 339 static address arrayof_jint_arraycopy() { return _arrayof_jint_arraycopy; }
aoqi@0 340 static address arrayof_jlong_arraycopy() { return _arrayof_jlong_arraycopy; }
aoqi@0 341 static address arrayof_oop_arraycopy(bool dest_uninitialized = false) {
aoqi@0 342 return dest_uninitialized ? _arrayof_oop_arraycopy_uninit : _arrayof_oop_arraycopy;
aoqi@0 343 }
aoqi@0 344
aoqi@0 345 static address arrayof_jbyte_disjoint_arraycopy() { return _arrayof_jbyte_disjoint_arraycopy; }
aoqi@0 346 static address arrayof_jshort_disjoint_arraycopy() { return _arrayof_jshort_disjoint_arraycopy; }
aoqi@0 347 static address arrayof_jint_disjoint_arraycopy() { return _arrayof_jint_disjoint_arraycopy; }
aoqi@0 348 static address arrayof_jlong_disjoint_arraycopy() { return _arrayof_jlong_disjoint_arraycopy; }
aoqi@0 349 static address arrayof_oop_disjoint_arraycopy(bool dest_uninitialized = false) {
aoqi@0 350 return dest_uninitialized ? _arrayof_oop_disjoint_arraycopy_uninit : _arrayof_oop_disjoint_arraycopy;
aoqi@0 351 }
aoqi@0 352
aoqi@0 353 static address checkcast_arraycopy(bool dest_uninitialized = false) {
aoqi@0 354 return dest_uninitialized ? _checkcast_arraycopy_uninit : _checkcast_arraycopy;
aoqi@0 355 }
aoqi@0 356 static address unsafe_arraycopy() { return _unsafe_arraycopy; }
aoqi@0 357 static address generic_arraycopy() { return _generic_arraycopy; }
aoqi@0 358
aoqi@0 359 static address jbyte_fill() { return _jbyte_fill; }
aoqi@0 360 static address jshort_fill() { return _jshort_fill; }
aoqi@0 361 static address jint_fill() { return _jint_fill; }
aoqi@0 362 static address arrayof_jbyte_fill() { return _arrayof_jbyte_fill; }
aoqi@0 363 static address arrayof_jshort_fill() { return _arrayof_jshort_fill; }
aoqi@0 364 static address arrayof_jint_fill() { return _arrayof_jint_fill; }
aoqi@0 365
aoqi@0 366 static address aescrypt_encryptBlock() { return _aescrypt_encryptBlock; }
aoqi@0 367 static address aescrypt_decryptBlock() { return _aescrypt_decryptBlock; }
aoqi@0 368 static address cipherBlockChaining_encryptAESCrypt() { return _cipherBlockChaining_encryptAESCrypt; }
aoqi@0 369 static address cipherBlockChaining_decryptAESCrypt() { return _cipherBlockChaining_decryptAESCrypt; }
aoqi@0 370
aoqi@0 371 static address updateBytesCRC32() { return _updateBytesCRC32; }
aoqi@0 372 static address crc_table_addr() { return _crc_table_adr; }
aoqi@0 373
aoqi@0 374 static address select_fill_function(BasicType t, bool aligned, const char* &name);
aoqi@0 375
aoqi@0 376 static address zero_aligned_words() { return _zero_aligned_words; }
aoqi@0 377
aoqi@0 378 static double intrinsic_log(double d) {
aoqi@0 379 assert(_intrinsic_log != NULL, "must be defined");
aoqi@0 380 return _intrinsic_log(d);
aoqi@0 381 }
aoqi@0 382 static double intrinsic_log10(double d) {
aoqi@0 383 assert(_intrinsic_log != NULL, "must be defined");
aoqi@0 384 return _intrinsic_log10(d);
aoqi@0 385 }
aoqi@0 386 static double intrinsic_exp(double d) {
aoqi@0 387 assert(_intrinsic_exp != NULL, "must be defined");
aoqi@0 388 return _intrinsic_exp(d);
aoqi@0 389 }
aoqi@0 390 static double intrinsic_pow(double d, double d2) {
aoqi@0 391 assert(_intrinsic_pow != NULL, "must be defined");
aoqi@0 392 return _intrinsic_pow(d, d2);
aoqi@0 393 }
aoqi@0 394 static double intrinsic_sin(double d) {
aoqi@0 395 assert(_intrinsic_sin != NULL, "must be defined");
aoqi@0 396 return _intrinsic_sin(d);
aoqi@0 397 }
aoqi@0 398 static double intrinsic_cos(double d) {
aoqi@0 399 assert(_intrinsic_cos != NULL, "must be defined");
aoqi@0 400 return _intrinsic_cos(d);
aoqi@0 401 }
aoqi@0 402 static double intrinsic_tan(double d) {
aoqi@0 403 assert(_intrinsic_tan != NULL, "must be defined");
aoqi@0 404 return _intrinsic_tan(d);
aoqi@0 405 }
aoqi@0 406
aoqi@0 407 //
aoqi@0 408 // Safefetch stub support
aoqi@0 409 //
aoqi@0 410
aoqi@0 411 typedef int (*SafeFetch32Stub)(int* adr, int errValue);
aoqi@0 412 typedef intptr_t (*SafeFetchNStub) (intptr_t* adr, intptr_t errValue);
aoqi@0 413
aoqi@0 414 static SafeFetch32Stub SafeFetch32_stub() { return CAST_TO_FN_PTR(SafeFetch32Stub, _safefetch32_entry); }
aoqi@0 415 static SafeFetchNStub SafeFetchN_stub() { return CAST_TO_FN_PTR(SafeFetchNStub, _safefetchN_entry); }
aoqi@0 416
aoqi@0 417 static bool is_safefetch_fault(address pc) {
aoqi@0 418 return pc != NULL &&
aoqi@0 419 (pc == _safefetch32_fault_pc ||
aoqi@0 420 pc == _safefetchN_fault_pc);
aoqi@0 421 }
aoqi@0 422
aoqi@0 423 static address continuation_for_safefetch_fault(address pc) {
aoqi@0 424 assert(_safefetch32_continuation_pc != NULL &&
aoqi@0 425 _safefetchN_continuation_pc != NULL,
aoqi@0 426 "not initialized");
aoqi@0 427
aoqi@0 428 if (pc == _safefetch32_fault_pc) return _safefetch32_continuation_pc;
aoqi@0 429 if (pc == _safefetchN_fault_pc) return _safefetchN_continuation_pc;
aoqi@0 430
aoqi@0 431 ShouldNotReachHere();
aoqi@0 432 return NULL;
aoqi@0 433 }
aoqi@0 434
aoqi@0 435 //
aoqi@0 436 // Default versions of the above arraycopy functions for platforms which do
aoqi@0 437 // not have specialized versions
aoqi@0 438 //
aoqi@0 439 static void jbyte_copy (jbyte* src, jbyte* dest, size_t count);
aoqi@0 440 static void jshort_copy (jshort* src, jshort* dest, size_t count);
aoqi@0 441 static void jint_copy (jint* src, jint* dest, size_t count);
aoqi@0 442 static void jlong_copy (jlong* src, jlong* dest, size_t count);
aoqi@0 443 static void oop_copy (oop* src, oop* dest, size_t count);
aoqi@0 444 static void oop_copy_uninit(oop* src, oop* dest, size_t count);
aoqi@0 445
aoqi@0 446 static void arrayof_jbyte_copy (HeapWord* src, HeapWord* dest, size_t count);
aoqi@0 447 static void arrayof_jshort_copy (HeapWord* src, HeapWord* dest, size_t count);
aoqi@0 448 static void arrayof_jint_copy (HeapWord* src, HeapWord* dest, size_t count);
aoqi@0 449 static void arrayof_jlong_copy (HeapWord* src, HeapWord* dest, size_t count);
aoqi@0 450 static void arrayof_oop_copy (HeapWord* src, HeapWord* dest, size_t count);
aoqi@0 451 static void arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count);
aoqi@0 452 };
aoqi@0 453
aoqi@0 454 // Safefetch allows to load a value from a location that's not known
aoqi@0 455 // to be valid. If the load causes a fault, the error value is returned.
aoqi@0 456 inline int SafeFetch32(int* adr, int errValue) {
aoqi@0 457 assert(StubRoutines::SafeFetch32_stub(), "stub not yet generated");
aoqi@0 458 return StubRoutines::SafeFetch32_stub()(adr, errValue);
aoqi@0 459 }
aoqi@0 460 inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) {
aoqi@0 461 assert(StubRoutines::SafeFetchN_stub(), "stub not yet generated");
aoqi@0 462 return StubRoutines::SafeFetchN_stub()(adr, errValue);
aoqi@0 463 }
aoqi@0 464
aoqi@0 465 #endif // SHARE_VM_RUNTIME_STUBROUTINES_HPP

mercurial