这是javap
当我让他显示我的编译类时生成的代码(我选择了方法)
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
这是代码,通过groovyConsole
(相同的方法)显示
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
但是哪个字节码更多raw
?据我了解,javap
添加了一些风格,所以第二个例子应该更真实bytecode
。我对吗?