~ chicken-core (chicken-5) fa2f293e4ab592cbccf4668de0987e1491c9e92a


commit fa2f293e4ab592cbccf4668de0987e1491c9e92a
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Dec 29 23:08:44 2012 +0100
Commit:     Peter Bex <peter.bex@xs4all.nl>
CommitDate: Thu Jan 3 23:15:50 2013 +0100

    omit bound-checks in eval's closure-compilation for global variables that are already bound at compile-time
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>

diff --git a/eval.scm b/eval.scm
index d3d077ea..3e776e7b 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
Trap