jvm常用操作码

[color=red][b]常见的常量入栈的操作码有 const push idc [/b][/color]
1,const i l f d a分别表示 int long float double 对象引用
如:[list]
[*]aconst_null 将null对象引用压入栈
[*]iconst_m1 将int类型-1压入栈
[*]iconst_1 将int类型的1压入栈
[*]lconst_3 将long类型的3压入栈
[/list]2,push
[list]
[*] bipush 8位带符号的整数压入栈
[*] sipush 16位带符号的整数压入栈
[/list]3,idc 将常量池中的项压入栈

[color=red][b]局部变量中的装载值指令 load[/b][/color]
格式和const差不多,如iload_1 表示从局部变量1中装载int类型值,对于从数组中装载则由两位字母+load表示 如:
[list]
[*]aaload表示从数组中装载引用类型
[*]iaload表示从数组中装载int类型
[/list]

[color=red][b]值存入局部变量指令 store[/b][/color]
格式同上 如:
[list]
[*]aastore表示将引用类型值存入数组
[*]istore_0表示将int类型值存入局部变量0
[/list]

[color=red][b]通用指令 [/b][/color]
[list]
[*]popn 弹出栈顶n个字长的内容(n为1时省略)
[*] dupn 复制栈顶n个字长的内容(n为1时省略)
[*] dupn_xm 复制栈顶n个字长的内容,然后将复制的内容及原来弹出的n+m个字长压入栈 如:
[*] dup_x2表示复制栈顶1个字长的内容,然后将复制的内容及原来弹出的3个字长压入栈
[*] swap 交换栈顶两个字长的内容
[/list]


[color=red][b]类型转换指令 [/b][/color]
[list]
[*]i2l:表示int转为long 其余类似
[/list]
[color=red][b]运算指令 [/b][/color]

[list]
[*]add表示加 。。。。 rem取余 neg取反
[*]iinc 将常量值加入到int中
[*]sh 移位操作
[/list]

[color=red][b]对象操作指令 [/b][/color]

[list]
[*]new 创建一个新对象
[*]checkcast 检查类型
[*]getfield 从对象中获取字段
[*]putfield 设置对象中字段的值
[*]getstatic 获取类中的静态字段
[*]putstatic 设置类中静态字段的值
[*]instanceof 判断类型匹配
[/list]


[color=red][b]方法调用及返回指令 [/b][/color]
[list]
[*]invokevirtual 根据运行时对像类型调用方法
[*] invokespecial 根据编译时的类型调用实例方法以及编译源码生成的init方法
[*] invokestatic 调用静态方法
[*] invokeinterface 调用接口方法
[*] return 返回指令 ireturn返回int return 返回void
[/list]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值