mnemonics<->opcodes map and format of output of the javap utility

Discussion in 'Java' started by Albretch, Oct 2, 2004.

  1. Albretch

    Albretch Guest

    which official documentation I can't find posted by Sun anywhere:

    Say you have this (real) output from a class

    . . .
    0: aload_0
    1: arraylength
    2: iconst_1
    3: if_icmpge 18
    6: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream;
    9: ldc #3; //String input file missing!
    . . .

    This is how I think things work:

    1._ the first number is the offset in the operand stack
    2._ then comes the opcode's mnemonic
    3._ then depending on the instruction comes a reference, which
    3.1_ when prefixed by '#' represents the line number in the methods code section
    3.2_ otherwise the valid offset of the operand stack processing should continue


    Also I found what apparently looks like new mnemonics/opcodes, e.g.; "invokespecial"

    I knew of the following

    {"invokevirtual","182"},
    {"invokenonvirtual","183"},
    {"invokestatic","184"},
    {"invokeinterface","185"},

    what is the opcode for "invokespecial"?

    Where can you find 'the' table mapping opcode's - mnemonic?
    Albretch, Oct 2, 2004
    #1
    1. Advertising

  2. Larry Barowski, Oct 2, 2004
    #2
    1. Advertising

  3. Albretch

    Albretch Guest

    OK, I see Sun has been fooling around renaming the mnemonics.

    I had always understood the mnemonics<->opcodes mapping to be a 1 to
    1 one.

    I had first gone and checked the link you provided me with, but could
    not find a single reference to the 'depreceated' mnemonic
    'invokenonvirtual'

    I wonder which other ones might be renamed now or in the future

    Also, does anyone know about the format of the javap output (better
    than what you get by trying its command line switches)?

    "Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote in message news:<>...
    > "Albretch" <> wrote in message
    > news:23105029.1096684980744.JavaMail.X@x-qse3t6r7d8kql...
    > >
    > > Where can you find 'the' table mapping opcode's - mnemonic?

    >
    > Chapter 9 of the VM Spec.
    > http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html
    Albretch, Oct 2, 2004
    #3
  4. > {"invokevirtual","182"},
    > {"invokenonvirtual","183"},
    > {"invokestatic","184"},
    > {"invokeinterface","185"},
    >
    > what is the opcode for "invokespecial"?


    'invokespecial' is 183, there is no 'invokenonvirtual' in the JVM
    specification.

    Martin
    ----------------------------------------------
    JOP - a Java Processor core for FPGAs:
    http://www.jopdesign.com/
    Martin Schoeberl, Oct 2, 2004
    #4
  5. "Albretch" <> wrote in message
    news:...
    > OK, I see Sun has been fooling around renaming the mnemonics.
    >
    > I had always understood the mnemonics<->opcodes mapping to be a 1 to
    > 1 one.
    >
    > I had first gone and checked the link you provided me with, but could
    > not find a single reference to the 'depreceated' mnemonic
    > 'invokenonvirtual'


    It is not deprecated - it has become 'invokespecial'. If the ACC_SUPER
    flag is not set for the class, this instruction behaves in the old way, as
    a non-virtual invoke. This was changed because implementing a super
    call with a non-virtual invoke can fail or behave incorrectly at runtime
    if the parent/ancestor classes are not the same as they were at compile
    time (since the nearest ancestor class for which the method exists may
    change - which should be allowed). So with ACC_SUPER set,
    invokespecial can only be used for super, private, and init method
    invocations - but it now does the "right" thing for super calls.
    Larry Barowski, Oct 2, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TenderHeart

    java assembler?? for Javap utility??

    TenderHeart, Apr 29, 2005, in forum: Java
    Replies:
    1
    Views:
    671
    =?ISO-8859-1?Q?Daniel_Sj=F6blom?=
    Apr 29, 2005
  2. Tarkin
    Replies:
    2
    Views:
    307
    Chris Smith
    Jun 10, 2006
  3. Larry Gates

    Re: C mnemonics

    Larry Gates, Feb 18, 2009, in forum: C Programming
    Replies:
    0
    Views:
    359
    Larry Gates
    Feb 18, 2009
  4. Antoninus Twink

    Re: C mnemonics

    Antoninus Twink, Feb 18, 2009, in forum: C Programming
    Replies:
    2
    Views:
    484
    Coos Haak
    Feb 18, 2009
  5. Swing Mnemonics

    , Apr 15, 2009, in forum: Java
    Replies:
    2
    Views:
    338
    Michael Rauscher
    Apr 16, 2009
Loading...

Share This Page