guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clearing stale references from the stack


From: Ludovic Courtès
Subject: Clearing stale references from the stack
Date: Tue, 31 Jan 2012 19:02:03 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux)

Hi!

"Andy Wingo" <address@hidden> 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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]