我听说 google 应用引擎可以运行任何可以通过它的 JVM
转换为 Java 字节码的编程语言。我想知道是否可以将 LLVM 字节码转换为 Java 字节码,因为在 Google App Engine JVM
中运行 LLVM
支持的语言会很有趣。
最佳答案
现在似乎可以使用 LLJVM interpreter 将 LLVM IR 字节码转换为 Java 字节码。 .
有一个有趣的Disqus comment (21/03/11) 来自 kraytracing.com 的 Grzegorz这与代码一起解释了他如何修改 LLJVM 的 Java 类输出例程以发出在数量上与输入 C/C++ 模块一致的非单片 Java 类。他建议他的技术似乎避免了通常由 LLJVM 生成的过长的“复合”Java Constructor 方法参数签名,并且他提供了指向他的修改和示例的链接。
虽然 LLJVM 看起来已经有几年的积极开发了,但它仍然托管在 Github 上,并且仍然可以在其以前的 GoogleCode 存储库中找到一些文档:
LLJVM @ Github
LLJVM documentation @ GoogleCode
我也遇到了'Proteuscc ' 该项目还利用 LLVM 输出 Java 字节代码(它表明这是专门针对 C/C++ 的,尽管我假设该项目可以被修改或提供 LLVM 中间表示(IR))。来自 http://proteuscc.sourceforge.net :
The general process of producing a Java executable with Proteus then can be summarised as below.
- Generate human readable representation of the LLVM intermediate representation (ll file)
- Pass this ll file as an argument to the proteus compilation system
- The above will produce a Java jar file which can be executed or used as a library
我已扩展 a bash script to compile the latest versions of LLVM and Clang on Ubuntu , 它可以作为 Github Gist,here .
[更新 31/03/14] - LLJVM似乎已经死了一段时间,但是 Howard Chu (https://github.com/hyc) 看起来已经死了 LLJVM与最新版本的 LLVM (3.3) 兼容。见 Howard's LLJVM-LLVM3.3 branch at Github, here
关于java - 是否可以将 LLVM 字节码转换为 Java 字节码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4934707/