[Gc] Ask for advice on small objects

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sun Mar 9 07:59:23 PST 2008


Hi,

my name is Juanjo and I am the maintainer of a Common-Lisp
implementation (http://ecls.sf.net). I am currently _not_ subscribed
to this mailing list, so I would appreciate all answers to be CC to my
email address above.

The point is that I have been working on several optimizations for my
lisp. The most important datatype in this language is a pair or a
"cons", which basically consists on two pointers, one to the current
list element and one to the rest of the list. I am currently testing
an implementation in which these types are represented as  (pointer +
1), where "pointer" is the output of GC_malloc(sizeof(word) * 2) and
points to the two words mentioned before, and the "1" is a bit that
marks this as a pointer to a pair. More precisely, the operation of
"consing" two objects looks as follows in C

void *cons(void *a, void *b) {
   void ** cons = GC_malloc(sizeof(void *) * 2);
   cons[0] = a;
   cons[1] = b;
   return (void*)((char*)cons + 1);
}

What I would like to know is:

1) Is this supported by the garbage collector? Will the type tag "1"
or pointer displacement cause problems for detecting live conses? Does
this work even without the option to detect interior pointers?

2) The garbage collector reports 16 bytes being allocated for every
cons. Is there a way to reduce this?

3) I tried using GC_CONS from gc_inl.h but this breaks the program. Is
this a known issue?

For stability reasons I am still using version 6.8. In general, though
I am a long time user of this garbage collector, I am not too familiar
with the plethora of options to build it. I would appreciate any other
hints to further improve performance.

BTW, thanks for this wonderful library and for all the work you put in it.

Juanjo

-- 
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com


More information about the Gc mailing list