guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/01: Only lazily compile where profitable


From: Andy Wingo
Subject: [Guile-commits] 01/01: Only lazily compile where profitable
Date: Thu, 12 Mar 2015 13:48:48 +0000

wingo pushed a commit to branch master
in repository guile.

commit fe7ecee8204fa79bfebcc925b82e1e670ed34cea
Author: Andy Wingo <address@hidden>
Date:   Thu Mar 12 14:48:03 2015 +0100

    Only lazily compile where profitable
    
    * module/ice-9/eval.scm (primitive-eval): Only lazily compile box-ref on
      toplevel variables; otherwise compile eagerly to avoid the
      indirection.
---
 module/ice-9/eval.scm |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/module/ice-9/eval.scm b/module/ice-9/eval.scm
index f5bcc16..3b68f07 100644
--- a/module/ice-9/eval.scm
+++ b/module/ice-9/eval.scm
@@ -213,11 +213,12 @@
                            '()
                            (cons ((car args) env) (lp (cdr args)))))))))))))
 
-  (define (compile-box-ref cenv box)
+  (define (compile-box-ref box)
     (match box
       ((,(typecode resolve) . loc)
-       (let ((var (%resolve-variable loc (env-toplevel cenv))))
-         (lambda (env) (variable-ref var))))
+       (lazy (cenv)
+         (let ((var (%resolve-variable loc (env-toplevel cenv))))
+           (lambda (env) (variable-ref var)))))
       ((,(typecode lexical-ref) depth . width)
        (lambda (env)
          (variable-ref (env-ref env depth width))))
@@ -655,7 +656,7 @@
        (compile-call f args))
       
       ((,(typecode box-ref) . box)
-       (lazy (env) (compile-box-ref env box)))
+       (compile-box-ref box))
 
       ((,(typecode resolve) . loc)
        (lazy (env) (compile-resolve env loc)))



reply via email to

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