Paweł Batko
2014-Feb-17 07:27 UTC
[LLVMdev] 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ł. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140217/354c736f/attachment.html>
Jon Harrop
2014-Feb-17 10:31 UTC
[LLVMdev] GC in multithreaded (but with no shared state) environment
I already did this for HLVM. Check it out: http://www.ffconsultancy.com/ocaml/hlvm/ 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. Parallel performance was extremely good: http://flyingfrogblog.blogspot.com/2010/01/naive-parallelism-with-hlvm.html HLVM can be faster than Java, Haskell, OCaml, MLton and almost as fast as C/C++: http://flyingfrogblog.blogspot.com/2010/01/hlvm-on-ray-tracer-language-comparison.html The design of HLVM is very simple. The GC that handles concurrent mutators is only 100 lines of code. The entire garbage collected VM is only 2,000 lines of OCaml code. Cheers, Jon. On Mon, Feb 17, 2014 at 7:27 AM, Paweł Batko <pawel.batko at gmail.com> wrote:> 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ł. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140217/bdab0957/attachment.html>
Paweł Batko
2014-Feb-17 18:42 UTC
[LLVMdev] GC in multithreaded (but with no shared state) environment
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 GCsupport. 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ł. 2014-02-17 11:31 GMT+01:00 Jon Harrop <jonathandeanharrop at googlemail.com>:> I already did this for HLVM. Check it out: > > http://www.ffconsultancy.com/ocaml/hlvm/ > > 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. > > Parallel performance was extremely good: > > http://flyingfrogblog.blogspot.com/2010/01/naive-parallelism-with-hlvm.html > > HLVM can be faster than Java, Haskell, OCaml, MLton and almost as fast as > C/C++: > > > http://flyingfrogblog.blogspot.com/2010/01/hlvm-on-ray-tracer-language-comparison.html > > The design of HLVM is very simple. The GC that handles concurrent mutators > is only 100 lines of code. The entire garbage collected VM is only 2,000 > lines of OCaml code. > > Cheers, > Jon. > > On Mon, Feb 17, 2014 at 7:27 AM, Paweł Batko <pawel.batko at gmail.com>wrote: > >> 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ł. >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140217/90ca8ce7/attachment.html>