diff options
author | Sam Gross <colesbury@gmail.com> | 2015-04-27 23:17:55 +0300 |
---|---|---|
committer | Sam Gross <colesbury@gmail.com> | 2015-04-28 20:58:46 +0300 |
commit | ec9e4eae9746304e449ce126bf54ee44dff26140 (patch) | |
tree | 12a3392ab3c034204f212e81d9a0841a252513ec | |
parent | 04b74bedf50c04224726f7d6565d890e662357d2 (diff) |
Align 64-bit ints on 8-byte boundaries when on the stack.
-rw-r--r-- | call_x64.h | 3 | ||||
-rw-r--r-- | call_x64win.h | 3 | ||||
-rw-r--r-- | call_x86.dasc | 3 | ||||
-rw-r--r-- | call_x86.h | 3 |
4 files changed, 12 insertions, 0 deletions
@@ -392,6 +392,9 @@ static void add_int(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int #endif else if (is_int64) { + if (reg->off % 8 != 0) { + reg->off += 8 - (reg->off % 8); + } dasm_put(Dst, 313, reg->off); reg->off += 8; } else { diff --git a/call_x64win.h b/call_x64win.h index 3362af1..99306b8 100644 --- a/call_x64win.h +++ b/call_x64win.h @@ -387,6 +387,9 @@ static void add_int(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int #endif else if (is_int64) { + if (reg->off % 8 != 0) { + reg->off += 8 - (reg->off % 8); + } dasm_put(Dst, 285, reg->off); reg->off += 8; } else { diff --git a/call_x86.dasc b/call_x86.dasc index 573b448..d7a7c4c 100644 --- a/call_x86.dasc +++ b/call_x86.dasc @@ -508,6 +508,9 @@ static void add_int(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int #endif else if (is_int64) { + if (reg->off % 8 != 0) { + reg->off += 8 - (reg->off % 8); + } |.if X64 | mov [rsp + reg->off], rax |.else @@ -376,6 +376,9 @@ static void add_int(Dst_DECL, const struct ctype* ct, struct reg_alloc* reg, int #endif else if (is_int64) { + if (reg->off % 8 != 0) { + reg->off += 8 - (reg->off % 8); + } dasm_put(Dst, 248, reg->off, reg->off + 4); reg->off += 8; } else { |