• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I read the following bytecode?

 
Rajdeep Biswas
Ranch Hand
Posts: 207
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The javap -c output for this line is

What is the dup opcode's job?
How do I read instruction 15 into an english statement? Actually, I want to understand what the total things says after : in instructions 10, 15, 191, 22 and 25.

Thanks
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you will find this opcode guide really useful: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
invokevirtual means that a Java method is called, the name of which is in the comment.

There are some special cases - "<init>" means the constructor of a class, while "<clinit>" means the static initialization of a class (if there is one).

What's behind the colon are the parameter types (in parentheses, if there are any), and the return type of the method.
 
Winston Gutkowski
Bartender
Pie
Posts: 10095
56
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajdeep Biswas wrote:How do I read instruction 15 into an english statement? Actually, I want to understand what the total things says after : in instructions 10, 15, 191, 22 and 25.

Any particular reason for that? If it's just idle curiosity, or an interest in what a low-level language looks like, please don't let me stop you; but I doubt you'll find much in it that helps you as a Java programmer.

There's also a risk that you might use it to increase efficiency and that's the last thing you should do. So, by all means look, but don't write your code to get things done a particular way. It's a short route to disaster.

Winston
 
Rajdeep Biswas
Ranch Hand
Posts: 207
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to understand the nuances for better concept rather than mugging up what different texts say differently.. Thanks to all for wisdom sharing
 
Rajdeep Biswas
Ranch Hand
Posts: 207
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:invokevirtual means that a Java method is called, the name of which is in the comment.

There are some special cases - "<init>" means the constructor of a class, while "<clinit>" means the static initialization of a class (if there is one).

What's behind the colon are the parameter types (in parentheses, if there are any), and the return type of the method.


But what about the "L" after (I)?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There really is no way to get around reading the JVM spec if you're interested in such details :-)
http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic