diff src/cpu/x86/vm/graalCodeInstaller_x86.hpp @ 11760:ce0b00597980

made safepoint-on-return use specialized HotSpot runtime support for such safepoints (which have no debug info attached)
author Doug Simon <doug.simon@oracle.com>
date Tue, 24 Sep 2013 08:51:02 +0200
parents 4e1db4c9d4c5
children 4c96ccce3772
line wrap: on
line diff
--- a/src/cpu/x86/vm/graalCodeInstaller_x86.hpp	Mon Sep 23 22:04:51 2013 -0700
+++ b/src/cpu/x86/vm/graalCodeInstaller_x86.hpp	Tue Sep 24 08:51:02 2013 +0200
@@ -20,8 +20,8 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-#ifndef CPU_SPARC_VM_CODEINSTALLER_X86_HPP
-#define CPU_SPARC_VM_CODEINSTALLER_X86_HPP
+#ifndef CPU_X86_VM_CODEINSTALLER_X86_HPP
+#define CPU_X86_VM_CODEINSTALLER_X86_HPP
 
 #include "compiler/disassembler.hpp"
 #include "runtime/javaCalls.hpp"
@@ -207,9 +207,35 @@
   }
 }
 
-inline int32_t* CodeInstaller::pd_locate_operand(address instruction) {
-  return (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
+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;
+    }
+    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;
+    }
+    case MARK_POLL_RETURN_FAR:
+      _instructions->relocate(pc, relocInfo::poll_return_type);
+      break;
+    default:
+      ShouldNotReachHere();
+      break;
+  }
 }
 
-#endif // CPU_SPARC_VM_CODEINSTALLER_X86_HPP
+#endif // CPU_X86_VM_CODEINSTALLER_X86_HPP