常量入栈
–
aconst_null
null
对象入栈
–
iconst_m1
int
常量
-1
入栈
–
iconst_0
int
常量
0
入栈
–
iconst_5
–
lconst_1 long
常量
1
入栈
–
fconst_1 float 1.0
入栈
–
dconst_1 double 1.0
入栈
–
bipush
8
位带符号整数入栈
–
sipush
16
位
带符号整数入
栈
–ldc 常量池中的项入栈
ldc index
indexu1为指向常量池的有效无符号8位索引
局部变量压栈
–
xload
(x
为
i
l f d a)
•
分别表示
int
,
long
,
float
,
double
,
objectref
–
xload_n
(n
为
01 2 3)
–
xaload
(x
为
i
l f d
a b c s)
•
分别表示
int
,long, float, double,
obj
ref ,
byte,char,short
•
从数组中取得给定索引的值,将该值压栈
•
iaload
–
执行前,栈:
...,
arrayref
,index
–
它取得
arrayref
所在数组的
index
的值,并将值压栈
–
执行后,栈:
...,value
出栈装载入局部变量
–
xstore
(x
为
i
l f d a)
•
出
栈,存入局部变量
–
xstore_n
(n0 1 2 3)
•
出
栈,将值存入第
n
个局部变量
–
xastore
(x
为
i
l f d a b c s)
•
将值存入数组中
•
iastore
–
执行
前,栈:
...,
arrayref
,index, value
–
执行后,栈:
...
–
将
value
存入
arrayref
[index]
通用栈操作(无类型)
–
nop
–
pop
•
弹
出栈顶
1
个字长
–
dup
•
复制栈顶
1
个字长,复制内容压入栈
类型转化
整数运算
–
iadd
–
ladd
–
isub
–
lsub
–
idiv
–
ldiv
–
imul
–
lmul
–
iinc
浮点运算
fadd
dadd
fsub
dsub
fdiv
ddiv
fmul
dmul
基本工作流程都是,弹出栈顶2个数,做运算,结果入栈
对象操作指令
–
new
–
getfield
–
putfield
–
getstatic
–
putstatic
条件控制
–
ifeq
如果为
0
,则跳转
–
ifne
如果不为
0
,则跳转
–
iflt
如果小于
0
,则跳转
–
ifge
如果大于
0
,则跳转
–
if_icmpeq
如果两个
int
相同,则跳转
ifeq
参数byte1,byte2
value出栈,如果栈顶value为0则跳转到(byte1<<8)|byte2
执行前,栈:...,value
执行后,栈:...
方法调用
–
invokevirtual
–
invokespecial
–
invokestatic
–
invokeinterface
–
xreturn
(x
为
i
l f d a
或为空
)
invokespecial通常根据引用的类型选择方法,而不是对象的类来选择!即它使用静态绑定而不是动态绑定。
invokespecial对私有方法超类方法 实例初始化方法
xreturn x为空,表示返回void