Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Garbage-collectors for multi-core llvm?

I've been looking at LLVM for quite some time as a new back-end for the language I'm currently implementing. It seems to have good performance, rather high-level generation APIs, enough low-level support to optimize exotic optimizations. In addition, and although I haven't checked it myself, Apple seems to have successfully demonstrated the use of LLVM for garbage-collected multi-core programs.

So far, so good. As I'm interested in both garbage-collection and multi-core, the next step would be to choose a LLVM multi-core-able garbage-collector. Which brings me to the question: what is available? I'm aware of Jon Harrop's HLVM work, but that's about it.

Note that I need cross-platform, so Apple's GC is probably not what I'm looking for (unless there's a cross-platform version). Also note that I have nothing against stop-the-world garbage-collectors.

Thanks in advance, Yoric

like image 850
Yoric Avatar asked Feb 16 '10 07:02

Yoric


1 Answers

LLVM docs say that it does not support multi-threaded collectors yet.

As the matrix indicates, LLVM's garbage collection infrastructure is already suitable for a wide variety of collectors, but does not currently extend to multithreaded programs. This will be added in the future as there is interest.

The docs do say that to do multi-threaded garbage collection you need to stop the world and that this is a non-portable thing:

Threaded Denotes a multithreaded mutator; the collector must still stop the mutator ("stop the world") before beginning reachability analysis. Stopping a multithreaded mutator is a complicated problem. It generally requires highly platform specific code in the runtime, and the production of carefully designed machine code at safe points.

However, shared state between threads is a nasty scaling issue. If your language communicates solely through message passing between 'tasks', and therefore there was no shared state between worker threads, then you could use a per-thread collector for the per-thread heap?

like image 90
Will Avatar answered Oct 16 '22 14:10

Will