changeset 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 079222c56786
children 441b54753cda
files src/cpu/x86/vm/graalCodeInstaller_x86.hpp
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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);