[Top][All Lists]

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

Re: guile-vm status

From: Ludovic Courtès
Subject: Re: guile-vm status
Date: Mon, 19 May 2008 21:57:39 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)


Andy Wingo <address@hidden> writes:

> So really, we are left with no information to write into the file,
> although the side effects do persist during compilation. Perhaps there
> is a better way to do this, but I suspect it involves compilation
> phases, which would have to be linked to whole-module compiles, I think.
> In the meantime, modules which export syncase macros probably shouldn't
> be compiled. Defmacros do not have this problem.

Maybe there should be a custom syncase expander in Guile-VM, one that's
more compilation-friendly?

> Ludovic commented recently (can't reply, because my mail setup is a bit
> borked atm, moving servers) about macro expansion. My perspective is
> this: existing Guile code is much like Common Lisp in its compilation
> model. We should support compilation of existing code using this model:
> eval-when and such things.

You mean `eval-case' as in `boot-9.scm', right?

> Phased compilation a la r6rs is also interesting, but should be
> implemented once phase 1 works.

Yes, surely.  But it'd be nice to make most current macros somehow work
out-of-the-box so that `eval-case' is rarely needed (easier said than
done, granted).

> Ludovic also mentioned the unusability of glil-pprint or whatever that
> was. I normally just use the guile-vm repl's compile and disassemble
> meta-commands, which is why I haven't seen it. I haven't fixed that
> pprint yet.

One of the attached patches fixes it (this stems from `#f' locations
passed to `push-call!' as introduced in patch 67169b29).

> Comments appreciated, regarding macro expansion, or the changes to the
> semantics of `link', or whatever! More than anything, check it out and
> give it a try:

The change of `link' makes sense.  If I understood it correctly, the
attached patch updates its documentation (which is nice to keep
up-to-date IMO).

Now, it appears that `use-modules' forms are not properly expanded:

  guile> (use-modules (system il compile) (language scheme translate))
  guile> (define hi (translate '(use-modules (srfi srfi-9)) (make-module)))

  ;;; WARNING (during lookup of use-modules : #<module b7b06ed0> != current 
#<directory (guile-user) b7ca2b00>)
  guile> (define lo (compile hi (make-module)))
  guile> (use-modules (system il glil))
  guile> (pprint-glil lo)
  (@asm (0 0 0 0)
    (module-ref #<directory (guile-user) b7ca2b00> use-modules)
    (module-ref #<directory (guile-user) b7ca2b00> srfi)
    (module-ref #<directory (guile-user) b7ca2b00> srfi-9)
    (call 1)
    (@source #f #f)
    (tail-call 1)
    (@source #f #f))

IIRC, what would happen "before" is that the `use-modules' macro would
be expanded as in:

  guile> (macroexpand '(use-modules (srfi srfi-9)))
  (eval-case ((load-toplevel) (process-use-modules (list (list (quote (srfi 
srfi-9))))) *unspecified*) (else (error "use-modules can only be used at the 
top level")))

...  such that compiling `use-modules' forms would just work.

Any plans regarding this?  Of course, interpreting them at
compilation-time looks like a worthy goal, but just expanding the macro
seemed like a reasonable approach for "phase 1".



>From 0e0cc289695a618efa223a14c22fd2848fb7b6cc Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <address@hidden>
Date: Mon, 19 May 2008 21:36:35 +0200
Subject: [PATCH] Update documentation of `link' instruction.

* doc/guile-vm.texi (Environment Control Instructions): Update
  documentation of `link' to match the changes in commit
  6167de4f72d5aed29a73f3a4e7e6b4bfebe4287a entitled "`link' instruction
  links to symbols by module".
 doc/guile-vm.texi |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/guile-vm.texi b/doc/guile-vm.texi
index 927c09e..cdb8ff9 100644
--- a/doc/guile-vm.texi
+++ b/doc/guile-vm.texi
@@ -34,7 +34,7 @@ Record
 This file documents Guile VM.
 Copyright @copyright{} 2000 Keisuke Nishida
-Copyright @copyright{} 2005 Ludovic Court`es
+Copyright @copyright{} 2005, 2008 Ludovic Court`es
 Permission is granted to make and distribute verbatim copies of this
 manual provided the copyright notice and this permission notice are
@@ -359,11 +359,13 @@ useful calculations.
 @node Environment Control Instructions, Branch Instructions, Instruction Set, 
Instruction Set
 @section Environment Control Instructions
address@hidden @insn{} link binding-name
-Look up @var{binding-name} (a string) in the current environment and
-push the corresponding variable object onto the stack.  If
address@hidden is not bound yet, then create a new binding and
-push its variable object.
address@hidden @insn{} link binding-name module-name
+Look up @var{binding-name} (a string) in the module specified by
address@hidden (a list of symbols, as specified in @pxref{General
+Information about Modules,,, guile}) or in the current module if
address@hidden is @code{#f}; push the corresponding variable
+object onto the stack.  If @var{binding-name} is not bound yet, then
+create a new binding and push its variable object.
 @end deffn
 @deffn @insn{} variable-ref

>From 77e561c656b011f78cc110fc0a1cea1c68e740b1 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <address@hidden>
Date: Mon, 19 May 2008 21:45:21 +0200
Subject: [PATCH] pprint-glil: Deal with `#f' as location information.

* module/system/il/glil.scm (pprint-glil): Allow LOC to be `#f' in
 module/system/il/glil.scm |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/module/system/il/glil.scm b/module/system/il/glil.scm
index 6a3ec4c..da4c77c 100644
--- a/module/system/il/glil.scm
+++ b/module/system/il/glil.scm
@@ -1,6 +1,6 @@
 ;;; Guile Low Intermediate Language
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2008 Free Software Foundation, Inc.
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -172,7 +172,8 @@
            ,@(map unparse body)))
     ((<glil-bind> vars) `(@bind ,@vars))
     ((<glil-unbind>) `(@unbind))
-    ((<glil-source> loc) `(@source ,(car loc) ,(cdr loc)))
+    ((<glil-source> loc)
+     `(@source ,(and loc (car loc)) ,(and loc (cdr loc))))
     ;; constants
     ((<glil-void>) `(void))
     ((<glil-const> obj) `(const ,obj))

reply via email to

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