# HG changeset patch # User Doug Simon # Date 1388183121 -3600 # Node ID 04a87dc2cfca2366b1b3aaf8658878a32a89b29a # Parent 079222c5678690db526c6439426aac633f2e9b6b refactored common code into a separate function diff -r 079222c56786 -r 04a87dc2cfca src/cpu/x86/vm/graalCodeInstaller_x86.hpp --- a/src/cpu/x86/vm/graalCodeInstaller_x86.hpp Fri Dec 27 20:47:22 2013 +0100 +++ b/src/cpu/x86/vm/graalCodeInstaller_x86.hpp Fri Dec 27 23:25:21 2013 +0100 @@ -219,26 +219,25 @@ } } +static void relocate_poll_near(address pc) { + NativeInstruction* ni = nativeInstruction_at(pc); + int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand); + int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand + intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni; + *disp = (int32_t)new_disp; +} + + inline void CodeInstaller::pd_relocate_poll(address pc, jint mark) { switch (mark) { case MARK_POLL_NEAR: { - NativeInstruction* ni = nativeInstruction_at(pc); - int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand); - // int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand); - int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand - intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni; - *disp = (int32_t)new_disp; + relocate_poll_near(pc); } case MARK_POLL_FAR: _instructions->relocate(pc, relocInfo::poll_type); break; case MARK_POLL_RETURN_NEAR: { - NativeInstruction* ni = nativeInstruction_at(pc); - int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand); - // int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand); - int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand - intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni; - *disp = (int32_t)new_disp; + relocate_poll_near(pc); } case MARK_POLL_RETURN_FAR: _instructions->relocate(pc, relocInfo::poll_return_type);