The attached patch modifies the part of the evaluator that does pre-compilation into a closure tree by omitting bound-checks for those global variables that are bound at preparation time (there is no way to make toplevel variables unbound again, once bound (except by magic)). This removes a considerable amount of boundness checks (references to library procedures, for example) in evaluated code.
cheers, felix
>From 9cc07b24bab819859448dd0728b9665b9a288a37 Mon Sep 17 00:00:00 2001 From: felix <fe...@call-with-current-continuation.org> Date: Sat, 29 Dec 2012 23:08:44 +0100 Subject: [PATCH] omit bound-checks in eval's closure-compilation for global variables that are already bound at compile-time --- eval.scm | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/eval.scm b/eval.scm index d3d077e..3e776e7 100644 --- a/eval.scm +++ b/eval.scm @@ -261,6 +261,8 @@ (cond ((not var) (lambda (v) (##sys#error "unbound variable" x))) + ((##sys#symbol-has-toplevel-binding? var) + (lambda v (##sys#slot var 0))) (else (lambda v (##core#inline "C_retrieve" var)))))) (else -- 1.7.0.4
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers