uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 978713474a57506fcbaba760e5739d562086f3e1
parent 0ff2a3586d8814974817f5a3daf92956e9104bc5
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Tue,  7 Jun 2022 20:03:12 +0100

(uxnasm) Prevent tail call optimisation when required, fixes asma

Literals do not get squashed across absolute or relative pads and
labels, now the tail call optimisations do not occur under the same
conditions. etc/asma-test.tal was identifying serious errors with
asma.rom, which uses "JSR2 &skip JMP2r" in @asma-macro-body.

Diffstat:
Msrc/uxnasm.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -299,24 +299,24 @@ parse(char *w, FILE *f) if(!sihx(w + 1)) return error("Invalid padding", w); p.ptr = shex(w + 1); - litlast = 0; + litlast = jsrlast = 0; break; case '$': /* pad-relative */ if(!sihx(w + 1)) return error("Invalid padding", w); p.ptr += shex(w + 1); - litlast = 0; + litlast = jsrlast = 0; break; case '@': /* label */ if(!makelabel(w + 1)) return error("Invalid label", w); scpy(w + 1, p.scope, 0x40); - litlast = 0; + litlast = jsrlast = 0; break; case '&': /* sublabel */ if(!makelabel(sublabel(subw, p.scope, w + 1))) return error("Invalid sublabel", w); - litlast = 0; + litlast = jsrlast = 0; break; case '#': /* literals hex */ if(!sihx(w + 1) || (slen(w) != 3 && slen(w) != 5))