aboutsummaryrefslogtreecommitdiff
path: root/py/asmthumb.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/asmthumb.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/asmthumb.c')
-rw-r--r--py/asmthumb.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/py/asmthumb.c b/py/asmthumb.c
index 5316a7efb..c5b45f2f5 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -104,6 +104,8 @@ STATIC void asm_thumb_write_word32(asm_thumb_t *as, int w32) {
// | low address | high address in RAM
void asm_thumb_entry(asm_thumb_t *as, int num_locals) {
+ assert(num_locals >= 0);
+
// work out what to push and how many extra spaces to reserve on stack
// so that we have enough for all locals and it's aligned an 8-byte boundary
// we push extra regs (r1, r2, r3) to help do the stack adjustment
@@ -111,9 +113,6 @@ void asm_thumb_entry(asm_thumb_t *as, int num_locals) {
// for push rlist, lowest numbered register at the lowest address
uint reglist;
uint stack_adjust;
- if (num_locals < 0) {
- num_locals = 0;
- }
// don't pop r0 because it's used for return value
switch (num_locals) {
case 0: