Soot 版本的 Jasmin 无法组装 Jasmin 汇编文件
我有来自 Jasmin SourceForge 的 Jasmin 2.4 版本和来自 Soot 项目的 Jasmin 2.4 版本(位于 sable.mcgill.ca,标记为“jasminclasses”),而 Soot 版本(我需要的)似乎不是工作正常。
我制作了一个简单的编译器,它最初编译为 Jasmin JVM 程序集,然后使用 Jasmin 汇编为 JVM 类文件。我曾经使用 Jasmin 的 SourceForge 站点上的 Jasmin 普通版本,效果很好;一切都正确编译并运行。现在我已经开始使用 Soot 框架进行优化,只要我不尝试将优化后的代码转换回类文件,所有这些都可以很好地工作。
由于我现在使用Soot,所以我必须使用Soot版本的Jasmin,它支持Soot使用的JasminOutputStream。 Soot 的 Jasmin 版本确实看起来好像它仍然应该能够以“老式”方式处理 Jasmin 文件,读取“.j”文件而不是获取输入流,但是当我尝试(对于初始汇编)优化前),Soot 版本失败。
如果我这样做,
java -cp jasmin.jar jasmin.Main MyClass.j
我会按预期得到输出“生成:MyClass.class”。
如果我这样做(其中 jasminclasses 是 Jasmin 的 Soot 版本),
java -cp jasminclasses-2.4.0.jar jasmin.Main MyClass.j
我得到的输出
MyClass.j:5: Warning - Syntax error.
.field public n
^
MyClass.j:5: Error - Couldn't repair and continue parse.
.field public n
^
MyClass.j: Found 2 errors`
是第 5 行 .field public n I 它没有任何错误,如上所示,它可以与普通版本的 Jasmin 一起编译良好。
为了完整起见,这里还有一些围绕这一点的代码:
.source MyClass.j
.class public MyClass
.super AnotherClass
.field public n I
.method public <init>()V
aload_0
invokenonvirtual AnotherClass/<init>()V
return
.end method
一切都很好,并且可以与正常的 Jasmin 一起很好地组装。
有谁知道 Jasmin 的 Soot 版本是否需要不同的语法?与大多数有关 Soot 和 Jasmin 的内容一样,网络上一开始就没有太多内容,更不用说我正在搜索的内容了,所以我的谷歌搜索并没有找到太多内容。
预先感谢您提供的任何帮助,我在这里真的很沮丧。我的下一步是调试 Soot 的 Jasmin 包,看看它在里面做什么以及为什么失败,但我希望我现在不必为此走那么远。
I have both the version of Jasmin 2.4 from the Jasmin SourceForge and the version of Jasmin 2.4 from the Soot project (at sable.mcgill.ca, labeled "jasminclasses"), and the Soot version (which I need) does not seem to be working properly.
I have made a simple compiler which compiles initially to Jasmin JVM assembly then uses Jasmin to assemble into JVM class files. I used to use the normal version of Jasmin from Jasmin's SourceForge site, and it was working great; everything compiled and ran correctly. Now I have started doing optimization using the Soot framework, and all that works great as long as I don't try to convert the optimized code back into a class file.
Since I'm using Soot now, I have to use Soot's version of Jasmin, which supports the JasminOutputStream that Soot uses. Soot's version of Jasmin does appear as though it's still supposed to be able to handle processing Jasmin files the "old fashioned" way, reading in a ".j" file instead of taking an input stream, but when I try (for the initial assemble before the optimization), the Soot version fails.
If I do
java -cp jasmin.jar jasmin.Main MyClass.j
I get output "Generated: MyClass.class" as expected.
If I do (where jasminclasses is the Soot version of Jasmin)
java -cp jasminclasses-2.4.0.jar jasmin.Main MyClass.j
I get output
MyClass.j:5: Warning - Syntax error.
.field public n
^
MyClass.j:5: Error - Couldn't repair and continue parse.
.field public n
^
MyClass.j: Found 2 errors`
Line 5 is just
.field public n I
Nothing incorrect about it, and as shown above, it compiles fine with the normal version of Jasmin.
For completeness, here's some more code around that point:
.source MyClass.j
.class public MyClass
.super AnotherClass
.field public n I
.method public <init>()V
aload_0
invokenonvirtual AnotherClass/<init>()V
return
.end method
Everything there is fine and assembles fine with normal Jasmin.
Does anyone know if the Soot version of Jasmin expects a different syntax? As with most stuff concerning Soot and Jasmin, there's not much on the web at all in the first place, let alone much on what I'm searching for, so my Googling isn't coming up with much.
Thank you in advance for any assistance offered, I'm really getting frustrated here. My next step is going to be to debug Soot's Jasmin package and see what it's doing in there and why it's failing, but I'm hoping I don't have to go that far for now just for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论