From: ludo@gnu.org (Ludovic Courtès)
To: "Andy Wingo" <wingo@pobox.com>
Cc: guile-devel@gnu.org
Subject: Clearing stale references from the stack
Date: Tue, 31 Jan 2012 19:02:03 +0100 [thread overview]
Message-ID: <87wr87eoo4.fsf@gnu.org> (raw)
In-Reply-To: <E1RsH2V-0001Rk-WB@vcs.savannah.gnu.org> (Andy Wingo's message of "Tue, 31 Jan 2012 16:58:40 +0000")
Hi!
"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?
Thanks,
Ludo’.
next parent reply other threads:[~2012-01-31 18:02 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 ` Ludovic Courtès [this message]
2012-01-31 20:46 ` Clearing stale references from the stack 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=87wr87eoo4.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-devel@gnu.org \
--cc=wingo@pobox.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).