501 502 friend NativeFarCall* nativeFarCall_before(address return_address) { 503 NativeFarCall* call = (NativeFarCall*)(return_address - return_address_offset); 504 #ifdef ASSERT 505 call->verify(); 506 #endif 507 return call; 508 } 509 510 static bool is_call_at(address instr); 511 512 // MT-safe patching of a call instruction. 513 static void insert(address code_pos, address entry) { 514 (void)nativeFarCall_overwriting_at(code_pos, entry); 515 } 516 static void replace_mt_safe(address instr_addr, address code_buffer); 517 }; 518 519 #endif // _LP64 520 521 // An interface for accessing/manipulating native set_metadata imm, reg instructions. 522 // (used to manipulate inlined data references, etc.) 523 // set_metadata imm, reg 524 // == sethi %hi22(imm), reg ; add reg, %lo10(imm), reg 525 class NativeMovConstReg; 526 inline NativeMovConstReg* nativeMovConstReg_at(address address); 527 class NativeMovConstReg: public NativeInstruction { 528 public: 529 enum Sparc_specific_constants { 530 sethi_offset = 0, 531 #ifdef _LP64 532 add_offset = 7 * BytesPerInstWord, 533 instruction_size = 8 * BytesPerInstWord 534 #else 535 add_offset = 4, 536 instruction_size = 8 537 #endif 538 }; 539 540 address instruction_address() const { return addr_at(0); } | 501 502 friend NativeFarCall* nativeFarCall_before(address return_address) { 503 NativeFarCall* call = (NativeFarCall*)(return_address - return_address_offset); 504 #ifdef ASSERT 505 call->verify(); 506 #endif 507 return call; 508 } 509 510 static bool is_call_at(address instr); 511 512 // MT-safe patching of a call instruction. 513 static void insert(address code_pos, address entry) { 514 (void)nativeFarCall_overwriting_at(code_pos, entry); 515 } 516 static void replace_mt_safe(address instr_addr, address code_buffer); 517 }; 518 519 #endif // _LP64 520 521 // An interface for accessing/manipulating 32 bit native set_metadata imm, reg instructions 522 // (used to manipulate inlined data references, etc.) 523 // set_metadata imm, reg 524 // == sethi %hi22(imm), reg ; add reg, %lo10(imm), reg 525 class NativeMovConstReg32; 526 inline NativeMovConstReg32* nativeMovConstReg32_at(address address); 527 class NativeMovConstReg32: public NativeInstruction { 528 public: 529 enum Sparc_specific_constants { 530 sethi_offset = 0, 531 add_offset = 4, 532 instruction_size = 8 533 }; 534 535 address instruction_address() const { return addr_at(0); } 536 address next_instruction_address() const { return addr_at(instruction_size); } 537 538 // (The [set_]data accessor respects oop_type relocs also.) 539 intptr_t data() const; 540 void set_data(intptr_t x); 541 542 // report the destination register 543 Register destination() { return inv_rd(long_at(sethi_offset)); } 544 545 void verify(); 546 void print(); 547 548 // unit test stuff 549 static void test(); 550 551 // Creation 552 friend inline NativeMovConstReg32* nativeMovConstReg32_at(address address) { 553 NativeMovConstReg32* test = (NativeMovConstReg32*)address; 554 #ifdef ASSERT 555 test->verify(); 556 #endif 557 return test; 558 } 559 }; 560 561 // An interface for accessing/manipulating native set_metadata imm, reg instructions. 562 // (used to manipulate inlined data references, etc.) 563 // set_metadata imm, reg 564 // == sethi %hi22(imm), reg ; add reg, %lo10(imm), reg 565 class NativeMovConstReg; 566 inline NativeMovConstReg* nativeMovConstReg_at(address address); 567 class NativeMovConstReg: public NativeInstruction { 568 public: 569 enum Sparc_specific_constants { 570 sethi_offset = 0, 571 #ifdef _LP64 572 add_offset = 7 * BytesPerInstWord, 573 instruction_size = 8 * BytesPerInstWord 574 #else 575 add_offset = 4, 576 instruction_size = 8 577 #endif 578 }; 579 580 address instruction_address() const { return addr_at(0); } |