163 // we must parse the instruction a bit to find the embedded word.
164 assert(is_data(), "must be a DataRelocation");
165 typedef Assembler::WhichOperand WhichOperand;
166 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm/imm32
167 assert(which == Assembler::disp32_operand ||
168 which == Assembler::call32_operand ||
169 which == Assembler::imm_operand, "format unpacks ok");
170 if (which != Assembler::imm_operand) {
171 address ip = addr();
172 address disp = Assembler::locate_operand(ip, which);
173 address next_ip = Assembler::locate_next_instruction(ip);
174 address a = next_ip + *(int32_t*) disp;
175 return a;
176 }
177 #endif // AMD64
178 return *pd_address_in_code();
179 }
180
181 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
182 #ifdef _LP64
183 if (!Assembler::is_polling_page_far()) {
184 typedef Assembler::WhichOperand WhichOperand;
185 WhichOperand which = (WhichOperand) format();
186 // This format is imm but it is really disp32
187 which = Assembler::disp32_operand;
188 address orig_addr = old_addr_for(addr(), src, dest);
189 NativeInstruction* oni = nativeInstruction_at(orig_addr);
190 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
191 // This poll_addr is incorrect by the size of the instruction it is irrelevant
192 intptr_t poll_addr = (intptr_t)oni + *orig_disp;
193
194 NativeInstruction* ni = nativeInstruction_at(addr());
195 intptr_t new_disp = poll_addr - (intptr_t) ni;
196
197 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
198 * disp = (int32_t)new_disp;
199 }
200 #endif // _LP64
201 }
202
203 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
204 #ifdef _LP64
205 if (!Assembler::is_polling_page_far()) {
206 typedef Assembler::WhichOperand WhichOperand;
207 WhichOperand which = (WhichOperand) format();
208 // This format is imm but it is really disp32
209 which = Assembler::disp32_operand;
210 address orig_addr = old_addr_for(addr(), src, dest);
211 NativeInstruction* oni = nativeInstruction_at(orig_addr);
212 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
213 // This poll_addr is incorrect by the size of the instruction it is irrelevant
214 intptr_t poll_addr = (intptr_t)oni + *orig_disp;
215
216 NativeInstruction* ni = nativeInstruction_at(addr());
217 intptr_t new_disp = poll_addr - (intptr_t) ni;
218
219 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
220 * disp = (int32_t)new_disp;
221 }
222 #endif // _LP64
223 }
224
225 void metadata_Relocation::pd_fix_value(address x) {
|
163 // we must parse the instruction a bit to find the embedded word.
164 assert(is_data(), "must be a DataRelocation");
165 typedef Assembler::WhichOperand WhichOperand;
166 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm/imm32
167 assert(which == Assembler::disp32_operand ||
168 which == Assembler::call32_operand ||
169 which == Assembler::imm_operand, "format unpacks ok");
170 if (which != Assembler::imm_operand) {
171 address ip = addr();
172 address disp = Assembler::locate_operand(ip, which);
173 address next_ip = Assembler::locate_next_instruction(ip);
174 address a = next_ip + *(int32_t*) disp;
175 return a;
176 }
177 #endif // AMD64
178 return *pd_address_in_code();
179 }
180
181 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
182 #ifdef _LP64
183 if (!ThreadLocalSafepoints && !Assembler::is_polling_page_far()) {
184 typedef Assembler::WhichOperand WhichOperand;
185 WhichOperand which = (WhichOperand) format();
186 // This format is imm but it is really disp32
187 which = Assembler::disp32_operand;
188 address orig_addr = old_addr_for(addr(), src, dest);
189 NativeInstruction* oni = nativeInstruction_at(orig_addr);
190 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
191 // This poll_addr is incorrect by the size of the instruction it is irrelevant
192 intptr_t poll_addr = (intptr_t)oni + *orig_disp;
193
194 NativeInstruction* ni = nativeInstruction_at(addr());
195 intptr_t new_disp = poll_addr - (intptr_t) ni;
196
197 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
198 * disp = (int32_t)new_disp;
199 }
200 #endif // _LP64
201 }
202
203 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
204 #ifdef _LP64
205 if (!ThreadLocalSafepoints && !Assembler::is_polling_page_far()) {
206 typedef Assembler::WhichOperand WhichOperand;
207 WhichOperand which = (WhichOperand) format();
208 // This format is imm but it is really disp32
209 which = Assembler::disp32_operand;
210 address orig_addr = old_addr_for(addr(), src, dest);
211 NativeInstruction* oni = nativeInstruction_at(orig_addr);
212 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
213 // This poll_addr is incorrect by the size of the instruction it is irrelevant
214 intptr_t poll_addr = (intptr_t)oni + *orig_disp;
215
216 NativeInstruction* ni = nativeInstruction_at(addr());
217 intptr_t new_disp = poll_addr - (intptr_t) ni;
218
219 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
220 * disp = (int32_t)new_disp;
221 }
222 #endif // _LP64
223 }
224
225 void metadata_Relocation::pd_fix_value(address x) {
|