Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
HLVM is now garbage collected!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-03-08 (01:13)
From: Jon Harrop <jon@f...>
Subject: HLVM is now garbage collected!

Well, I have my first working GC running in HLVM now! Woohoo!

The implementation has some interesting properties:

. The GC is written entirely in HLVM's own intermediate language.

. When a new type is defined a new function to traverse that type is JIT 
compiled. So code for the GC is generated on-the-fly.

. The GC is very simple and uses a shadow stack to track roots and an 
allocated list that stores all heap allocated locations and their mark bit.

. When the GC gets involved, performance is currently awful. Two simple 
optimizations will go a long way to curing this: touch the shadow stack only 
when necessary, and do something cleverer than the current linear lookup (!) 
of allocated pointers in the GC.

. When the heap is deep the current GC stack overflows because it is not tail 
recursive. This is easily fixed.

I have applied to the OCaml Forge to create a new project for HLVM where I 
will upload my initial prototype. Just as soon as my French gets good enough 
to understand this automated e-mail... ;-)

Dr Jon Harrop, Flying Frog Consultancy Ltd.