From c3df6f9980a39f1302b028fa6369ace09db374a2 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 16 Feb 2014 00:32:12 -0800 Subject: * eval.c (expand): Replace blatant tail calls with a backwards goto. --- eval.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 6a97bb80..c2cba4a5 100644 --- a/eval.c +++ b/eval.c @@ -1928,6 +1928,7 @@ val expand(val form) { val macro = nil; +tail: if (atom(form)) { return form; } else { @@ -2063,9 +2064,11 @@ val expand(val form) return form; return rlcp(cons(sym, quasi_ex), form); } else if (sym == gen_s) { - return expand(expand_gen(rest(form))); + form = expand_gen(rest(form)); + goto tail; } else if (sym == delay_s) { - return expand(expand_delay(rest(form))); + form = expand_delay(rest(form)); + goto tail; } else if (sym == op_s || sym == do_s) { return expand_op(sym, rest(form)); } else if (sym == catch_s) { @@ -2086,7 +2089,8 @@ val expand(val form) return form; if (!source_loc(mac_expand)) rlcp(mac_expand, form); - return expand(mac_expand); + form = mac_expand; + goto tail; } else { /* funtion call also handles: progn, prog1, call, if, and, or, -- cgit v1.2.3