[Top][All Lists]

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-0-23-ga84

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-0-23-ga84673a
Date: Wed, 24 Jun 2009 11:43:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, master has been updated
       via  a84673a68bfdb6f46235fc6aa1d60c418c28a2e5 (commit)
      from  0ebbcf43c45892afcec199bde0ca1ecaea0077da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a84673a68bfdb6f46235fc6aa1d60c418c28a2e5
Author: Andy Wingo <address@hidden>
Date:   Wed Jun 24 13:42:59 2009 +0200

    remove lambda wrap hack of brainfuck tree-il compiler
    * module/language/brainfuck/compile-tree-il.scm (compile-tree-il):
      Remove the hack where we wrapped the compiled code in a `lambda',
      because not only should the tree-il compiler optimize that away, it
      was really papering around other inefficiencies, and obtuse to boot.


Summary of changes:
 module/language/brainfuck/compile-tree-il.scm |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/module/language/brainfuck/compile-tree-il.scm 
index 62987fc..0aaa112 100644
--- a/module/language/brainfuck/compile-tree-il.scm
+++ b/module/language/brainfuck/compile-tree-il.scm
@@ -49,12 +49,11 @@
 ;; This compiles a whole brainfuck program. This constructs a Tree-IL
 ;; code equivalent to Scheme code like this:
-;; ((lambda ()
 ;;    (let ((pointer 0)
 ;;          (tape (make-vector tape-size 0)))
 ;;      (begin
 ;;       <body>
-;;       (write-char #\newline)))))
+;;       (write-char #\newline)))
 ;; So first the pointer and tape variables are set up correctly, then the
 ;; program's body is executed in this context, and finally we output an
@@ -69,17 +68,6 @@
 ;; throw an error, whereas a number of Brainfuck compilers do not detect
 ;; this.
-;; We wrap the code in a lambda so that the body has a place to cache
-;; the looked-up locations of the primitive functions: vector-ref et al.
-;; This way we can use toplevel-ref instead of link-now + variable-ref.
-;; See the VM documentation for more info on those instructions.
-;; Normally when compiling you don't have to think about this at all,
-;; because the usual pattern is a bunch of definitions, then you call
-;; those definitions -- so the real work is in the functions anyway,
-;; which can use toplevel-ref. Here we just force that pattern into
-;; effect.
 ;; Note that we're generating the S-expression representation of
 ;; Tree-IL, then using parse-tree-il to turn it into the actual Tree-IL
 ;; data structures. This makes the compiler more pleasant to look at,
@@ -104,11 +92,10 @@
 (define (compile-tree-il exp env opts)
-    `(apply (lambda () ()
-              (let (pointer tape) (pointer tape)
-                   ((const 0)
-                    (apply (primitive make-vector) (const ,tape-size) (const 
-                   ,(compile-body exp)))))
+    `(let (pointer tape) (pointer tape)
+          ((const 0)
+           (apply (primitive make-vector) (const ,tape-size) (const 0)))
+          ,(compile-body exp)))

GNU Guile

reply via email to

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