《深入Java虚拟机》笔记:指令集 (转)
《深入Java虚拟机》笔记:指令集
| 指令 | 含义 |
| iconst_m1 | 把int型常量-1压入栈中 |
| iconst_0 | 把int型常量压入栈中 |
| fconst_1 | 把float型常量1压入栈中 |
| lconst_2 | 把long型常量2压入栈中 |
| dconst_3 | 把double型常量3压入栈中 |
| bipush byte1 | 把byte1转换成int型压入栈中 |
| sipush byte1,byte2 | 把byte1,byte2组成的short转换成int压入栈中 |
| aconst_null | 把空对象压入栈中 |
| ldc indexbyte1 | 把常量池中指定下标的一个字长压入栈 |
| ldc_w indexbyte1,indexbyte2 | 把常量池中指定下标的一个字长压入栈 |
| ldc2_w indexbyte1,intexbyte2 | 把常量池中指定下标的两个字长压入栈 |
| pop | 弹出栈顶的一个字 |
| pop2 | 弹出栈顶的两个字 |
| swap | 交换栈顶的两个字 |
| dup | 复制栈顶的一个字 |
| dup2 | 复制栈顶的两个字 |
| dup_x1 | 复制一字,并将弹出的两字压栈 |
| dup_x2 | 复制一字,并将弹出的三字压栈 |
| dup2_x1 | 复制两字,并将弹出的三字压栈 |
| dup2_x2 | 复制两字,并将弹出的四字压栈 |
| iload vindex | 将位置vindex的int型局部变量压入栈 |
| iload_0 | 将位置0的int型局部变量压入栈 |
| fload vindex | 将位置vindex的float型局部变量压入栈 |
| fload_0 | 将位置0的float型局部变量压入栈 |
| lload vindex | 将位置vindex的long型局部变量压入栈 |
| lload_0 | 将位置0的long型局部变量压入栈 |
| dload vindex | 将位置vindex的double型局部变量压入栈 |
| dload_0 | 将位置0的double型局部变量压入栈 |
| aload vindex | 将位置vindex的对象引用局部变量压入栈 |
| aload_0 | 将位置0的对象引用局部变量压入栈 |
| istore vindex | 弹出int型,存储在vindex处的局部变量 |
| istore_0 | 弹出int型,存储在0处的局部变量 |
| fstore vindex | 弹出float型,存储在vindex处的局部变量 |
| fstore_0 | 弹出float型,存储在0处的局部变量 |
| lstore vindex | 弹出long型,存储在vindex处的局部变量 |
| lstore_0 | 弹出long型,存储在0处的局部变量 |
| dstore vindex | 弹出double型,存储在vindex处的局部变量 |
| dstore_0 | 弹出double型,存储在0处的局部变量 |
| astore vindex | 弹出对象引用类型,存储在vindex处的局部变量 |
| astore_0 | 弹出对象引用类型,存储在0处的局部变量 |
| wide iload byte1,byte2 | wide能把原来的一字节的参数变成处理两字节 |
| i2l | 把int类型转换成long类型,其他类似,不再举例 |
| iadd | 弹出两个int型,相加后结果压入栈 |
| ladd | 弹出两个long型,相加后结果压入栈 |
| iinc vindex,const | 把常量const与位于vindex的局部变量相加 |
| wide iinc index1,intdex2,const1,const2 | 把常量与位于vindex1,vindex2的局部变量相加 |
| isub | 弹出两个int型,相减后lint型结果压入栈 |
| lsub | 弹出两个long型,相减后long型结果压入栈 |
| imul | 弹出两个int型,相乘后int型结果压入栈 |
| lmul | 弹出两个long型,相乘后long型结果压入栈 |
| idev | 弹出两个int型,相除后int型结果压入栈 |
| ldev | 弹出两个long型,相除后long型结果压入栈 |
| irem | 弹出两个int型,取余后int型结果压入栈 |
| lrem | 弹出两个long型,取余后long型结果压入栈 |
| ineg | 弹出一个int型,取反后int型结果压入栈 |
| lneg | 弹出一个long型,取反后long型结果压入栈 |
| ishl | 向左对int型值进行移位操作(long类似) |
| ishr | 向右对int型值进行算术移位操作 |
| iushr | 向右对int型值进行逻辑移位操作 |
| iand | 对两个int类型值进行逻辑与运算(long类似) |
| ior | 对两个int类型值进行逻辑或运算 |
| ixor | 对两个int类型值进行逻辑异或运算 |
| fadd | 弹出两个float型,相加后float型结果压入栈 |
| fsub | 弹出两个float型,相减后float型结果压入栈 |
| fmul | 弹出两个float型,相乘后float型结果压入栈 |
| fdiv | 弹出两个float型,相除后float型结果压入栈 |
| frem | 弹出两个float型,取余后float型结果压入栈 |
| new indexbyte1,indexbyte2 | 在堆中创建一个新的对象,将其压入栈中 |
| putfield indexbyte1,intdebyte2 | 设置对象字段的值,值和对象引用都从栈获取 |
| getfield indexbyte1,indexbyte2 | 将对象字段压入栈,对象引用从栈中获取 |
| putstatic indexbyte1,indexbyte2 | 设置类静态变量的值,从栈中获取 |
| getstatic indexbyte1,indexbyte2 | 将静态变量压入栈 |
| checkcast indexbyte1,indexbyte2 | 如果栈中的引用不是指定位置的类,则抛出异常 |
| instanceof indexbyte1,indexbyte2 | 同上,不过是往结果中压入true或false |
| newarray atype | 从栈中弹出长度,分配atype类型的数组 |
| anewarray indexbyte1,intdexbyte2 | 从栈中取长度,index取类型 |
| multianewarray index1,index2,dimensions | 分配多维数组 |
| arraylength | 从栈中弹出一个引用,并将其长度压入栈 |
| baload | 从栈中取数组引用和下标,把对应boolean压入栈 |
| caload | 同上,char |
| saload | 同上,short |
| iaload | 同上,int |
| laload | 同上,long |
| faload | 同上,folat |
| daload | 同上,double |
| aaload | 同上,array |
| bastore |
将byte或boolean类型的值value、索引index、数组引用arrayref弹出栈,赋值为arrayref[index]=value 其他类型同上 |
| ifeq branchbyte1,branchbyte2 | 从栈中弹出int型,为0则跳转到指定的分支执行 |
| ifne branchbyte1,branchbyte2 | 同上,不为0则跳转到指定的分支执行 |
| iflt branchbyte1,branchbyte2 | 同上,如果小于0,则跳转到指定的分支执行 |
| ifle branchbyte1,branchbyte2 | 同上,如果小于等于0,则跳转到指定的分支执行 |
| ifgt branchbyte1,branchbyte2 | 同上,如果大于0,则跳转到指定的分支执行 |
| ifge branchbyte1,branchbyte2 | 同上,如果大于等于0,则跳转到指定的分支执行 |
| if_icmpeq branchbyte1,branchbyte2 | 栈中弹出两个int,如果的一个等于第二个,跳转 |
| if_icmpme branchbyte1,branchbyte2 | 栈中弹出两个int,如果的一个不等于第二个,跳转 |
| if_icmplt branchbyte1,branchbyte2 | 栈中弹出两个int,如果的一个小于第二个,跳转 |
| if_icmple branchbyte1,branchbyte2 | 栈中弹出两个int,如果的一个小于等于第二个,跳转 |
| if_icmpgt branchbyte1,branchbyte2 | 栈中弹出两个int,如果的一个大于第二个,跳转 |
| if_icmpge branchbyte1,branchbyte2 | 栈中弹出两个int,如果的一个大于等于第二个,跳转 |
| lcmp | 从栈中弹出两个long,把结果-1、0、1放入栈 |
| fcmpg | 从栈中弹出两个float,把结果-1、0、1放入栈 |
| fcmpl | 从栈中弹出两个float,把结果-1、0、1放入栈 |
| dcmpg | 从栈中弹出两个double,把结果-1、0、1放入栈 |
| dcmpl | 从栈中弹出两个double,把结果-1、0、1放入栈 |
| ifnull branchbyte1,branchbyte2 | 从栈中弹出,如果是null就跳到分支 |
| ifnonnull branchbyte1,branchbyte2 | 从栈中弹出,如果不是null就跳到分支 |
分

浙公网安备 33010602011771号