Subject: Re: gc choice / design patterns
From: (Rob Warnock)
Date: Sat, 12 Oct 2002 05:16:46 -0500
Newsgroups: comp.lang.scheme
Message-ID: <TeGdndJwX_UTazqgXTWcpQ@News.GigaNews.Com>
Tom Lord <> wrote:
| * avoid barriers
|    On non-exotic hardware, read and write barriers are expensive
|    because you shouldn't mix conditional execution with mutation and
|    access. ...

Overly harsh. Software write barriers using card marking
(often used in generational collectors) do not *need*[1]
conditionals, though they do need at least one "fire & forget"
store, but that can be quite cheap). Se, for example:



[1] When the code "knows" (either from type analysis, or control flow --
    such as going through a particular case branch) that the item being
    stored is not a pointer, the write barrier store can be safely
    skipped, and conversely. When the conditional test would be "cheap"
    (e.g., the type of the object is already in a register), then...
    it would be cheap. When the conditional test would be "expensive",
    then an unconditional write barrier store can be safely done, at
    some small cost (to scan one card) during the next GC. In short,
    software write barriers can be very cheap.

Rob Warnock, PP-ASEL-IA		<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607