• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I read the following bytecode?

 
Ranch Hand
Posts: 233
1
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 233
1
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 233
1
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic