File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Understanding the disassembled code - reg.

 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am trying to understand the code disassembled by the "javap" utility. I have written a "toy" program and disassembled it using

javap -c Analyzer
and i got the following output.
Compiled from "Analyzer.java"
public class Analyzer extends java.lang.Object{
public Analyzer();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>" )V
4: aload_0
5: iconst_0
6: putfield #2; //Field varOne:I
9: return

public int getVarOne();
Code:
0: aload_0
1: getfield #2; //Field varOne:I
4: ireturn

public static void main(java.lang.String[]);
Code:
0: iconst_0
1: istore_1
2: new #3; //class Analyzer
5: dup
6: invokespecial #4; //Method "<init>" )V
9: astore_2
10: aload_2
11: invokevirtual #5; //Method getVarOne )I
14: istore_1
15: getstatic #6; //Field java/lang/System.out:Ljava/io/PrintStream;
18: iload_1
19: invokevirtual #7; //Method java/io/PrintStream.println I)V
22: return

}

Can any body help me to understand the mnemonics "aload_0", "invokespecial", "iconstant", etc., Also it will be helpful for me to have some online references regarding these info.

Thanks in advance!!!
regards,
Dinesh Venkatesan.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll find the explanation of the instructions in the Java Virtual Machine's specification.
For example : aload.
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe,

Thanks much for your reference.

regards,
dinesh Venkatesan
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic