[LLVMdev] Assorted notes on garbage collection with LLVM

Jon Harrop jonathandeanharrop at googlemail.com
Fri Aug 2 15:18:00 PDT 2013


 

Very good to see developments in LLVM+GC!

 

I wrote a high-level virtual machine with accurate garbage collection
(supporting multiple user threads) back in 2008. Fearing LLVM’s GC support
at that time, I used a naïve shadow stack, pushing local references as they
appeared (from function arguments, load instructions and allocations) onto a
thread-local stack and batch popping at function returns by resetting the
shadow stack pointer. I put a GC safe point at every function’s entry point.
HLVM prohibits loops (uses recursion instead with tail call elimination) so
no other GC safe points are needed. Thanks to this very simple design, the
single threaded implementation was about 20 lines of code and the
multithreading-capable one was about 100 lines of code.

 

My benchmarks showed that absolute performance was very good (better than
Java, MLton, OCaml and Haskell) and, in fact, just 15% slower than C++ in
this case:

 

 
http://flyingfrogblog.blogspot.co.uk/2010/01/hlvm-on-ray-tracer-language-com
parison.html

 

and scalability was also very good:

 

 
http://flyingfrogblog.blogspot.co.uk/2010/01/naive-parallelism-with-hlvm.htm
l

 

I believe your approach is potentially faster but substantially more
complicated so I would regard it as an optimization over the very simple
approach that I used. Therefore, it would be very interesting and valuable
see the performance advantages of your approach. Have you done any
benchmarks?

 

Cheers,

Jon.

 

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Michael Lewis
Sent: 02 August 2013 17:27
To: LLVMdev at cs.uiuc.edu
Subject: [LLVMdev] Assorted notes on garbage collection with LLVM

 

Hi all,

 

I've been working recently on a precise garbage collector which runs
alongside native code JITted by LLVM. Today marks the first time the GC has
passed its entire test suite as well as extensive soak tests in non-trivial
programs.

 

It's been an interesting and educational process, to say the least, and I've
run into quite a few things that might be useful to know for others tackling
similar projects.

 

I've compiled my notes on the subject here for posterity:

 

https://code.google.com/p/epoch-language/wiki/GarbageCollectionScheme

 

I'd be happy to field any questions about the adventure as well, although
that probably belongs off-list.

 

 

 

Thanks,

 

 

 - Mike

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130802/e4bd7f1c/attachment.html>


More information about the llvm-dev mailing list