|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.claritysys.jvm.disassembler.Disassembler
public class Disassembler
JASM Java Bytecode Disassembler Stuff To Do - Proper conversion of WIDE args - Exceptions need better labels/block marking. - Inner classes? - Branch target smart labels -- what condition made it jump to the branch target. Locals analysis, especially for automatic locals: e.g., a local used in a ret is storing the caller's PC. PERFORMANCE IMPROVEMENTS For typical runs verify the HashMap sizes (aliasToFull/fullToAlias) to ensure good hashing. ENHANCEMENTS One of my original desires was to provide a disassembly listing, including the hex dump of the bytecode on each line, interspersed with the original Java source code, or at least the comments from the original source code. The code segments have line number information which can tie back to the original source file, but I am as much interested in the original JavaDoc comments (more so). I have considered several formats, such as showing the original source code to the right (truncated) in single line comments, with comments appearing inline. Or printing the original code with no extra indent, then the bytecode it generated, then the source, etc. When interspersing the original source we should turn off local variable declaration since they will be shown in the source.
| Constructor Summary | |
|---|---|
Disassembler(ClassFile cf,
java.lang.String toFileName)
Create a new Disassembler for given class. |
|
Disassembler(ClassFile cf,
java.io.Writer writer)
|
|
| Method Summary | |
|---|---|
void |
disassemble()
Do the disassembly. |
java.lang.String |
getFormattedType(java.lang.String type)
TypeFormatter.getFormattedType |
boolean |
isThisClass(java.lang.String alias)
|
static void |
main(java.lang.String[] args)
Disassemble from command line filename to out.jasm. |
void |
setClassFile(ClassFile cf)
Set the class. |
void |
setOutput(java.io.Writer writer)
Set the writer to write to. |
void |
setOutputFile(java.lang.String path)
Set the file to write to. |
void |
visitField(CfField obj)
FIELD modifiers type name (= static value)? |
void |
visitJavaClass(ClassFile obj)
CLASS package? import* [modifiers] (class | interface) (extends)? (implements)? |
void |
visitMethod(CfMethod obj)
METHOD modifiers type name (params) throws? { code } |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Disassembler(ClassFile cf,
java.lang.String toFileName)
public Disassembler(ClassFile cf,
java.io.Writer writer)
| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.io.IOException,
ClassFileFormatException
java.io.IOException
ClassFileFormatExceptionpublic boolean isThisClass(java.lang.String alias)
public void disassemble()
public void setClassFile(ClassFile cf)
public void setOutputFile(java.lang.String path)
This opens the file in overwrite mode and creates the PrintWriter.
public void setOutput(java.io.Writer writer)
writer - public java.lang.String getFormattedType(java.lang.String type)
Called by the sig parser to let us format Object types.
getFormattedType in interface Signature.TypeFormatterpublic void visitJavaClass(ClassFile obj)
public void visitField(CfField obj)
public void visitMethod(CfMethod obj)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||