java javap and groovy bytecode comparison

Viewed 326

Here is the code generated showed by javap when I asked him to display my compiled class (I selected method)

int multiply(int, int);
  flags:
  Code:
    stack=2, locals=3, args_size=3
       0: iload_1
       1: iload_2
       2: imul
       3: ireturn
    LineNumberTable:
      line 2: 0
    LocalVariableTable:
      Start  Length  Slot  Name   Signature
             0       4     0  this   LMyClass;
             0       4     1     a   I
             0       4     2     b   I

Here is the code, which displayed by groovyConsole(same method)

public multiply(II)I
   L0
    LINENUMBER 4 L0
    ILOAD 1
    ILOAD 2
    IMUL
    IRETURN
   L1
    LDC 0
    IRETURN
    LOCALVARIABLE this LMyClass; L0 L1 0
    LOCALVARIABLE a I L0 L1 1
    LOCALVARIABLE b I L0 L1 2
    MAXSTACK = 2
    MAXLOCALS = 3

But which bytecode are more raw? As far as I understand, javap added some style to it, so the second example should be more genuine bytecode. Am I right?

2 Answers
Related