多核 llvm 的垃圾收集器?
我已经将 LLVM 作为我当前正在实现的语言的新后端来研究很长一段时间了。它似乎具有良好的性能,相当高级的生成API,足够的低级支持来优化奇异的优化。另外,虽然我自己没有检查过,但Apple似乎已经成功演示了LLVM对于垃圾收集多核程序的使用。
到目前为止,一切都很好。由于我对垃圾收集和多核都感兴趣,下一步是选择 LLVM 多核垃圾收集器。这让我想到一个问题:有什么可用的?我知道 Jon Harrop 的 HLVM 工作,但仅此而已。
请注意,我需要跨平台,因此 Apple 的 GC 可能不是我正在寻找的(除非有跨平台版本)。另请注意,我并不反对停止世界垃圾收集器。
提前致谢, 约里克
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
LLVM 文档说它不支持多线程收集器 还< /em>.
文档确实说要进行多线程垃圾收集,您需要停止世界,这是一个不可移植的东西:
然而,线程之间的共享状态是一个令人讨厌的扩展问题。如果您的语言仅通过“任务”之间传递消息进行通信,因此工作线程之间没有共享状态,那么您可以对每个线程堆使用每个线程收集器吗?
LLVM docs say that it does not support multi-threaded collectors yet.
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:
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?
Will 引用的内容是关于 LLVM 对 GC 的内在支持,您可以使用 C++ 代码来增强 LLVM,告诉它如何遍历堆栈、解释堆栈帧、注入读写屏障等等。我的 HLVM 项目的主要目标是以最小的努力和风险变得有用,所以我选择将影子堆栈用于“不合作环境”,以避免对 LLVM 不成熟的内部结构进行黑客攻击。因此,有关 LLVM 对 GC 的内在支持的那些声明不适用于 HLVM 的垃圾收集器,因为它根本不使用该基础设施。我的结果非常引人注目:您可以用最少的努力实现出色的性能 (串行性能和并行性能 )。
我相信 HLVM 已经可以在包括 Mac OS X 在内的 Unix 上开箱即用地运行,因为它仅需要 POSIX 线程。我强烈不同意编写 stop-the-world GC 很困难的说法:我花了 5 天时间编写了一个 100 行多核垃圾收集器,而且我对计算机几乎一无所知。我不敢相信移植到 Windows 也会很困难。
The quotes that Will gave are about LLVM's intrinsic support for GC, where you augment LLVM with C++ code telling it how to walk the stack, interpret stack frames, inject read and write barriers and so on. The primary goal of my HLVM project is to become useful with minimal effort and risk so I chose to use the shadow stack for an "uncooperative environment" in order to avoid hacking on immature internals of LLVM. Consequently, those statements about LLVM's intrinsic support for GC do not apply to HLVM's garbage collector because it does not use that infrastructure at all. My results are extremely compelling: you can achieve excellent performance with minimal effort (serial performance and parallel performance).
I believe HLVM already runs out-of-the-box across Unixs including Mac OS X because it requires only POSIX threads. I strongly disagree with the claim that writing a stop-the-world GC is difficult: it took me 5 days to write a 100-line multicore garbage collector and I barely know anything about computers. I cannot believe it would be difficult to port to Windows either.