comparison src/cpu/x86/vm/graalCodeInstaller_x86.hpp @ 13485:04a87dc2cfca

refactored common code into a separate function
author Doug Simon <doug.simon@oracle.com>
date Fri, 27 Dec 2013 23:25:21 +0100
parents ff1d8605f354
children 8085ce95b6f5
comparison
equal deleted inserted replaced
13484:079222c56786 13485:04a87dc2cfca
217 default: 217 default:
218 break; 218 break;
219 } 219 }
220 } 220 }
221 221
222 static void relocate_poll_near(address pc) {
223 NativeInstruction* ni = nativeInstruction_at(pc);
224 int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand);
225 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
226 intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
227 *disp = (int32_t)new_disp;
228 }
229
230
222 inline void CodeInstaller::pd_relocate_poll(address pc, jint mark) { 231 inline void CodeInstaller::pd_relocate_poll(address pc, jint mark) {
223 switch (mark) { 232 switch (mark) {
224 case MARK_POLL_NEAR: { 233 case MARK_POLL_NEAR: {
225 NativeInstruction* ni = nativeInstruction_at(pc); 234 relocate_poll_near(pc);
226 int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand);
227 // int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
228 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
229 intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
230 *disp = (int32_t)new_disp;
231 } 235 }
232 case MARK_POLL_FAR: 236 case MARK_POLL_FAR:
233 _instructions->relocate(pc, relocInfo::poll_type); 237 _instructions->relocate(pc, relocInfo::poll_type);
234 break; 238 break;
235 case MARK_POLL_RETURN_NEAR: { 239 case MARK_POLL_RETURN_NEAR: {
236 NativeInstruction* ni = nativeInstruction_at(pc); 240 relocate_poll_near(pc);
237 int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand);
238 // int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
239 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
240 intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
241 *disp = (int32_t)new_disp;
242 } 241 }
243 case MARK_POLL_RETURN_FAR: 242 case MARK_POLL_RETURN_FAR:
244 _instructions->relocate(pc, relocInfo::poll_return_type); 243 _instructions->relocate(pc, relocInfo::poll_return_type);
245 break; 244 break;
246 default: 245 default: