From a9f2d9dc7e3a5a11f75ae87e010575eee8efdedc Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Sun, 10 Jan 2010 18:35:51 -0500 Subject: [PATCH] Closures no longer appear in the environment, and can therefore be GCd earlier. Short push instructions can also be used slightly more often. Thanks to Chung-chieh Shan for the idea. --- comp.scm | 5 +---- dispatch.c | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/comp.scm b/comp.scm index 250fe79..5a92c8d 100644 --- a/comp.scm +++ b/comp.scm @@ -34,10 +34,7 @@ (if (>= i 0) (gen-push-stack i ctx) (gen-push-stack - ;; this +1 is needed because closures are in the environment, but - ;; don't contain a value, and must therefore be skipped - (+ 1 - (- -1 i) + (+ (- -1 i) (length (stack-slots (env-local (context-env ctx))))) ctx))))) (define gen-push-stack diff --git a/dispatch.c b/dispatch.c index 03b15d8..7fa01b6 100644 --- a/dispatch.c +++ b/dispatch.c @@ -41,6 +41,9 @@ uint8 handle_arity_and_rest_param (uint8 na) { np = rom_get (entry++); + if (arg1 != OBJ_NULL) + arg1 = ram_get_cdr(arg1); // closed environment + if ((np & 0x80) == 0) { if (na != np) ERROR("handle_arity_and_rest_param.0", "wrong number of arguments"); -- 2.11.4.GIT