mit-scheme-devel
[Top][All Lists]
Advanced

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

Re: [MIT-Scheme-devel] reference barriers


From: Chris Hanson
Subject: Re: [MIT-Scheme-devel] reference barriers
Date: Sat, 14 Aug 2010 22:07:54 -0700

Sounds fine to me.

On Fri, Aug 13, 2010 at 4:27 PM, Taylor R Campbell <address@hidden> wrote:
> I'd like to add a procedure called REFERENCE-BARRIER to the system.
> (REFERENCE-BARRIER <x>) has the consequence that whatever the value of
> <x>, the garbage collector must not reclaim the storage of anything
> strongly referenced by <x> until after the call to REFERENCE-BARRIER.
>
> For example, the following is always true:
>
> (let* ((p (cons 0 0))
>       (wp (weak-cons p 0)))
>  (gc-flip)
>  (let ((result (weak-pair/car? wp)))
>    (reference-barrier p)
>    result))
>
> By contrast, this may yield true or false:
>
> (let* ((p (cons 0 0))
>       (wp (weak-cons p 0)))
>  (gc-flip)
>  (weak-pair/car? wp))
>
> Interpreted, it usually yields true; compiled, false.
>
> I have been using IDENTITY-PROCEDURE for REFERENCE-BARRIER, because it
> usually results in a general procedure call, with the desired
> consequences.  However, some day IDENTITY-PROCEDURE may be integrated,
> losing that property.  Even if IDENTITY-PROCEDURE never lost that
> property, it would be nice if REFERENCE-BARRIER could be open-coded
> (and eliminated altogether if the compiler can prove it unnecessary
> within a block of code).  For now, REFERENCE-BARRIER can just be an
> alias to IDENTITY-PROCEDURE.
>
> Comments?
>
> _______________________________________________
> MIT-Scheme-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/mit-scheme-devel
>



reply via email to

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