< prev index next >

src/hotspot/cpu/x86/nativeInst_x86.cpp

Print this page

        

@@ -674,11 +674,10 @@
      address ptr = (address)((intptr_t)code_buffer + i);
      int a_byte = (*ptr) & 0xFF;
      assert(*((address)((intptr_t)instr_addr + i)) == a_byte, "mt safe patching failed");
    }
 #endif
-
 }
 
 
 
 address NativeGeneralJump::jump_destination() const {

@@ -690,5 +689,29 @@
   if (is_rel32off)
     return addr_at(0) + length + int_at(offset);
   else
     return addr_at(0) + length + sbyte_at(offset);
 }
+
+void NativePostCallNop::patch(jint diff) {
+  assert(diff != 0, "must be");
+  int32_t *code_pos = (int32_t *) addr_at(displacement_offset);
+  *((int32_t *)(code_pos)) = (int32_t) diff;
+}
+
+#ifdef CONT_DOUBLE_NOP
+void NativePostCallNop::patch(uint32_t int1, uint32_t int2) {
+  patch_int2(int2);
+  patch_int1(int1); // order matters
+
+  // *((uint8_t *)addr_at(3))  = (uint8_t) short1 >> 8;
+  // *((uint8_t *)addr_at(11)) = (uint8_t) short1;
+}
+void NativePostCallNop::patch_int1(uint32_t int1) {
+  *((uint32_t *)addr_at(4))  = (int32_t) int1;
+  wrote(4);
+}
+void NativePostCallNop::patch_int2(uint32_t int2) {
+  *((uint32_t *)addr_at(12)) = (int32_t) int2;
+  wrote(12);
+}
+#endif
< prev index next >