[gclist] boehm (et al.) gc and assembly language [platform
indep. x86 -- for now :)]
Sat, 15 Nov 1997 13:58:19 -0500
At 12:57 AM 11/15/97 -0500, jd marrow wrote:
>more specifically, i wonder about the following:
>:: do i need to pay attention to anything other than data alignment in my
>use of BGC? (i assume that 32bit alignment of pointers is a requirement on
You don't necessarily need to maintain 32-bit pointer alignment (x86
doesn't require it) but this is probably the single biggest help to
the Boehm collector. If you can guarantee that you always have a
pointer (somewhere) to the beginning of each object that you are using,
then you don't need to treat interior pointers as pointers, and that
is also a big help.
>:: some of the generated code will be self-modifying; does (or can i make)
>BGC scan executable 'data'? what does BGC normally scan, and can i control
You are suggesting that you might embed pointers to data in a generated
code stream? The general case of this would require care; at least on
the x86, you can express a 32-bit (address) constant as a 32-bit constant,
and you can scan for that, though not necessarily appearing on a word
alignment. If you take this as far as code stored in allocated memory
branching to code stored in allocated memory, those would be PC-relative,
and that would be hard. In either case, you can also allocate a little
extra wart on the code that you generate, and store the pointers referenced
from the generated code, there, at normal pointer alignments, in normal
pointer formats. This trick is also archecture independent, and is pretty
near necessary anyway on RISC machines that lack 32-bit operands.
Since you're writing this yourself in assembly language, you can take
advantage of one more hook, namely allocation of pointer-free data
using "gc_malloc_atomic" which gives you storage that the garbage
collector belives contains no pointers (if you store pointers in it,
they will be ignored).
>:: are there any other [equally free] alternatives to BGC? (this being a
>personal experiment, i'd like to minimize costs... :) i'd also be interested
>in references to performance comparisons between BGC and other -- free or
>not -- GC systems...
The Boehm-Weiser collector is pretty good.