llvm/工具:lli REPL 与 LuaJIT 相比

发布于 2024-09-29 19:03:59 字数 345 浏览 4 评论 0原文

我想知道是否有人有过使用 llvm/tools - lli 解释器/JIT 编译器的经验(参见 http://llvm.org/docs/GettingStarted.html#tools)。我对您可以提供的任何信息(速度、复杂性、实现等)感兴趣。

谢谢。

更新:

好吧,假设 lli 充当解释器,那么位码执行与 LuaJIT VM 执行相比如何?当 lli 充当 jit 编译器时怎么样(相同的比较)?

笔记: 我只是问是否有人有经验/愿意花时间分享。

I was wondering if someone has had experience with the llvm/tools - lli interpreter/JIT-compiler (cf. http://llvm.org/docs/GettingStarted.html#tools). I am interested in any information that you can provide (speed, complexity, implementations, etc.).

Thanks.

UPDATE:

Okay how would bitcode execution be compared to LuaJIT VM execution, supposing that lli acts as an interpreter? What about when lli acts as a jit-compiler (same comparison)?

NOTE:
I am only asking if anyone has experience/ is willing to spare some time to share.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你怎么这么可爱啊 2024-10-06 19:03:59

LuaJIT是一个跟踪JIT,这意味着它可以重新优化自身以更好地适应通过执行环境传递的数据,但是,LLVM是一个静态JIT,因此只会为相应的生成一次性的最佳情况机器代码源,这可能会导致它在紧密循环或错误的分支错误预测中失去性能。

实际的 LuaJIT VM 也是高度优化的、线程化的、机器特定的汇编,而 LLVM 使用 C++ 来实现可移植性(以及其他原因),因此这显然给 LuaJIT 带来了巨大的优势。 LLVM 的开销也比 LuaJIT 高得多,这纯粹是因为 LuaJIT 被设计为在功能较弱的系统上工作(例如由 ARM CPU 驱动的系统)。

LuaJIT字节码也是专门为LuaJIT设计的,由于LLVM的位码更加通用,这显然会让LuaJIT的执行速度更快。 LuaJIT 的字节码也经过精心设计,可用于编码优化提示等,供 JIT 和跟踪器使用。

忽略这是两种不同类型的 JIT 的事实,整个比较归结为 LLVM 专注于成为通用 JIT/编译器后端,LuaJIT 专注于以尽可能快的方式执行 Lua,因此它受益于不受普遍性的限制。

LuaJIT is a tracing JIT, which means it can re-optimize itself to better suite the data passed through the execution environment, however, LLVM is a static JIT, and thus will just generate the once-off best-case machine code for the corresponding source, which may leading it it loosing performance in tight loops or bad branch misspredictions.

The actual LuaJIT VM is also highly optimized, threaded, machine specific assembly, where as LLVM uses C++ for portability (and other reasons), so this obviously gives LuaJIT a huge advantage. LLVM also has a much higher overhead than LuaJIT, purely because LuaJIT was designed to work on much less powerful systems (such as those driven by ARM CPU's).

The LuaJIT bytecode was also specially designed for LuaJIT, where as LLVM's bitcode is a lot more generic, this will obviously make LuaJIT's execute faster. LuaJIT's bytecode is also well designed for encoding optimization hints etc for use by the JIT and the tracer.

ignoring the fact that these are two different types of JITs, the whole comparison boils down to LLVM is focused on being a generic JIT/Compiler backend, LuaJIT is focused on executing Lua as fast as possible in the best way possible, thus it gains from not being constrained by generality.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文