什么是简单易用的 JIT 库?

What would be a simple to use JIT library?

我正在尝试编写类似于 .NET 或 JVM 的语言运行时(以及语言本身)。它有一种自定义的字节码形式。

我想要的是一种将所述字节码转换为实际的、可运行的机器代码的方法。所以,因为我不想自己写这样一个翻译器(这更像是一个玩具 project/personal 副项目)我想找到一个好的 JIT 库来使用。

这是我希望图书馆执行的操作:

如果重要的话,我将使用 Boehm GC 进行垃圾收集(可能不重要,但以防万一)。也许压缩 GC 会很好,但我想我不应该把这些问题结合起来......

我建议 llvm. There are some great tutorials on how to implement your own language with it and basic stuff is not too complicated. You also get the option to do a lot of more advanced stuff later on. As a bonus not only can you use JIT but you can also statically compile and optimize your binaries. LLVM also does have a C interface 并且可以针对所有常见的 CPU 架构,甚至还有很多更晦涩的架构。