[Gc] GCJ, typed malloc, custom mark proc?

James Williams junk at giantblob.com
Sun Aug 2 04:49:45 PDT 2009


Hi,

I use Boehm GC as the garbage collector for a compiler and its runtime.
(http://giantblob.com/compiler/)

Currently I allocate objects that are definitely pointer free (strings, arrays
of non-pointers, objects with no pointers) with GC_malloc_atomic_ignore_off_page
and objects that may contain pointers with GC_malloc_ignore_off_page.

This works correctly but it's pretty slow: Oprofile reports that 45% of
execution time for the compiler is spent in libgc. I'd really like to try and
reduce this.

I obviously know the exact memory layout of every object I allocate (and
additionally I could easily also tell the collector what words in each stack
frame could be pointers).

What is the best way to communicate this information to the collector?

I've tried using GC_gcj_malloc without success - even if I use size descriptors
that cover the whole object or bitmaps with bits for all words in the object set
the collector still frees reachable objects. I'm pretty sure my descriptors are
right - I'm basing my code on the fake_vtable structs in tests/test.c and
reading libjava source.

Should I expect this to work? Would I be better using typed malloc or a custom
mark function?

Any advice gratefully received, thanks,
-- James Williams

 



More information about the Gc mailing list