[Top][All Lists]

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

guile-vm 0.7 released

From: Andy Wingo
Subject: guile-vm 0.7 released
Date: Tue, 20 May 2008 15:42:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi all,

I've released version 0.7 of guile-vm. I hope I'm not stepping on toes
for this one, but I felt it was a good idea to get a tarball out there
that self-compiles fine and that distchecks. I've attached the NEWS.


I also have to apologize again for not working in Ludovic's doc updates,
or responding properly -- my mail is still borked. Perhaps it will
unbork today.

So the question is: where to from here? Here is an unordered series of
thoughts, observations, etc.

 * Guile-VM does not currently offer a significant speed advantage over
   the interpreter. It is mostly faster by about 2 times or so, but
   sometimes slower. On the other hand I haven't profiled it yet. And,
   on the other other hand, loading compiled code is really quick.

 * I have fixed macro compilation for syncase macros. Yay.

 * Guile-VM appears to produce correct code. I have not comprehensively
   proven this, though.

 * If you have a .go file in the same place as a .scm file, and you have
   loaded (system vm core) at some time in the past, then `use-modules'
   will automatically load your compiled file instead of the .scm file.
   This is part of boot-9. It should (but currently does not) stat to
   make sure the .go file is up to date, though.

 * GOOPS-using code does not yet compile. I think that it probably needs
   quite a rework in order to compile, in order to make sure that all
   effects are performed via e.g. what define-class expands out to
   instead of by the expander itself.

 * I am relying on a few Guile patches. Some of them I've sent and not
   gotten around to properly responding to and fixing, and some of them
   I have not. I'm attaching them all after the NEWS.

 * The code generated by Guile-VM is OK. The preambles are quite crap

 * Debugging currently sucks, there is no source-level information, and
   I haven't yet been able to understand Kei's vision in that regard. I
   think that Ludovic knows more about this.

 * I need to get a copyright assignment for pmatch.scm.

 * The real wins on startup time and such will come when boot-9.scm is
   compiled, and all of ice-9/ is compiled. I would love for this to
   happen. This would require Guile-VM becoming a part of Guile. I think
   that the debugging support (backtraces at least) should be better
   before that happens, though.

That's all of my thoughts for now. Please give the tarball a go, and let
me know if you react to any of these thoughts!



Guile-VM is a bytecode compiler and virtual machine for Guile.

guile-vm 0.7 -- 2008-05-20

* Initial release with NEWS.

* Revived from Keisuke Nishida's Guile-VM project from 2000-2001, with
  the help of Ludovic Courtès.

* Meta-level changes
** Updated to compile with Guile 1.8.
** Documentation updated, including documentation on the instructions.
** Added benchmarking and a test harness.

* Changes to the inventory
** Renamed the library from libguilevm to libguile-vm.
** Added new executable script, guile-disasm.

* New features
** Add support for compiling macros, both defmacros and syncase macros.
Primitive macros produced with the procedure->macro family of procedures
are not supported, however.
** Improvements to the REPL
Multiple values support, readline integration, ice-9 history integration
** Add support for eval-case
The compiler recognizes compile-toplevel in addition to load-toplevel
** Completely self-compiling
Almost, anyway: not (system repl describe), because it uses GOOPS

* Internal cleanups
** Internal objects are now based on Guile records.
** Guile-VM's code doesn't use the dot-syntax any more.
** Changed (ice-9 match) for Kiselyov's pmatch.scm
** New instructions: define, link-later, link-now, late-variable-{ref,set}
** Object code now represented as u8vectors instead of strings.
** Remove local import of an old version of slib

* Bugfixes
** The `optimize' procedure is coming out of bitrot
** The Scheme compiler is now more strict about placement of internal
** set! is now compiled differently from define
** Module-level variables are now bound at first use instead of in the
   program prolog
** Bugfix to load-program (stack misinterpretation)

Copyright (C) 2008 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved.
>From a488aa59468f60133fc8767b3ffafa2e098bda4f Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
Date: Fri, 9 May 2008 13:07:32 +0200
Subject: [PATCH] make readline's `repl-reader' impl check the current-reader 

* guile-readline/ice-9/readline.scm (activate-readline): Use the current
  binding of the current-reader fluid, if it is available.
 guile-readline/ice-9/readline.scm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/guile-readline/ice-9/readline.scm 
index 363b7c0..dce7755 100644
--- a/guile-readline/ice-9/readline.scm
+++ b/guile-readline/ice-9/readline.scm
@@ -212,7 +212,7 @@
                       (set-buffered-input-continuation?! (readline-port) #f)
                      (set-readline-prompt! prompt "... ")
                      (set-readline-read-hook! read-hook))
