merged volatile memory barriers
[cacao.git] / src / vm / jit / x86_64 / codegen.h
index d5b1367df78b718b3c234efb49de5e9658238b56..086502be5a2748742f75bf321558ae679d8765ec 100644 (file)
@@ -50,8 +50,9 @@
 
 #define ALIGNCODENOP \
     do { \
-        for (s1 = 0; s1 < (s4) (((ptrint) cd->mcodeptr) & 7); s1++) \
-            M_NOP; \
+        int len = (-(ptrint) cd->mcodeptr) & 7; \
+        if (len) \
+            emit_nop(cd, len); \
     } while (0)
 
 
@@ -81,6 +82,9 @@
 #define BRANCH_UNCONDITIONAL_SIZE    5  /* size in bytes of a branch          */
 #define BRANCH_CONDITIONAL_SIZE      6  /* size in bytes of a branch          */
 
+/* These NOPs are never executed; they are only used as placeholders during
+ * code generation.
+ */
 #define BRANCH_NOPS \
     do { \
         M_NOP; \
 
 #define PATCHER_NOPS \
     do { \
-        M_NOP; \
-        M_NOP; \
+        emit_nop(cd, 2); \
     } while (0)