35 #include "c1/c1_Runtime1.hpp" 36 #endif 37 38 39 bool NativeInstruction::is_dtrace_trap() { 40 return !is_nop(); 41 } 42 43 void NativeInstruction::set_data64_sethi(address instaddr, intptr_t x) { 44 ResourceMark rm; 45 CodeBuffer buf(instaddr, 10 * BytesPerInstWord ); 46 MacroAssembler* _masm = new MacroAssembler(&buf); 47 Register destreg; 48 49 destreg = inv_rd(*(unsigned int *)instaddr); 50 // Generate a the new sequence 51 _masm->patchable_sethi(x, destreg); 52 ICache::invalidate_range(instaddr, 7 * BytesPerInstWord); 53 } 54 55 void NativeInstruction::verify() { 56 // make sure code pattern is actually an instruction address 57 address addr = addr_at(0); 58 if (addr == 0 || ((intptr_t)addr & 3) != 0) { 59 fatal("not an instruction address"); 60 } 61 } 62 63 void NativeInstruction::print() { 64 tty->print_cr(INTPTR_FORMAT ": 0x%x", addr_at(0), long_at(0)); 65 } 66 67 void NativeInstruction::set_long_at(int offset, int i) { 68 address addr = addr_at(offset); 69 *(int*)addr = i; 70 ICache::invalidate_word(addr); 71 } 72 73 void NativeInstruction::set_jlong_at(int offset, jlong i) { 74 address addr = addr_at(offset); | 35 #include "c1/c1_Runtime1.hpp" 36 #endif 37 38 39 bool NativeInstruction::is_dtrace_trap() { 40 return !is_nop(); 41 } 42 43 void NativeInstruction::set_data64_sethi(address instaddr, intptr_t x) { 44 ResourceMark rm; 45 CodeBuffer buf(instaddr, 10 * BytesPerInstWord ); 46 MacroAssembler* _masm = new MacroAssembler(&buf); 47 Register destreg; 48 49 destreg = inv_rd(*(unsigned int *)instaddr); 50 // Generate a the new sequence 51 _masm->patchable_sethi(x, destreg); 52 ICache::invalidate_range(instaddr, 7 * BytesPerInstWord); 53 } 54 55 void NativeInstruction::verify_data64_sethi(address instaddr, intptr_t x) { 56 ResourceMark rm; 57 unsigned char buffer[10 * BytesPerInstWord]; 58 CodeBuffer buf(buffer, 10 * BytesPerInstWord); 59 MacroAssembler masm(&buf); 60 61 Register destreg = inv_rd(*(unsigned int *)instaddr); 62 // Generate the proper sequence into a temporary buffer and compare 63 // it with the original sequence. 64 masm.patchable_sethi(x, destreg); 65 int len = buffer - masm.pc(); 66 for (int i = 0; i < len; i++) { 67 assert(instaddr[i] == buffer[i], "instructions must match"); 68 } 69 } 70 71 void NativeInstruction::verify() { 72 // make sure code pattern is actually an instruction address 73 address addr = addr_at(0); 74 if (addr == 0 || ((intptr_t)addr & 3) != 0) { 75 fatal("not an instruction address"); 76 } 77 } 78 79 void NativeInstruction::print() { 80 tty->print_cr(INTPTR_FORMAT ": 0x%x", addr_at(0), long_at(0)); 81 } 82 83 void NativeInstruction::set_long_at(int offset, int i) { 84 address addr = addr_at(offset); 85 *(int*)addr = i; 86 ICache::invalidate_word(addr); 87 } 88 89 void NativeInstruction::set_jlong_at(int offset, jlong i) { 90 address addr = addr_at(offset); |