- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
understanding generated bytecode
Mon, 2009-11-09, 11:22
Hi,
I've been exploring what the nsc generated bytecode looks like, using the
following decompiler
McGill's "Dava" Java Decompiler http://www.sable.mcgill.ca/dava/
One of the explicit goals of Dava is to generate compilable Java from
non-Java bytecode (that's the idea).
Some things work and others don't. Has anybody tried other ways to get a
high-level view of nsc-generated bytecode?
Soot itself provides bytecode-level languages (Grimp in particular),
comments on that are also welcome.
Somewhat related to the above, there's an enhancement ticket:
FindBugs should be run during nightly tests,
http://lampsvn.epfl.ch/trac/scala/ticket/571
Experience reports on that would also be welcome :-)
Mon, 2009-11-09, 12:07
#2
Re: understanding generated bytecode
Johannes,
Yes, javap and scalap show what's inside the generated .class files but
still I would prefer an IDE-level bytecode browser (with navigation, too?).
So I might settle on the Eclipse plugin for Soot, which can for example
display bytecode using the Grimp notation (well, the following screenshot
shows Jimple, but conveys the idea):
http://www.sable.mcgill.ca/soot/eclipse/ca.mcgill.sable.soot/doc/concept...
unless someone suggests sthg better.
After getting an overview of some (not all :-) of the name mangling and
codegen patterns, I *would like* later to try some bytecode-level automatic
verfication techniques, e.g.
http://www-sop.inria.fr/everest/BML/Introduction.html#Introduction
or the aforementioned Findbugs.
On Mon, Nov 9, 2009 at 11:21 AM, Miguel Garcia wrote:
> I've been exploring what the nsc generated bytecode looks like, using the
> following decompiler
>
> McGill's "Dava" Java Decompiler http://www.sable.mcgill.ca/dava/
>
> One of the explicit goals of Dava is to generate compilable Java from
> non-Java bytecode (that's the idea).
> Some things work and others don't. Has anybody tried other ways to get a
> high-level view of nsc-generated bytecode?
You can use scalac -Xprint: to get an idea of what scalac is
doing. Especially using -Xprint:jvm should give something very close
to bytecodes. Low-level inspection tools are javap and scalap (though,
I don't know what the latter one does exactly. IMO it just prints the
serialized scala signatures).
What do you expect from a high-level view of bytecodes?