破解 Open JDK - 发出 LLVM 汇编器而不是 Java 字节码
我有机会在大学工作并帮助从 OpenJDK 破解 javac
。目标是读取自定义源代码(针对“我们的”编程语言与 antlr 的结合)而不是编写 Java 字节码 - 编译器应该编写 LLVM 汇编程序代码。这将是我的任务,但是该项目是如此之大,以至于我不知道从哪里或如何开始了解那里发生的事情。有人告诉我尝试调试代码并逐步完成它,但我想知道是否有任何好的文档可以让我有一个短暂的突破来了解哪些部分是最重要的。
I have got the opportunity to work at the university and to help hacking javac
from the OpenJDK. The goal is to read custom sourcecode (for "our" programming language in combination with antlr) and not to write out Java bytecode - the compiler should write out LLVM assembler code. This would be my task, however the project is so huge that i don't know where or how to start understanding what's going on there. I was told to try out debugging the code and going through it step-by-step but i would like to know whether there is any good documentation out in the wild given me a short breakthrough to understand which parts are the most important ones.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已将“myprogram.myprogrlang”放入“myprogram.llvm”中。
我认为没有必要使用 / hack javac。我认为你想使用Java/openjdk的编译工具,但我认为这只会让你的任务变得更加困难,而不是帮助你。
我的建议是使用 antlr,了解它如何解析您的编程语言中的程序,如何生成 AST,然后将该 AST 数据转换为 LLVM 字节码或汇编程序。
在这种情况下你不需要java。
因此:
[1] 学习您的编程语言的 ANTLR 语法/规则
[2] 学习 LLVM 字节码/汇编器
[3] 学习如何将 ANTLR 数据输出转换为 LLVM 数据输入
You have "myprogram.myprogrlang" into "myprogram.llvm".
I don't see the need to use / hack javac. I think you want to use the compiler tools of Java / openjdk, but I think that only makes your task more difficult, instead of helping you.
My suggestion is take antlr, learn how does it work to parse a program in your programming language, how to generate an AST, and then turn that AST data into the LLVM bytecode or assembler.
You don't need java in this case.
So:
[1] Learn ANTLR grammars /rules for your programming language
[2] Learn LLVM bytecode / assembler
[3] Learn how to turn ANTLR data output into LLVM data input