equal
deleted
inserted
replaced
97 void null_check(Register reg, int offset = -1); |
97 void null_check(Register reg, int offset = -1); |
98 static bool needs_explicit_null_check(intptr_t offset); |
98 static bool needs_explicit_null_check(intptr_t offset); |
99 |
99 |
100 // Required platform-specific helpers for Label::patch_instructions. |
100 // Required platform-specific helpers for Label::patch_instructions. |
101 // They _shadow_ the declarations in AbstractAssembler, which are undefined. |
101 // They _shadow_ the declarations in AbstractAssembler, which are undefined. |
102 void pd_patch_instruction(address branch, address target) { |
102 void pd_patch_instruction(address branch, address target, const char* file, int line) { |
103 unsigned char op = branch[0]; |
103 unsigned char op = branch[0]; |
104 assert(op == 0xE8 /* call */ || |
104 assert(op == 0xE8 /* call */ || |
105 op == 0xE9 /* jmp */ || |
105 op == 0xE9 /* jmp */ || |
106 op == 0xEB /* short jmp */ || |
106 op == 0xEB /* short jmp */ || |
107 (op & 0xF0) == 0x70 /* short jcc */ || |
107 (op & 0xF0) == 0x70 /* short jcc */ || |
111 |
111 |
112 if (op == 0xEB || (op & 0xF0) == 0x70) { |
112 if (op == 0xEB || (op & 0xF0) == 0x70) { |
113 // short offset operators (jmp and jcc) |
113 // short offset operators (jmp and jcc) |
114 char* disp = (char*) &branch[1]; |
114 char* disp = (char*) &branch[1]; |
115 int imm8 = target - (address) &disp[1]; |
115 int imm8 = target - (address) &disp[1]; |
116 guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset"); |
116 guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line); |
117 *disp = imm8; |
117 *disp = imm8; |
118 } else { |
118 } else { |
119 int* disp = (int*) &branch[(op == 0x0F || op == 0xC7)? 2: 1]; |
119 int* disp = (int*) &branch[(op == 0x0F || op == 0xC7)? 2: 1]; |
120 int imm32 = target - (address) &disp[1]; |
120 int imm32 = target - (address) &disp[1]; |
121 *disp = imm32; |
121 *disp = imm32; |