summaryrefslogtreecommitdiff
path: root/py/asmx64.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-02-24 23:10:20 +1100
committerDamien George <damien.p.george@gmail.com>2018-02-24 23:10:20 +1100
commitc0bcf00ed100181a532240d904395de11addcd33 (patch)
tree0b706563c9c5f74a5912abe4878def2e06fcdbd3 /py/asmx64.c
parent7dfa56e40e9c343cbf4a1726a4babecc69a6b732 (diff)
py/asm*.c: Remove unnecessary check for num_locals<0 in asm entry func.
All callers of the asm entry function guarantee that num_locals>=0, so no need to add an explicit check for it. Use an assertion instead. Also, the signature of asm_x86_entry is changed to match the other asm entry functions.
Diffstat (limited to 'py/asmx64.c')
-rw-r--r--py/asmx64.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/py/asmx64.c b/py/asmx64.c
index aa2a8ec7c..c900a08d1 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -526,11 +526,9 @@ void asm_x64_jcc_label(asm_x64_t *as, int jcc_type, mp_uint_t label) {
}
void asm_x64_entry(asm_x64_t *as, int num_locals) {
+ assert(num_locals >= 0);
asm_x64_push_r64(as, ASM_X64_REG_RBP);
asm_x64_mov_r64_r64(as, ASM_X64_REG_RBP, ASM_X64_REG_RSP);
- if (num_locals < 0) {
- num_locals = 0;
- }
num_locals |= 1; // make it odd so stack is aligned on 16 byte boundary
asm_x64_sub_r64_i32(as, ASM_X64_REG_RSP, num_locals * WORD_SIZE);
asm_x64_push_r64(as, ASM_X64_REG_RBX);