[英]Specification of Scala compiler's intermediate code
Is there any formal specification or detailed description of the intermediate code generated by the Scala compiler (ie passing the -Xprint-icode
option to scalac)? Scala编译器生成的中间代码是否有任何正式规范或详细描述(即,将
-Xprint-icode
选项传递给scalac)?
Thanks. 谢谢。
The icode format is going away, with the introduction of the new GenBCode
backend, which goes directly from scalac Tree
s to ASM's bytecode representation. 随着新
GenBCode
后端的引入,icode格式已不复存在,该后端直接从scalac Tree
到ASM的字节码表示形式。 If I were you, I wouldn't invest time in learning it. 如果我是你,我不会花时间去学习它。
Instead, I suggest you print after cleanup
instead ( -Xprint:cleanup
), which is the last phase before the backend, with scalac Trees, which are very easy to understand because they're basically Java code with a Scala syntax. 相反,我建议您使用scalac Trees在
cleanup
( -Xprint:cleanup
)进行打印( -Xprint:cleanup
),这是后端之前的最后一个阶段,这很容易理解,因为它们基本上是带有Scala语法的Java代码。
That said, if you insist on dealing with icode
, I don't think there's any real documentation about it. 就是说,如果您坚持要使用
icode
,那么我认为没有任何真正的文档。 But it almost has a one-to-one correspondance with the JVM bytecode: it has classes, fields and methods. 但是它几乎与JVM字节码一一对应:它具有类,字段和方法。 And inside methods, there is a stack-based instruction set.
在方法内部,有一个基于堆栈的指令集。
在此处查找有关icode的文档(第35页): http : //infoscience.epfl.ch/record/150270/files/EPFL_TH4820.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.