211 // These are versions of the java.lang.Math methods which perform 212 // the same operations as the intrinsic version. They are used for 213 // constant folding in the compiler to ensure equivalence. If the 214 // intrinsic version returns the same result as the strict version 215 // then they can be set to the appropriate function from 216 // SharedRuntime. 217 static double (*_intrinsic_log10)(double); 218 static double (*_intrinsic_pow)(double, double); 219 static double (*_intrinsic_sin)(double); 220 static double (*_intrinsic_cos)(double); 221 static double (*_intrinsic_tan)(double); 222 223 // Safefetch stubs. 224 static address _safefetch32_entry; 225 static address _safefetch32_fault_pc; 226 static address _safefetch32_continuation_pc; 227 static address _safefetchN_entry; 228 static address _safefetchN_fault_pc; 229 static address _safefetchN_continuation_pc; 230 231 public: 232 // Initialization/Testing 233 static void initialize1(); // must happen before universe::genesis 234 static void initialize2(); // must happen after universe::genesis 235 236 static bool is_stub_code(address addr) { return contains(addr); } 237 238 static bool contains(address addr) { 239 return 240 (_code1 != NULL && _code1->blob_contains(addr)) || 241 (_code2 != NULL && _code2->blob_contains(addr)) ; 242 } 243 244 static RuntimeBlob* code1() { return _code1; } 245 static RuntimeBlob* code2() { return _code2; } 246 247 // Debugging 248 static jint verify_oop_count() { return _verify_oop_count; } 249 static jint* verify_oop_count_addr() { return &_verify_oop_count; } 250 // a subroutine for debugging the GC 438 return NULL; 439 } 440 441 // 442 // Default versions of the above arraycopy functions for platforms which do 443 // not have specialized versions 444 // 445 static void jbyte_copy (jbyte* src, jbyte* dest, size_t count); 446 static void jshort_copy (jshort* src, jshort* dest, size_t count); 447 static void jint_copy (jint* src, jint* dest, size_t count); 448 static void jlong_copy (jlong* src, jlong* dest, size_t count); 449 static void oop_copy (oop* src, oop* dest, size_t count); 450 static void oop_copy_uninit(oop* src, oop* dest, size_t count); 451 452 static void arrayof_jbyte_copy (HeapWord* src, HeapWord* dest, size_t count); 453 static void arrayof_jshort_copy (HeapWord* src, HeapWord* dest, size_t count); 454 static void arrayof_jint_copy (HeapWord* src, HeapWord* dest, size_t count); 455 static void arrayof_jlong_copy (HeapWord* src, HeapWord* dest, size_t count); 456 static void arrayof_oop_copy (HeapWord* src, HeapWord* dest, size_t count); 457 static void arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count); 458 }; 459 460 // Safefetch allows to load a value from a location that's not known 461 // to be valid. If the load causes a fault, the error value is returned. 462 inline int SafeFetch32(int* adr, int errValue) { 463 assert(StubRoutines::SafeFetch32_stub(), "stub not yet generated"); 464 return StubRoutines::SafeFetch32_stub()(adr, errValue); 465 } 466 inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) { 467 assert(StubRoutines::SafeFetchN_stub(), "stub not yet generated"); 468 return StubRoutines::SafeFetchN_stub()(adr, errValue); 469 } 470 471 472 // returns true if SafeFetch32 and SafeFetchN can be used safely (stubroutines are already generated) 473 inline bool CanUseSafeFetch32() { 474 return StubRoutines::SafeFetch32_stub() ? true : false; 475 } 476 477 inline bool CanUseSafeFetchN() { | 211 // These are versions of the java.lang.Math methods which perform 212 // the same operations as the intrinsic version. They are used for 213 // constant folding in the compiler to ensure equivalence. If the 214 // intrinsic version returns the same result as the strict version 215 // then they can be set to the appropriate function from 216 // SharedRuntime. 217 static double (*_intrinsic_log10)(double); 218 static double (*_intrinsic_pow)(double, double); 219 static double (*_intrinsic_sin)(double); 220 static double (*_intrinsic_cos)(double); 221 static double (*_intrinsic_tan)(double); 222 223 // Safefetch stubs. 224 static address _safefetch32_entry; 225 static address _safefetch32_fault_pc; 226 static address _safefetch32_continuation_pc; 227 static address _safefetchN_entry; 228 static address _safefetchN_fault_pc; 229 static address _safefetchN_continuation_pc; 230 231 static address _load_value_type_fields_in_regs; 232 static address _store_value_type_fields_to_buf; 233 234 public: 235 // Initialization/Testing 236 static void initialize1(); // must happen before universe::genesis 237 static void initialize2(); // must happen after universe::genesis 238 239 static bool is_stub_code(address addr) { return contains(addr); } 240 241 static bool contains(address addr) { 242 return 243 (_code1 != NULL && _code1->blob_contains(addr)) || 244 (_code2 != NULL && _code2->blob_contains(addr)) ; 245 } 246 247 static RuntimeBlob* code1() { return _code1; } 248 static RuntimeBlob* code2() { return _code2; } 249 250 // Debugging 251 static jint verify_oop_count() { return _verify_oop_count; } 252 static jint* verify_oop_count_addr() { return &_verify_oop_count; } 253 // a subroutine for debugging the GC 441 return NULL; 442 } 443 444 // 445 // Default versions of the above arraycopy functions for platforms which do 446 // not have specialized versions 447 // 448 static void jbyte_copy (jbyte* src, jbyte* dest, size_t count); 449 static void jshort_copy (jshort* src, jshort* dest, size_t count); 450 static void jint_copy (jint* src, jint* dest, size_t count); 451 static void jlong_copy (jlong* src, jlong* dest, size_t count); 452 static void oop_copy (oop* src, oop* dest, size_t count); 453 static void oop_copy_uninit(oop* src, oop* dest, size_t count); 454 455 static void arrayof_jbyte_copy (HeapWord* src, HeapWord* dest, size_t count); 456 static void arrayof_jshort_copy (HeapWord* src, HeapWord* dest, size_t count); 457 static void arrayof_jint_copy (HeapWord* src, HeapWord* dest, size_t count); 458 static void arrayof_jlong_copy (HeapWord* src, HeapWord* dest, size_t count); 459 static void arrayof_oop_copy (HeapWord* src, HeapWord* dest, size_t count); 460 static void arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count); 461 462 static address load_value_type_fields_in_regs() { return _load_value_type_fields_in_regs; } 463 static address store_value_type_fields_to_buf() { return _store_value_type_fields_to_buf; } 464 }; 465 466 // Safefetch allows to load a value from a location that's not known 467 // to be valid. If the load causes a fault, the error value is returned. 468 inline int SafeFetch32(int* adr, int errValue) { 469 assert(StubRoutines::SafeFetch32_stub(), "stub not yet generated"); 470 return StubRoutines::SafeFetch32_stub()(adr, errValue); 471 } 472 inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) { 473 assert(StubRoutines::SafeFetchN_stub(), "stub not yet generated"); 474 return StubRoutines::SafeFetchN_stub()(adr, errValue); 475 } 476 477 478 // returns true if SafeFetch32 and SafeFetchN can be used safely (stubroutines are already generated) 479 inline bool CanUseSafeFetch32() { 480 return StubRoutines::SafeFetch32_stub() ? true : false; 481 } 482 483 inline bool CanUseSafeFetchN() { |