unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: full moon, vm status update
Date: Thu, 16 Oct 2008 23:21:33 +0200	[thread overview]
Message-ID: <m3ljwofd7m.fsf@pobox.com> (raw)
In-Reply-To: <87y70owdeq.fsf@gnu.org> ("Ludovic Courtès"'s message of "Thu, 16 Oct 2008 21:25:17 +0200")

Howdy,

On Thu 16 Oct 2008 21:25, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@pobox.com> writes:
>
>>   * The VM stack is now marked precisely.
>
> Did you mean stack frame objects that link `program' object invocations?
> I guess this stack is referenced by the C stack, so why does something
> special need to be done?

I mean that instead of using scm_mark_locations() to mark the active
region of the allocated VM stack (vp->stack_base to vp->sp), we use
vm.c:vm_mark_stack() to mark that region precisely.

>>   * There is a now a debugging mode, currently turned on, in which we
>>     try ensure that the top of the stack is non-NULL and that all
>>     elements past the top are set to NULL. There are a number of checks
>>     in various places that this is the case. The idea is to avoid lost
>>     references when GC runs, and the heap structure's idea of the VM
>>     registers is out of sync with what the VM regs actually are; or
>>     there is some sloppy programming somewhere. When turned off, this
>>     code incurs no overhead.
>>
>>     This mode helped to catch a number of stack GC bugs.
>
> Are you referring to leaks due to a stack that contains references to
> Scheme objects that have not been overwritten for a while?  Or are there
> other bugs?

For example, the fix to libguile/vm-engine.h:POP_LIST in 11ea1aba9eb9.

  (POP_LIST): Hoo, fix a good bug: if CONS triggered a GC, the elements
  of the list that had not yet been consed would not be marked, because
  the sp was already below them.

  @@ -275,10 +283,12 @@
   do                                             \
   {                                              \
     int i;                                       \
  -  SCM l = SCM_EOL;                             \
  -  sp -= n;                                     \
  -  for (i = n; i; i--)                          \
  -    CONS (l, sp[i], l);                                \
  +  SCM l = SCM_EOL, x;                          \
  +  for (i = n; i; i--)                           \
  +    {                                           \
  +      POP (x);                                  \
  +      CONS (l, x, l);                           \
  +    }                                           \
     PUSH (l);                                    \
   } while (0)

How's that for a hard-to-find bug!!! 

>>   * Actually the bit about all of the test suites passing was a lie in
>>     another respect: the elisp test fails, with a C stack overflow,
>>     indicating too much recursion into the interpreter.
>
> I've seen `elisp.test' trigger a stack overflow with the interpreter
> more often than any other test.  Don't know why.

I hacked around this -- see what I've pushed to vm for more info.

>> My goal is: correct execution of all existing code that:
>>   * does not do runtime side-effects in macros
>>   * does not call (the-environment)
>>   * does not unquote in values into macros
>
> How about code that does "(read-set! keywords 'prefix)" and the likes?
> :-)

Oooh, just because you do dastardly things with the reader ;) You are
right. Code that causes side effects to the reader will not cause those
side effects until after the rest of the file is read, even if you
(eval-case ((load-toplevel compile-toplevel) ...)) it.

For what you want, I suggest #!lang things and reader macros (neither of
which we have yet).

Cheers,

Andy
-- 
http://wingolog.org/




  reply	other threads:[~2008-10-16 21:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 21:48 full moon, vm status update Andy Wingo
2008-10-16  5:35 ` Julian Graham
2008-10-16 12:34   ` Andy Wingo
2008-10-16 19:25 ` Ludovic Courtès
2008-10-16 21:21   ` Andy Wingo [this message]
2008-10-18 10:26     ` Neil Jerram
2008-10-27 23:51       ` Neil Jerram
2008-10-31 17:54         ` Andy Wingo
2008-10-31 18:36           ` Andy Wingo
2008-10-31 19:51           ` Ludovic Courtès
2008-11-08  0:24           ` Neil Jerram
2009-01-04 13:08         ` Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
2008-10-16 18:41 dsmich

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=m3ljwofd7m.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@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).