GC in multithreaded (but with no shared state) environment

Hi all,

I would like to implement GC for a language supporting multiple threads. There will be no shared state between threads as communication will be based on message passing. I do not care much about performance. The priority for me is to get things working.

I have read LLVM guide on writing GC: http://llvm.org/docs/GarbageCollection.html. Shadow stack approach looks very promising. The problem is, as described in the guide, shadow stack is single thread solution. It would be ideal if I could get LLVM to create a shadow stack on per thread basis. How could this be achieved?

Thanks,
Paweł.

I already did this for HLVM. Check it out:

http://www.ffconsultancy.com/ocaml/hlvm/

After reading http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-November/027391.html, I was hoping that there exists a way to overwrite the head of LLVM’s shadow stack to make it thread local and that it would magically just work…

Note that I used per-thread shadow stacks but none of the LLVM GC support. I used a technique similar to Henderson’s accurate garbage collection in an uncooperative environment.

Thanks, I’ll definitely take a look at your work and the paper you mentioned.

Paweł.