* Clearing stale references from the stack
[not found] <E1RsH2V-0001Rk-WB@vcs.savannah.gnu.org>
@ 2012-01-31 18:02 ` Ludovic Courtès
2012-01-31 20:46 ` Andy Wingo
0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2012-01-31 18:02 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
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’.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Clearing stale references from the stack
2012-01-31 18:02 ` Clearing stale references from the stack Ludovic Courtès
@ 2012-01-31 20:46 ` Andy Wingo
0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2012-01-31 20:46 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guile-devel
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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-31 20:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 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).