From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: Clearing stale references from the stack
Date: Tue, 31 Jan 2012 21:46:02 +0100 [thread overview]
Message-ID: <87y5sntxbp.fsf@pobox.com> (raw)
In-Reply-To: <87wr87eoo4.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 31 Jan 2012 19:02:03 +0100")
Hello :-)
On Tue 31 Jan 2012 19:02, ludo@gnu.org (Ludovic Courtès) writes:
> "Andy Wingo" <wingo@pobox.com> skribis:
>
>> +;; Recurse through a C function that should clear any values that might
>> +;; have spilled on the stack temporarily. (The salient feature of
>> +;; with-continuation-barrier is that currently it is implemented as a C
>> +;; function that recursively calls the VM.)
>> +;;
>> +(define* (clear-stale-stack-references #:optional (n 10))
>> + (if (positive? n)
>> + (with-continuation-barrier
>> + (lambda ()
>> + (clear-stale-stack-references (1- n))))))
>> +
>> ;;; Call THUNK with a given locale
>> (define (with-locale* nloc thunk)
>> (let ((loc #f))
>> diff --git a/test-suite/tests/gc.test b/test-suite/tests/gc.test
>> index 97eeb19..1afcea3 100644
>> --- a/test-suite/tests/gc.test
>> +++ b/test-suite/tests/gc.test
>> @@ -49,13 +49,6 @@
>> ;;;
>> ;;;
>>
>> -(define (stack-cleanup depth)
>> - ;; Clean up stack space for DEPTH words. This is defined here so that
>> - ;; `peval' doesn't inline it.
>> - (let cleanup ((i depth))
>> - (and (> i 0)
>> - (begin (cleanup (1- i)) i))))
>> -
>
> Note that ‘1-’ here is a subr call (because ‘stack-cleanup’ is
> interpreted), so both procedures may have a similar effect, no?
I don't think so. The question for me is, how far up the C stack does
this get? For `stack-cleanup' (I have to learn how to type those nice
quotes some day), there will never be more than one `1-' frame active on
the C stack. With clear-stale-stack-references, there will be `depth'
many.
I think!
Andy
--
http://wingolog.org/
prev parent reply other threads:[~2012-01-31 20:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1RsH2V-0001Rk-WB@vcs.savannah.gnu.org>
2012-01-31 18:02 ` Clearing stale references from the stack Ludovic Courtès
2012-01-31 20:46 ` Andy Wingo [this message]
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=87y5sntxbp.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).