-                   (lambda () (read))
+                   (lambda () ((or (fluid-ref current-reader) read)))
                    (lambda ()
                      (set-readline-prompt! "" "")
                      (set-readline-read-hook! #f)))))

>From 69fc67efaad628a866e14ead4cb96f102316b82b Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
Date: Fri, 9 May 2008 16:42:44 +0200
Subject: [PATCH] support thunks as prompts, as readline does.

* ice-9/boot-9.scm (repl-reader): Support thunks as prompts.
 ice-9/boot-9.scm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm
index d1e6306..b92cfd6 100644
--- a/ice-9/boot-9.scm
+++ b/ice-9/boot-9.scm
@@ -2518,7 +2518,7 @@
 ;;; the readline library.
 (define repl-reader
   (lambda (prompt)
-    (display prompt)
+    (display (if (string? prompt) prompt (prompt)))
     (run-hook before-read-hook)
     ((or (fluid-ref current-reader) read) (current-input-port))))

>From d0c2de85c139319a34718984855ec9f07f958ede Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
Date: Mon, 19 May 2008 12:19:28 +0200
Subject: [PATCH] Support loading of compiled syncase macros

* ice-9/syncase.scm (current-eval-closure): New procedure.
  (env->eval-closure): Don't default to the root module: if we have no
  environment, we default to the current module via the logic in
  current-eval-closure. This is because psyntax's compilation mode
  doesn't know about guile modules, and thus won't dump the code to
  twiddle the current eval closure.
  (putprop, getprop, guile-macro): Use `current-eval-closure'.
  At the end, leave the expansion-eval-closure set to #f.
 ice-9/syncase.scm |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ice-9/syncase.scm b/ice-9/syncase.scm
index 6ee4d16..d3e5bb5 100644
--- a/ice-9/syncase.scm
+++ b/ice-9/syncase.scm
@@ -35,11 +35,12 @@
 (define expansion-eval-closure (make-fluid))
+(define (current-eval-closure)
+  (or (fluid-ref expansion-eval-closure)
+      (module-eval-closure (current-module))))
 (define (env->eval-closure env)
-  (or (and env
-          (car (last-pair env)))
-      (module-eval-closure the-root-module)))
+  (and env (car (last-pair env))))
 (define sc-macro
@@ -107,7 +108,7 @@
 (fluid-set! expansion-eval-closure the-syncase-eval-closure)
 (define (putprop symbol key binding)
-  (let* ((eval-closure (fluid-ref expansion-eval-closure))
+  (let* ((eval-closure (current-eval-closure))
         ;; Why not simply do (eval-closure symbol #t)?
         ;; Answer: That would overwrite imported bindings
         (v (or (eval-closure symbol #f) ;lookup
@@ -122,7 +123,7 @@
     (set-object-property! v key binding)))
 (define (getprop symbol key)
-  (let* ((v ((fluid-ref expansion-eval-closure) symbol #f)))
+  (let* ((v ((current-eval-closure) symbol #f)))
     (and v
         (or (object-property v key)
             (and (variable-bound? v)
@@ -137,7 +138,7 @@
            (if (symbol? e)
                ;; pass the expression through
-               (let* ((eval-closure (fluid-ref expansion-eval-closure))
+               (let* ((eval-closure (current-eval-closure))
                       (m (variable-ref (eval-closure (car e) #f))))
                  (if (eq? (macro-type m) 'syntax)
                      ;; pass the expression through
@@ -244,4 +245,4 @@
        ;(eval-case ((load-toplevel) (export-syntax name)))
        (define-syntax name rules ...)))))
-(fluid-set! expansion-eval-closure (env->eval-closure #f))
+(fluid-set! expansion-eval-closure #f)

>From 59ca82b1c15835d413d08e74997fb25464d248c9 Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
Date: Mon, 19 May 2008 12:21:53 +0200
Subject: [PATCH] update INSTALL

* INSTALL: update.
 INSTALL |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/INSTALL b/INSTALL
index 5458714..d3c5b40 100644
@@ -2,7 +2,7 @@ Installation Instructions
 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
+2006, 2007 Free Software Foundation, Inc.
 This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
@@ -67,6 +67,9 @@ The simplest way to compile this package is:
      all sorts of other programs in order to regenerate files that came
      with the distribution.
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
 Compilers and Options

>From 469224129436b576a231cb14b6fb0ade8aa068e6 Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
Date: Mon, 19 May 2008 12:23:46 +0200
Subject: [PATCH] make has-suffix? use string-suffix?

* ice-9/boot-9.scm (has-suffix?): Use the core / srfi-13's
 ice-9/boot-9.scm |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm
index b92cfd6..c8b9ab6 100644
--- a/ice-9/boot-9.scm
+++ b/ice-9/boot-9.scm
@@ -569,10 +569,7 @@
 (define (has-suffix? str suffix)
-  (let ((sufl (string-length suffix))
-       (sl (string-length str)))
-    (and (> sl sufl)
-        (string=? (substring str (- sl sufl) sl) suffix))))
+  (string-suffix? suffix str))
 (define (system-error-errno args)
   (if (eq? (car args) 'system-error)

>From 9a44c262d2ff8fb625ca0dafda57d4902a4d9c50 Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
Date: Mon, 19 May 2008 12:26:20 +0200
Subject: [PATCH] add compile-toplevel and evaluate conditions to eval-case

* ice-9/boot-9.scm (eval-case): Define two more conditions:
  compile-toplevel and evaluate, as common lisp and chez scheme do.
  (defmacro, define-option-interface, define-macro, define-syntax-macro)
  (define-module, use-modules, use-syntax, define-public)
  (defmacro-public, export, re-export): Add `compile-toplevel' to all
  uses of eval-case.
 ice-9/boot-9.scm |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm
index c8b9ab6..f6fd6fb 100644
--- a/ice-9/boot-9.scm
+++ b/ice-9/boot-9.scm
@@ -92,9 +92,11 @@
 ;; (eval-case ((situation*) forms)* (else forms)?)
 ;; Evaluate certain code based on the situation that eval-case is used
-;; in.  The only defined situation right now is `load-toplevel' which
-;; triggers for code evaluated at the top-level, for example from the
-;; REPL or when loading a file.
+;; in. There are three situations defined. `load-toplevel' triggers for
+;; code evaluated at the top-level, for example from the REPL or when
+;; loading a file. `compile-toplevel' triggers for code compiled at the
+;; toplevel. `execute' triggers during execution of code not at the top
+;; level.
 (define eval-case
@@ -151,7 +153,7 @@
          (lambda (name parms . body)
            (let ((transformer `(lambda ,parms ,@body)))
-               ((load-toplevel)
+                ((load-toplevel compile-toplevel)
                 (define ,name (defmacro:transformer ,transformer)))
                 (error "defmacro can only be used at the top level")))))))
@@ -2257,8 +2259,8 @@
            (define ,(caddr options/enable/disable)
              ,(make-disable interface))
            (defmacro ,(caaddr option-group) (opt val)
-             `(,,(car options/enable/disable)
-               (append (,,(car options/enable/disable))
+             `(,',(car options/enable/disable)
+               (append (,',(car options/enable/disable))
                        (list ',opt ,val))))))))))
@@ -2699,7 +2701,7 @@
             (car rest)
             `(lambda ,(cdr first) ,@rest))))
-      ((load-toplevel)
+      ((load-toplevel compile-toplevel)
        (define ,name (defmacro:transformer ,transformer)))
        (error "define-macro can only be used at the top level")))))
@@ -2712,7 +2714,7 @@
             (car rest)
             `(lambda ,(cdr first) ,@rest))))
-      ((load-toplevel)
+      ((load-toplevel compile-toplevel)
        (define ,name (defmacro:syntax-transformer ,transformer)))
        (error "define-syntax-macro can only be used at the top level")))))
@@ -2827,7 +2829,7 @@
 (defmacro define-module args
-    ((load-toplevel)
+    ((load-toplevel compile-toplevel)
      (let ((m (process-define-module
               (list ,@(compile-define-module-args args)))))
        (set-current-module m)
@@ -2852,7 +2854,7 @@
 (defmacro use-modules modules
-    ((load-toplevel)
+    ((load-toplevel compile-toplevel)
       (list ,@(map (lambda (m)
                     `(list ,@(compile-interface-spec m)))
@@ -2863,7 +2865,7 @@
 (defmacro use-syntax (spec)
-    ((load-toplevel)
+    ((load-toplevel compile-toplevel)
      ,@(if (pair? spec)
           `((process-use-modules (list
                                   (list ,@(compile-interface-spec spec))))
@@ -2893,7 +2895,7 @@
     (let ((name (defined-name (car args))))
         (define-private ,@args)
-        (eval-case ((load-toplevel) (export ,name))))))))
+        (eval-case ((load-toplevel compile-toplevel) (export ,name))))))))
 (defmacro defmacro-public args
   (define (syntax)
@@ -2908,7 +2910,7 @@
     (let ((name (defined-name (car args))))
-        (eval-case ((load-toplevel) (export-syntax ,name)))
+        (eval-case ((load-toplevel compile-toplevel) (export-syntax ,name)))
         (defmacro ,@args))))))
 ;; Export a local variable
@@ -2947,7 +2949,7 @@
 (defmacro export names
-    ((load-toplevel)
+    ((load-toplevel compile-toplevel)
       (lambda ()
        (module-export! (current-module) ',names))))
@@ -2956,7 +2958,7 @@
 (defmacro re-export names
-    ((load-toplevel)
+    ((load-toplevel compile-toplevel)
       (lambda ()
        (module-re-export! (current-module) ',names))))


reply via email to

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