[Gc] Alignment, Executable memory and MMX registers

Matt Bromberg doom_portfolio at yahoo.com
Sat Oct 16 19:20:44 PDT 2004

I am experimenting with using the garbage collector in
my compiler project.  The final code my compiler
generates is fasm compatible assembly on a Win32 X86
platform.  I link to your garbage collector via a
dynamic link (DLL) library.  My compiler makes
extensive use of Intel's SIMD instructions that use
the MMX registers and (eventually) the XMM registers. 
 My questions follow:

1) Do you include the MMX registers and/or the XMM
registers in your root set?  I currently push these
into a data segment prior to calling GC_malloc(), but
I wonder if this is necessary. (It may be anyway if
some of the C standard library stuff in my MS visual
C++ library uses the standard floating point library
instead of SSE instructions.)

2) For your Win32 port, can I execute machine
instructions written to allocated memory?  I'm
thinking of adding a JIT compilation mode to my
language and I'm concerned about WinXP SP 2 memory
security stuff. The only way I know how to make
allocated memory executable is using VirtualAlloc()
with the right permissions set.

3) I plan to allocate memory for the use of double
arrays that probably should be 16 byte aligned. Is
there an easy way to obtain my desired alignment with
GC_malloc() et. al..?

4) Since I'm not using C, but rather assembly and
linking in the garbage collector as a DLL is it
possible I will run into problems due to assumptions
concerning C compiled executables?  I must say I do
not fully understand the magic involved in how you get
the data segments into your root sets, especially if
libraries are loaded dynamically at run time.  I also
don't understand how you deal with the mutator messing
up the integrity of your marked data, unless you go
through the whole tree every time you garbage collect,
or possibly lock out memory locations and force an
interrupt or something.

Finally if no one else has said it,  I think this
whole effort is a God-send to free software
developers, and you have my heartfelt thanks.

Do you Yahoo!?
Declare Yourself - Register online to vote today!

More information about the Gc mailing list