aspose file tools*
The moose likes Java in General and the fly likes How do I read the following bytecode? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How do I read the following bytecode?" Watch "How do I read the following bytecode?" New topic
Author

How do I read the following bytecode?

Rajdeep Biswas
Ranch Hand

Joined: Mar 26, 2012
Posts: 186


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


The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

I think you will find this opcode guide really useful: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html


Mohamed Sanaulla | My Blog
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
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.


Ping & DNS - my free Android networking tools app
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7801
    
  21

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

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Rajdeep Biswas
Ranch Hand

Joined: Mar 26, 2012
Posts: 186

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

Joined: Mar 26, 2012
Posts: 186

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
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
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
 
Consider Paul's rocket mass heater.
 
subject: How do I read the following bytecode?