[Mono-devel-list] Typed allocation facility in runtime

Paolo Molaro lupus at ximian.com
Fri Apr 4 11:39:06 EST 2003


On 04/03/03 Varga Zoltan wrote:
>   I added an experimental typed allocation facility to the
> runtime. Typed
> allocation means the Boehm collector knows the layout of
> heap allocated
> objects and known which words can hold pointers and which do
> not. This
> speeds up collection since fewer memory locations needs to
> be examined,
> and it also decreases the working set of applications since
> fewer false
> pointers are encountered by the collector. Typed allocation
> can be turned
> on by setting CREATION_SPEEDUP to 1 in metadata/object.c. 
> This change speeds up corlib compilation by about 10% on my
> machine.
> I would appreciate if people would test this. If it works,
> it can be made
> the default.

Zoltan, excellent work, thanks!
I used:
#ifdef GC_GCJ_SUPPORT
#define CREATION_SPEEDUP 1
#endif
Can you check this will enable the optimization for you?
My libgc doesn't have the support for typed allocations and without
the check the compilation fails with a link error.

As for the patch:
the check:
+               /* GC has trouble handling 64 bit descriptors... */
+               if ((class->instance_size / sizeof (gpointer)) > 30) {

should be done before performing all the work to compute the bitmap, I
guess.
Also, code like:
		bitmap = 2; /* sync struct */
should use G_STRUCT_OFFSET (MonoObject,synchronisation) / sizeof(gpointer)
so that if for some reason the structure is changed a recompilation is
enough to keep it working. Same for the MonoArrayBounds structure.
It might also make sense to put the MonoArrayBounds structure
at the end of the array, so that a single allocation is enough and if
there are no references in the array item, the whole memory will be
pointer free.

When I'll convince Dick to put a list of synch structs in the thread
object, we'll also be able to remove that bit from the bitmap and
strings will be pointer-free, too:-)

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list