Reputation: 6242
Is there any formal specification or detailed description of the intermediate code generated by the Scala compiler (i.e. passing the -Xprint-icode
option to scalac)?
Thanks.
Upvotes: 1
Views: 228
Reputation: 115
Look here for documentation for icode (page 35): http://infoscience.epfl.ch/record/150270/files/EPFL_TH4820.pdf
Upvotes: 0
Reputation: 22105
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. 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.
That said, if you insist on dealing with icode
, I don't think there's any real documentation about it. But it almost has a one-to-one correspondance with the JVM bytecode: it has classes, fields and methods. And inside methods, there is a stack-based instruction set.
Upvotes: 1