chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] omit bound-checks in eval if already bound at


From: Felix
Subject: [Chicken-hackers] [PATCH] omit bound-checks in eval if already bound at pre-compilation time
Date: Sun, 30 Dec 2012 14:31:55 +0100 (CET)

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 <address@hidden>
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]