unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: guile-devel <guile-devel@gnu.org>
Subject: vm status update
Date: Sat, 13 Sep 2008 17:59:12 +0200	[thread overview]
Message-ID: <m3bpysxcj3.fsf@pobox.com> (raw)

Hello,

A small update. Since I wrote last, the compiler now puts program
names in with program metadata, and programs print in a much more
human-readable fashion:

    scheme@(guile-user)> module-ref
    $2 = #<program module-ref (module name . rest)>

Some bugs were fixed in disassembly, allowing the addition of the
following two sections:

    scheme@(guile-user)> ,x module-ref
    [...]
    Arguments:

       0    local[0]: module
       1    local[1]: name
       2    local[2]: rest

    Bindings:

    8-58    local[3]: variable

    [...]

The arguments show how they are allocated. All local variables in a
frame are on the stack, within the frame structure, and are accessed by
index. The other possibility is that a variable is "external", that is,
lexically bound by some enclosed lambda -- these are allocated on the
heap.

The range on the left side of a bindings listing shows the range of
instructions in which that particular local variable is bound, and what
its name is.

Currently, local variables are not reused even if their dynamic extents
are non-contiguous -- an optimization to maybe make later. For example:

    scheme@(guile-user)> ,x (lambda () (let ((x 1)) x) (let ((y 2)) y))
    Disassembly of #<program #(0 14 #f) (x)>:

    nargs = 0  nrest = 0  nlocs = 2  nexts = 0

    Bytecode:

       0    (make-int8 1)                   ;; 1
       2    (local-set 0)
       4    (make-int8 2)                   ;; 2
       6    (local-set 1)
       8    (local-ref 1)
      10    (return)

    Bindings:

     2-4    local[0]: x
    6-11    local[1]: y                     ;; could reuse local 0

    Sources:

       2    #(0 14 #f)
       6    #(0 30 #f)

It seems that the argument printing code has a bug there -- nargs is 0,
but it still prints the program as having args (x).

An important bug was fixed when compiling `or' forms when the value
would be discarded, as in `(begin (or #t (error "what")) 4)' -- an extra
value would be left on the stack. You should recompile all your .go
files when you pull.

Currently I'm working on implementing multiple-values support, mostly as
in Ashley and Dybvig's paper,
http://repository.readscheme.org/ftp/papers/jmashley/lfp94.pdf. Instead
of having the multiple-value return address being a fixed offset behind
the normal return address in the instruction stream, however, I'm just
going to push the MV return address on the stack, behind the normal
return address.

If you are interested in helping with guile-vm, just download it and
give it a whirl, see if it works for you. If your program doesn't do
call/cc it should work fine. I'm interested in any bugs!

Cheers,

Andy
-- 
http://wingolog.org/




             reply	other threads:[~2008-09-13 15:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-13 15:59 Andy Wingo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-12-26 17:24 vm status update Andy Wingo
2008-12-28 22:50 ` Neil Jerram
2009-01-05 16:06   ` Ludovic Courtès
2009-01-05 16:45     ` Neil Jerram
2009-01-05 19:53       ` Ludovic Courtès
2009-01-05 17:57     ` Andy Wingo
2009-01-05 21:03       ` Ludovic Courtès
2009-01-06  9:52         ` Andy Wingo
2009-01-06 14:54           ` Ludovic Courtès
2009-01-11 17:35 Andy Wingo
2009-01-13  8:05 ` Ludovic Courtès
2009-02-14 22:32 Andy Wingo
2009-02-16 11:47 ` Marijn Schouten (hkBst)
2009-03-08 11:49 ` Neil Jerram
2009-03-10 21:36   ` Andy Wingo
2009-03-12 20:49     ` Neil Jerram
2009-03-06 19:52 Andy Wingo
2009-03-06 22:31 ` Ludovic Courtès
2009-03-08 22:40   ` Neil Jerram
2009-03-10 21:04     ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3bpysxcj3.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).