[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MIT-Scheme-devel] reference barriers
From: |
Taylor R Campbell |
Subject: |
[MIT-Scheme-devel] reference barriers |
Date: |
Fri, 13 Aug 2010 23:27:32 +0000 |
User-agent: |
IMAIL/1.21; Edwin/3.116; MIT-Scheme/9.0.1 |
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] reference barriers,
Taylor R Campbell <=