summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--eval.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cbf4088..b6872e69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-16 Kaz Kylheku <kaz@kylheku.com>
+
+ * eval.c (expand): Replace blatant tail calls with
+ a backwards goto.
+
2014-02-15 Kaz Kylheku <kaz@kylheku.com>
* eval.c (bind_macro_params): Bugfix: the :whole parameter must
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,