用于数学的 JIT 编译器

发布于 2024-09-29 01:05:20 字数 359 浏览 5 评论 0原文

我正在寻找可以嵌入到我的程序中的 JIT 编译器或小型编译器库。我打算使用它来编译动态生成的执行复数算术的代码。生成的代码结构非常简单:没有循环,没有条件,但它们可能很长(由 GCC 编译时为几 MB)。生成的机器代码的性能很重要,而我并不真正关心编译本身的速度。哪种 JIT 编译器最适合我的目的?谢谢!

详细要求

  • 支持双精度复数运算
  • 支持基本优化
  • 支持许多 CPU(至少 x86 和 x86-64)
  • 在支持的 CPU 上使用 SSE
  • 支持局部变量的堆栈或大量寄存器
  • ANSI-C 或 C++ 接口
  • 跨平台(主要是Linux、Unix)

I am looking for a JIT compiler or a small compiler library that can be embedded in my program. I indent to use it to compile dynamically generated code that perform complex number arithmetics. The generated code are very simple in structure: no loops, no conditionals, but they can be quite long (a few MB when compiled by GCC). The performance of the resulting machine code is important, while I don't really care about the speed of compilation itself. Which JIT compiler is best for my purpose? Thanks!

Detailed requirements

  • Support double precision complex number arithmetics
  • Support basic optimization
  • Support many CPUs (x86 and x86-64 at least)
  • Make use of SSE on supported CPUs
  • Support stack or a large set of registers for local variables
  • ANSI-C or C++ interface
  • Cross platform (mainly Linux, Unix)

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

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

发布评论

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

评论(3

吹梦到西洲 2024-10-06 01:05:20

您可能想看看 LLVM

You might want to take a look at LLVM.

只想待在家 2024-10-06 01:05:20

Cint 是一个 c++(ish) 环境,提供混合编译代码和解释代码的能力。有一组解释器优化工具ROOT 通过支持运行时编译和链接进一步扩展了这一点(请参阅最后一个http://root.cern.ch/drupal/content/cint-prompt),尽管它似乎使用系统编译器,因此可能没有帮助。所有代码都是开源的。

我经常使用所有这些功能作为我工作的一部分。

我不知道它是否积极使用 SIMD 指令,但它似乎满足您所有其他要求。


据我所知,您当前正在使用动态链接编译为动态库的方法,您可能会考虑 TCC ,尽管我不相信它做了太多优化,并且怀疑它不支持SIMD。

Cint is a c++(ish) environment that offers the ability to mix compiled code and interpreted code. There is a set of optimization tools for the interpreter. ROOT extends this even further by supporting compile and link at run-time at run-time (see the last section of http://root.cern.ch/drupal/content/cint-prompt), though it appears to use the system compiler and thus may not help. All the code is open source.

I make regular use of all these features as part of my work.

I don't know if it makes active use of SIMD instructions, but it seems to meet all your other requirements.


As I see that you are currently using the compile to dynamic library at link on the fly methond, you might consider TCC, though I don't believe that it does much optimization and suspect that it does not support SIMD.

风流物 2024-10-06 01:05:20

听起来您希望能够即时编译,然后动态加载编译后的库(.DLL 或 .so)。通过 ANSI-C 或 C++ 接口,这将为您提供最佳性能。因此,忘记 JITing 并考虑生成 C/C++ 编译器来进行编译。

当然,这假设可以在实际生成动态生成代码的位置安装编译器。

Sounds like you want to be able to compile on the fly and then dynamically load the compiled library (.DLL or .so). This would give you the best performance, with an ANSI-C or C++ interface. So, forget about JITing and consider spawning a C/C++ compiler to do the compilation.

This of course assumes that a compiler can be installed at the point where the dynamically generated code is actually generated.

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