guile-devel
[Top][All Lists]
Advanced

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

further hacking on guile-vm


From: Andy Wingo
Subject: further hacking on guile-vm
Date: Mon, 12 May 2008 23:49:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Greetings!

So, I have been poking more at guile-vm. The focus of this patchset is
on repl usability. Download guile-vm, ./autogen.sh && ./configure &&
make, then run:

  $ ./env guile
  guile> (use-modules (system repl repl))
  guile> (start-repl 'scheme)
  Guile Scheme interpreter 0.5 on Guile 1.8.4
  Copyright (C) 2001-2008 Free Software Foundation, Inc.

  Enter `,help' for help.
  scheme@(guile-user)> 3
  $1 = 3
  scheme@(guile-user)> ,compile (lambda (x) (* x x))
  Disassembly of #<objcode b708d720>:

  nlocs = 0  nexts = 0

     0    (make-int8 64)                  ;; 64
     2    (link "*")
     5    (vector 0 1)                    ;; 1 element
     8    (make-int8 0)                   ;; 0
    10    (load-symbol "x")               ;; x
    13    (make-false)                    ;; #f
    14    (make-int8 0)                   ;; 0
    16    (list 0 3)                      ;; 3 elements
    19    (list 0 2)                      ;; 2 elements
    22    (list 0 1)                      ;; 1 element
    25    (make-int8 9)                   ;; 9
    27    (make-int8 0)                   ;; 0
    29    (make-int8 21)                  ;; 21
    31    (cons)
    32    (cons)
    33    (list 0 2)                      ;; 2 elements
    36    (load-program ##{89}#)
    47    (return)

  Bytecode ##{89}#:

     0    (object-ref 0)
     2    (variable-ref)
     3    (local-ref 0)
     5    (local-ref 0)
     7    (tail-call 2)

It's rather neat! There's a bit of preamble in the first bit, but
basically it compiles a "program" that has a prelude that loads up
constants and external linkages, and the actual lambda is in ##{89}##.

Of course, guile-vm can deal with much more complex code as well. It
can't deal with all guile code, but it's getting there.

Anyway, other than that, in this patchset there is something to make
`define' compile differently than `set'. I ended up making a new
instruction for `define', that's not `link'. Ludovic, or anyone else, if
you have any insights as to the wisdom or folly of this addition, they
are appreciated.

The following changes since commit f540e3271b55bd9e61165557c72d6ff8f9619e54:
  Andy Wingo (1):
        Replace ice-9 match's structures with guile's records

are available in the git repository at:

  http://wingolog.org/git/guile-vm.git master

Andy Wingo (14):
      multiple-values help for the repl; exports cleanups
      more exports cleanups
      readline integration for guile-vm
      ice-9 history integration
      fix to meta-reader's optional port argument
      pmatchify a cond for prettiness
      <foo>? -> foo?; some exports cleanups
      explicitly list exports instead of using define-public
      remove define-private
      only allow `define' at toplevel
      fixes so that typing asdfadfasff in the repl doesn't error
      replace cenv with things in <repl> and fluids; remove the `use' 
meta-command
      catch errors in the repl, with poor backtraces
      add env script

 env                                  |    4 +
 module/language/scheme/translate.scm |   25 ++++----
 module/system/base/compile.scm       |   22 ++++----
 module/system/base/syntax.scm        |   38 ++-----------
 module/system/il/compile.scm         |    2 +-
 module/system/il/ghil.scm            |  102 ++++++++++++++++++----------------
 module/system/il/glil.scm            |   42 ++++++++------
 module/system/repl/command.scm       |   69 +++++++----------------
 module/system/repl/common.scm        |   69 +++++++++++------------
 module/system/repl/describe.scm      |    8 +-
 module/system/repl/repl.scm          |   95 ++++++++++++++++++++++++++-----
 module/system/vm/assemble.scm        |   18 +++++-
 module/system/vm/core.scm            |   59 +++++++++++--------
 module/system/vm/frame.scm           |   17 +++--
 module/system/vm/trace.scm           |    9 ++-
 src/vm_loader.c                      |   31 +++++-----
 16 files changed, 331 insertions(+), 279 deletions(-)
 create mode 100755 env

Andy
-- 
http://wingolog.org/




reply via email to

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