unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: "Neil Jerram" <neiljerram@googlemail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: vm branch now uses vm repl by default
Date: Tue, 09 Sep 2008 19:59:50 +0200	[thread overview]
Message-ID: <m3sks96vzd.fsf@pobox.com> (raw)
In-Reply-To: <49dd78620809090127y1ffac216ve34cdc5bb2a426ab@mail.gmail.com> (Neil Jerram's message of "Tue, 9 Sep 2008 09:27:32 +0100")

Hi,

On Tue 09 Sep 2008 10:27, "Neil Jerram" <neiljerram@googlemail.com> writes:

> 2008/9/9 Andy Wingo <wingo@pobox.com>:
>
>>    scheme@(guile-user)> (lambda () (pk a #:bar))
>>    $2 = #<program b755ecf8>
>>    scheme@(guile-user)> ,x $2
>>    Disassembly of #<program b755ecf8>:
>>
>>    nargs = 0  nrest = 0  nlocs = 0  nexts = 0
>>
>>    Bytecode:
>>
>>       0    (late-variable-ref 0)
>>       2    (late-variable-ref 1)
>>       4    (object-ref 2)                  ;; #:bar
>>       6    (tail-call 2)
>>
>>    Objects:
>>
>>       0    #<variable b80057f0 value: #<program b8005858>>
>>       1    #<variable b7569af0 value: (a . pair)>
>>       2    #:bar
>
> Where in the bytecode is `pk', or some kind of reference to it?

It's object 0:

    scheme@(guile-user)> ,x (lambda () (pk a #:bar))
    Disassembly of #<program b7fedfc8>:

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

    Bytecode:

       0    (late-variable-ref 0)
       2    (late-variable-ref 1)
       4    (object-ref 2)                  ;; #:bar
       6    (tail-call 2)

    Objects:

       0    pk
       1    a
       2    #:bar

    Sources:

       8    #(0 14 #f)

The objects are stored in a vector. When late-variable-ref or -set is
called and the top of the stack is a symbol, it gets looked up and the
resulting variable replaced into where the symbol was. See:

   http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=libguile/vm-i-system.c;h=54689116942bc5d5f942ebcc6500e1e9b610e4c9;hb=refs/heads/vm#l262

Andy
-- 
http://wingolog.org/




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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09  6:48 vm branch now uses vm repl by default Andy Wingo
2008-09-09  8:27 ` Neil Jerram
2008-09-09 17:59   ` Andy Wingo [this message]
2008-09-09 22:27     ` Neil Jerram
2008-09-09  8:41 ` Ludovic Courtès
2008-09-09 18:13   ` Andy Wingo
2008-09-09 21:01     ` Ludovic Courtès
2008-09-10 19:05       ` Andy Wingo
2008-09-09 22:43 ` Neil Jerram
2008-09-10 18:51   ` Andy Wingo
2008-09-10 21:24     ` Neil Jerram

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=m3sks96vzd.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=neiljerram@googlemail.com \
    /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).