JVM 字节码指令手册 - 查看 Java 字节码
生活随笔
收集整理的這篇文章主要介紹了
JVM 字节码指令手册 - 查看 Java 字节码
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
JVM 字節(jié)碼指令手冊(cè) - 查看 Java 字節(jié)碼
jdk 進(jìn)行的編譯生成的 .class 是 16 進(jìn)制數(shù)據(jù)文件,不利于學(xué)習(xí)分析。通過下命令
javap -c Demo.class > Demo.txt或者其他方式可反匯編,得到字節(jié)碼文件
一、JVM 指令分類
(1)操作數(shù)棧
| 變量到操作數(shù)棧 | iload, iload_, lload, lload_, fload, fload_, dload, dload_, aload, aload_ |
| 操作數(shù)棧到變量 | istore, istore_, lstore, lstore_, fstore, fstore_, dstore, dstor_, astore, astore_ |
| 常數(shù)到操作數(shù)棧 | bipush, sipush, ldc, ldc_w, ldc2_w, aconst_null, iconst_ml, iconst_, lconst_, fconst_, dconst_ |
| 把數(shù)據(jù)裝載到操作數(shù)棧 | baload, caload, saload, iaload, laload, faload, daload, aaload |
| 從操作數(shù)棧存存儲(chǔ)到數(shù)組 | bastore, castore, sastore, iastore, lastore, fastore, dastore, aastore |
| 操作數(shù)棧管理 | pop, pop2, dup, dup2, dup_xl, dup2_xl, dup_x2, dup2_x2, swap |
(2)運(yùn)算與轉(zhuǎn)換
| 加 | iadd, ladd, fadd, dadd |
| 減 | is, ls, fs, ds |
| 乘 | imul, lmul, fmul, dmul |
| 除 | idiv, ldiv, fdiv, ddiv |
| 余數(shù) | irem, lrem, frem, drem |
| 取負(fù) | ineg, lneg, fneg, dneg |
| 移位 | ishl, lshr, iushr, lshl, lshr, lushr |
| 按位或 | ior, lor |
| 按位與 | iand, land |
| 按位異或 | ixor, lxor |
| 類型轉(zhuǎn)換 | i2l, i2f, i2d, l2f, l2d, f2d(放寬數(shù)值轉(zhuǎn)換); i2b, i2c, i2s, l2i, f2i, f2l, d2i, d2l, d2f(縮窄數(shù)值轉(zhuǎn)換) |
(3)條件轉(zhuǎn)移
| 有條件轉(zhuǎn)移 | ifeq, iflt, ifle, ifne, ifgt, ifge, ifnull, ifnonnull, if_icmpeq, if_icmpene, if_icmplt, if_icmpgt, if_icmple, if_icmpge, if_acmpeq, if_acmpne, lcmp, fcmpl, fcmpg, dcmpl, dcmpg |
| 復(fù)合條件轉(zhuǎn)移 | tableswitch, lookupswitch |
| 無條件轉(zhuǎn)移 | goto, goto_w, jsr, jsr_w, ret |
(4)類與數(shù)組
| 創(chuàng)建類實(shí)便:new | |
| 創(chuàng)建新數(shù)組:newarray, anewarray, multianwarray | |
| 訪問類的域和類實(shí)例域:getfield, putfield, getstatic, putstatic | |
| 獲取數(shù)組長度:arraylength | |
| 檢相類實(shí)例或數(shù)組屬性:instanceof, checkcast |
(5)調(diào)度與返回加finally
| 調(diào)度對(duì)象的實(shí)便方法 | invokevirt l |
| 調(diào)用由接口實(shí)現(xiàn)的方法 | invokeinterface |
| 調(diào)用需要特殊處理的實(shí)例方法 | invokespecial |
| 調(diào)用命名類中的靜態(tài)方法 | invokestatic |
| 方法返回 | ireturn, lreturn, freturn, dreturn, areturn, return |
| 異常 | athrow |
| finally 關(guān)鍵字的實(shí)現(xiàn)使用 | jsr, jsr_w, ret |
二、JVM 指令集表
| 0x00 | nop | 什么都不做 |
| 0x01 | aconst_null | 將 null 推送至棧頂 |
| 0x02 | iconst_m1 | 將 int 型 -1 推送至棧頂 |
| 0x03 | iconst_0 | 將 int 型 0 推送至棧頂 |
| 0x04 | iconst_1 | 將 int 型 1 推送至棧頂 |
| 0x05 | iconst_2 | 將 int 型 2 推送至棧頂 |
| 0x06 | iconst_3 | 將 int 型 3 推送至棧頂 |
| 0x07 | iconst_4 | 將 int 型 4 推送至棧頂 |
| 0x08 | iconst_5 | 將 int 型 5 推送至棧頂 |
| 0x09 | lconst_0 | 將 long 型 0 推送至棧頂 |
| 0x0a | lconst_1 | 將 long 型 1 推送至棧頂 |
| 0x0b | fconst_0 | 將 float 型 0 推送至棧頂 |
| 0x0c | fconst_1 | 將 float 型 1 推送至棧頂 |
| 0x0d | fconst_2 | 將 float 型 2 推送至棧頂 |
| 0x0e | dconst_0 | 將 double 型 0 推送至棧頂 |
| 0x0f | dconst_1 | 將 double 型 1 推送至棧頂 |
| 0x10 | bipush | 將單字節(jié)的常量值 (-128~127) 推送至棧頂 |
| 0x11 | sipush | 將一個(gè)短整型常量值 (-32768~32767) 推送至棧頂 |
| 0x12 | ldc | 將int, |
| 0x13 | ldc_w | 將int, |
| 0x14 | ldc2_w | 將 long 或 double 型常量值從常量池中推送至棧頂(寬索引) |
| 0x15 | iload | 將指定的 int 型本地變量推送至棧頂 |
| 0x16 | lload | 將指定的 long 型本地變量推送至棧頂 |
| 0x17 | fload | 將指定的 float 型本地變量推送至棧頂 |
| 0x18 | dload | 將指定的 double 型本地變量推送至棧頂 |
| 0x19 | aload | 將指定的引用類型本地變量推送至棧頂 |
| 0x1a | iload_0 | 將第一個(gè) int 型本地變量推送至棧頂 |
| 0x1b | iload_1 | 將第二個(gè) int 型本地變量推送至棧頂 |
| 0x1c | iload_2 | 將第三個(gè) int 型本地變量推送至棧頂 |
| 0x1d | iload_3 | 將第四個(gè) int 型本地變量推送至棧頂 |
| 0x1e | lload_0 | 將第一個(gè) long 型本地變量推送至棧頂 |
| 0x1f | lload_1 | 將第二個(gè) long 型本地變量推送至棧頂 |
| 0x20 | lload_2 | 將第三個(gè) long 型本地變量推送至棧頂 |
| 0x21 | lload_3 | 將第四個(gè) long 型本地變量推送至棧頂 |
| 0x22 | fload_0 | 將第一個(gè) float 型本地變量推送至棧頂 |
| 0x23 | fload_1 | 將第二個(gè) float 型本地變量推送至棧頂 |
| 0x24 | fload_2 | 將第三個(gè) float 型本地變量推送至棧頂 |
| 0x25 | fload_3 | 將第四個(gè) float 型本地變量推送至棧頂 |
| 0x26 | dload_0 | 將第一個(gè) double 型本地變量推送至棧頂 |
| 0x27 | dload_1 | 將第二個(gè) double 型本地變量推送至棧頂 |
| 0x28 | dload_2 | 將第三個(gè) double 型本地變量推送至棧頂 |
| 0x29 | dload_3 | 將第四個(gè) double 型本地變量推送至棧頂 |
| 0x2a | aload_0 | 將第一個(gè)引用類型本地變量推送至棧頂 |
| 0x2b | aload_1 | 將第二個(gè)引用類型本地變量推送至棧頂 |
| 0x2c | aload_2 | 將第三個(gè)引用類型本地變量推送至棧頂 |
| 0x2d | aload_3 | 將第四個(gè)引用類型本地變量推送至棧頂 |
| 0x2e | iaload | 將 int 型數(shù)組指定索引的值推送至棧頂 |
| 0x2f | laload | 將 long 型數(shù)組指定索引的值推送至棧頂 |
| 0x30 | faload | 將 float 型數(shù)組指定索引的值推送至棧頂 |
| 0x31 | daload | 將 double 型數(shù)組指定索引的值推送至棧頂 |
| 0x32 | aaload | 將引用型數(shù)組指定索引的值推送至棧頂 |
| 0x33 | baload | 將 boolean 或 byte 型數(shù)組指定索引的值推送至棧頂 |
| 0x34 | caload | 將 char 型數(shù)組指定索引的值推送至棧頂 |
| 0x35 | saload | 將 short 型數(shù)組指定索引的值推送至棧頂 |
| 0x36 | istore | 將棧頂 int 型數(shù)值存入指定本地變量 |
| 0x37 | lstore | 將棧頂 long 型數(shù)值存入指定本地變量 |
| 0x38 | fstore | 將棧頂 float 型數(shù)值存入指定本地變量 |
| 0x39 | dstore | 將棧頂 double 型數(shù)值存入指定本地變量 |
| 0x3a | astore | 將棧頂引用型數(shù)值存入指定本地變量 |
| 0x3b | istore_0 | 將棧頂 int 型數(shù)值存入第一個(gè)本地變量 |
| 0x3c | istore_1 | 將棧頂 int 型數(shù)值存入第二個(gè)本地變量 |
| 0x3d | istore_2 | 將棧頂 int 型數(shù)值存入第三個(gè)本地變量 |
| 0x3e | istore_3 | 將棧頂 int 型數(shù)值存入第四個(gè)本地變量 |
| 0x3f | lstore_0 | 將棧頂 long 型數(shù)值存入第一個(gè)本地變量 |
| 0x40 | lstore_1 | 將棧頂 long 型數(shù)值存入第二個(gè)本地變量 |
| 0x41 | lstore_2 | 將棧頂 long 型數(shù)值存入第三個(gè)本地變量 |
| 0x42 | lstore_3 | 將棧頂 long 型數(shù)值存入第四個(gè)本地變量 |
| 0x43 | fstore_0 | 將棧頂 float 型數(shù)值存入第一個(gè)本地變量 |
| 0x44 | fstore_1 | 將棧頂 float 型數(shù)值存入第二個(gè)本地變量 |
| 0x45 | fstore_2 | 將棧頂 float 型數(shù)值存入第三個(gè)本地變量 |
| 0x46 | fstore_3 | 將棧頂 float 型數(shù)值存入第四個(gè)本地變量 |
| 0x47 | dstore_0 | 將棧頂 double 型數(shù)值存入第一個(gè)本地變量 |
| 0x48 | dstore_1 | 將棧頂 double 型數(shù)值存入第二個(gè)本地變量 |
| 0x49 | dstore_2 | 將棧頂 double 型數(shù)值存入第三個(gè)本地變量 |
| 0x4a | dstore_3 | 將棧頂 double 型數(shù)值存入第四個(gè)本地變量 |
| 0x4b | astore_0 | 將棧頂引用型數(shù)值存入第一個(gè)本地變量 |
| 0x4c | astore_1 | 將棧頂引用型數(shù)值存入第二個(gè)本地變量 |
| 0x4d | astore_2 | 將棧頂引用型數(shù)值存入第三個(gè)本地變量 |
| 0x4e | astore_3 | 將棧頂引用型數(shù)值存入第四個(gè)本地變量 |
| 0x4f | iastore | 將棧頂 int 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x50 | lastore | 將棧頂 long 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x51 | fastore | 將棧頂 float 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x52 | dastore | 將棧頂 double 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x53 | aastore | 將棧頂引用型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x54 | bastore | 將棧頂 boolean 或 byte 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x55 | castore | 將棧頂 char 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x56 | sastore | 將棧頂 short 型數(shù)值存入指定數(shù)組的指定索引位置 |
| 0x57 | pop | 將棧頂數(shù)值彈出 |
| 0x58 | pop2 | 將棧頂?shù)囊粋€(gè)(long 或 double 類型的)或兩個(gè)數(shù)值彈出(其它) |
| 0x59 | dup | 復(fù)制棧頂數(shù)值并將復(fù)制值壓入棧頂 |
| 0x5a | dup_x1 | 復(fù)制棧頂數(shù)值并將兩個(gè)復(fù)制值壓入棧頂 |
| 0x5b | dup_x2 | 復(fù)制棧頂數(shù)值并將三個(gè)(或兩個(gè))復(fù)制值壓入棧頂 |
| 0x5c | dup2 | 復(fù)制棧頂一個(gè)(long 或 double 類型的)或兩個(gè)(其它)數(shù)值并將復(fù)制值壓入棧頂 |
| 0x5d | dup2_x1 | <待補(bǔ)充> |
| 0x5e | dup2_x2 | <待補(bǔ)充> |
| 0x5f | swap | 將棧最頂端的兩個(gè)數(shù)值互換(數(shù)值不能是 long 或 double 類型的) |
| 0x60 | iadd | 將棧頂兩 int 型數(shù)值相加并將結(jié)果壓入棧頂 |
| 0x61 | ladd | 將棧頂兩 long 型數(shù)值相加并將結(jié)果壓入棧頂 |
| 0x62 | fadd | 將棧頂兩 float 型數(shù)值相加并將結(jié)果壓入棧頂 |
| 0x63 | dadd | 將棧頂兩 double 型數(shù)值相加并將結(jié)果壓入棧頂 |
| 0x64 | isub | 將棧頂兩 int 型數(shù)值相減并將結(jié)果壓入棧頂 |
| 0x65 | lsub | 將棧頂兩 long 型數(shù)值相減并將結(jié)果壓入棧頂 |
| 0x66 | fsub | 將棧頂兩 float 型數(shù)值相減并將結(jié)果壓入棧頂 |
| 0x67 | dsub | 將棧頂兩 double 型數(shù)值相減并將結(jié)果壓入棧頂 |
| 0x68 | imul | 將棧頂兩 int 型數(shù)值相乘并將結(jié)果壓入棧頂 |
| 0x69 | lmul | 將棧頂兩 long 型數(shù)值相乘并將結(jié)果壓入棧頂 |
| 0x6a | fmul | 將棧頂兩 float 型數(shù)值相乘并將結(jié)果壓入棧頂 |
| 0x6b | dmul | 將棧頂兩 double 型數(shù)值相乘并將結(jié)果壓入棧頂 |
| 0x6c | idiv | 將棧頂兩 int 型數(shù)值相除并將結(jié)果壓入棧頂 |
| 0x6d | ldiv | 將棧頂兩 long 型數(shù)值相除并將結(jié)果壓入棧頂 |
| 0x6e | fdiv | 將棧頂兩 float 型數(shù)值相除并將結(jié)果壓入棧頂 |
| 0x6f | ddiv | 將棧頂兩 double 型數(shù)值相除并將結(jié)果壓入棧頂 |
| 0x70 | irem | 將棧頂兩 int 型數(shù)值作取模運(yùn)算并將結(jié)果壓入棧頂 |
| 0x71 | lrem | 將棧頂兩 long 型數(shù)值作取模運(yùn)算并將結(jié)果壓入棧頂 |
| 0x72 | frem | 將棧頂兩 float 型數(shù)值作取模運(yùn)算并將結(jié)果壓入棧頂 |
| 0x73 | drem | 將棧頂兩 double 型數(shù)值作取模運(yùn)算并將結(jié)果壓入棧頂 |
| 0x74 | ineg | 將棧頂 int 型數(shù)值取負(fù)并將結(jié)果壓入棧頂 |
| 0x75 | lneg | 將棧頂 long 型數(shù)值取負(fù)并將結(jié)果壓入棧頂 |
| 0x76 | fneg | 將棧頂 float 型數(shù)值取負(fù)并將結(jié)果壓入棧頂 |
| 0x77 | dneg | 將棧頂 double 型數(shù)值取負(fù)并將結(jié)果壓入棧頂 |
| 0x78 | ishl | 將 int 型數(shù)值左移位指定位數(shù)并將結(jié)果壓入棧頂 |
| 0x79 | lshl | 將 long 型數(shù)值左移位指定位數(shù)并將結(jié)果壓入棧頂 |
| 0x7a | ishr | 將 int 型數(shù)值右(符號(hào))移位指定位數(shù)并將結(jié)果壓入棧頂 |
| 0x7b | lshr | 將 long 型數(shù)值右(符號(hào))移位指定位數(shù)并將結(jié)果壓入棧頂 |
| 0x7c | iushr | 將 int 型數(shù)值右(無符號(hào))移位指定位數(shù)并將結(jié)果壓入棧頂 |
| 0x7d | lushr | 將 long 型數(shù)值右(無符號(hào))移位指定位數(shù)并將結(jié)果壓入棧頂 |
| 0x7e | iand | 將棧頂兩 int 型數(shù)值作“按位與”并將結(jié)果壓入棧頂 |
| 0x7f | land | 將棧頂兩 long 型數(shù)值作“按位與”并將結(jié)果壓入棧頂 |
| 0x80 | ior | 將棧頂兩 int 型數(shù)值作“按位或”并將結(jié)果壓入棧頂 |
| 0x81 | lor | 將棧頂兩 long 型數(shù)值作“按位或”并將結(jié)果壓入棧頂 |
| 0x82 | ixor | 將棧頂兩 int 型數(shù)值作“按位異或”并將結(jié)果壓入棧頂 |
| 0x83 | lxor | 將棧頂兩 long 型數(shù)值作“按位異或”并將結(jié)果壓入棧頂 |
| 0x84 | iinc | 將指定 int 型變量增加指定值(i++, |
| 0x85 | i2l | 將棧頂 int 型數(shù)值強(qiáng)制轉(zhuǎn)換成 long 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x86 | i2f | 將棧頂 int 型數(shù)值強(qiáng)制轉(zhuǎn)換成 float 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x87 | i2d | 將棧頂 int 型數(shù)值強(qiáng)制轉(zhuǎn)換成 double 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x88 | l2i | 將棧頂 long 型數(shù)值強(qiáng)制轉(zhuǎn)換成 int 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x89 | l2f | 將棧頂 long 型數(shù)值強(qiáng)制轉(zhuǎn)換成 float 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x8a | l2d | 將棧頂 long 型數(shù)值強(qiáng)制轉(zhuǎn)換成 double 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x8b | f2i | 將棧頂 float 型數(shù)值強(qiáng)制轉(zhuǎn)換成 int 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x8c | f2l | 將棧頂 float 型數(shù)值強(qiáng)制轉(zhuǎn)換成 long 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x8d | f2d | 將棧頂 float 型數(shù)值強(qiáng)制轉(zhuǎn)換成 double 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x8e | d2i | 將棧頂 double 型數(shù)值強(qiáng)制轉(zhuǎn)換成 int 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x8f | d2l | 將棧頂 double 型數(shù)值強(qiáng)制轉(zhuǎn)換成 long 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x90 | d2f | 將棧頂 double 型數(shù)值強(qiáng)制轉(zhuǎn)換成 float 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x91 | i2b | 將棧頂 int 型數(shù)值強(qiáng)制轉(zhuǎn)換成 byte 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x92 | i2c | 將棧頂 int 型數(shù)值強(qiáng)制轉(zhuǎn)換成 char 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x93 | i2s | 將棧頂 int 型數(shù)值強(qiáng)制轉(zhuǎn)換成 short 型數(shù)值并將結(jié)果壓入棧頂 |
| 0x94 | lcmp | 比較棧頂兩 long 型數(shù)值大小,并將結(jié)果(1,0,-1)壓入棧頂 |
| 0x95 | fcmpl | 比較棧頂兩 float 型數(shù)值大小,并將結(jié)果(1,0,-1)壓入棧頂;當(dāng)其中一個(gè)數(shù)值為 NaN 時(shí),將 -1 壓入棧頂 |
| 0x96 | fcmpg | 比較棧頂兩 float 型數(shù)值大小,并將結(jié)果(1,0,-1)壓入棧頂;當(dāng)其中一個(gè)數(shù)值為 NaN 時(shí),將 1 壓入棧頂 |
| 0x97 | dcmpl | 比較棧頂兩 double 型數(shù)值大小,并將結(jié)果(1,0,-1)壓入棧頂;當(dāng)其中一個(gè)數(shù)值為 NaN 時(shí),將 -1 壓入棧頂 |
| 0x98 | dcmpg | 比較棧頂兩 double 型數(shù)值大小,并將結(jié)果(1,0,-1)壓入棧頂;當(dāng)其中一個(gè)數(shù)值為 NaN 時(shí),將 1 壓入棧頂 |
| 0x99 | ifeq | 當(dāng)棧頂 int 型數(shù)值等于 0 時(shí)跳轉(zhuǎn) |
| 0x9a | ifne | 當(dāng)棧頂 int 型數(shù)值不等于 0 時(shí)跳轉(zhuǎn) |
| 0x9b | iflt | 當(dāng)棧頂 int 型數(shù)值小于 0 時(shí)跳轉(zhuǎn) |
| 0x9c | ifge | 當(dāng)棧頂 int 型數(shù)值大于等于 0 時(shí)跳轉(zhuǎn) |
| 0x9d | ifgt | 當(dāng)棧頂 int 型數(shù)值大于 0 時(shí)跳轉(zhuǎn) |
| 0x9e | ifle | 當(dāng)棧頂 int 型數(shù)值小于等于 0 時(shí)跳轉(zhuǎn) |
| 0x9f | if_icmpeq | 比較棧頂兩 int 型數(shù)值大小,當(dāng)結(jié)果等于 0 時(shí)跳轉(zhuǎn) |
| 0xa0 | if_icmpne | 比較棧頂兩 int 型數(shù)值大小,當(dāng)結(jié)果不等于 0 時(shí)跳轉(zhuǎn) |
| 0xa1 | if_icmplt | 比較棧頂兩 int 型數(shù)值大小,當(dāng)結(jié)果小于 0 時(shí)跳轉(zhuǎn) |
| 0xa2 | if_icmpge | 比較棧頂兩 int 型數(shù)值大小,當(dāng)結(jié)果大于等于 0 時(shí)跳轉(zhuǎn) |
| 0xa3 | if_icmpgt | 比較棧頂兩 int 型數(shù)值大小,當(dāng)結(jié)果大于 0 時(shí)跳轉(zhuǎn) |
| 0xa4 | if_icmple | 比較棧頂兩 int 型數(shù)值大小,當(dāng)結(jié)果小于等于 0 時(shí)跳轉(zhuǎn) |
| 0xa5 | if_acmpeq | 比較棧頂兩引用型數(shù)值,當(dāng)結(jié)果相等時(shí)跳轉(zhuǎn) |
| 0xa6 | if_acmpne | 比較棧頂兩引用型數(shù)值,當(dāng)結(jié)果不相等時(shí)跳轉(zhuǎn) |
| 0xa7 | goto | 無條件跳轉(zhuǎn) |
| 0xa8 | jsr | 跳轉(zhuǎn)至指定 16 位 offset 位置,并將 jsr 下一條指令地址壓入棧頂 |
| 0xa9 | ret | 返回至本地變量指定的 index 的指令位置(一般與 jsr, jsr_w 聯(lián)合使用) |
| 0xaa | tableswitch | 用于 switch 條件跳轉(zhuǎn),case 值連續(xù)(可變長度指令) |
| 0xab | lookupswitch | 用于 switch 條件跳轉(zhuǎn),case 值不連續(xù)(可變長度指令) |
| 0xac | ireturn | 從當(dāng)前方法返回 int |
| 0xad | lreturn | 從當(dāng)前方法返回 long |
| 0xae | freturn | 從當(dāng)前方法返回 float |
| 0xaf | dreturn | 從當(dāng)前方法返回 double |
| 0xb0 | areturn | 從當(dāng)前方法返回對(duì)象引用 |
| 0xb1 | return | 從當(dāng)前方法返回void |
| 0xb2 | getstatic | 獲取指定類的靜態(tài)域,并將其值壓入棧頂 |
| 0xb3 | putstatic | 為指定的類的靜態(tài)域賦值 |
| 0xb4 | getfield | 獲取指定類的實(shí)例域,并將其值壓入棧頂 |
| 0xb5 | putfield | 為指定的類的實(shí)例域賦值 |
| 0xb6 | invokevirtual | 調(diào)用實(shí)例方法 |
| 0xb7 | invokespecial | 調(diào)用超類構(gòu)造方法,實(shí)例初始化方法,私有方法 |
| 0xb8 | invokestatic | 調(diào)用靜態(tài)方法 |
| 0xb9 | invokeinterface | 調(diào)用接口方法 |
| 0xba | – | |
| 0xbb | new | 創(chuàng)建一個(gè)對(duì)象,并將其引用值壓入棧頂 |
| 0xbc | newarray | 創(chuàng)建一個(gè)指定原始類型(如int, float, char…)的數(shù)組,并將其引用值壓入棧頂 |
| 0xbd | anewarray | 創(chuàng)建一個(gè)引用型(如類,接口,數(shù)組)的數(shù)組,并將其引用值壓入棧頂 |
| 0xbe | arraylength | 獲得數(shù)組的長度值并壓入棧頂 |
| 0xbf | athrow | 將棧頂?shù)漠惓伋?/td> |
| 0xc0 | checkcast | 檢驗(yàn)類型轉(zhuǎn)換,檢驗(yàn)未通過將拋出 ClassCastException |
| 0xc1 | instanceof | 檢驗(yàn)對(duì)象是否是指定的類的實(shí)例,如果是將 1 壓入棧頂,否則將0壓入棧頂 |
| 0xc2 | monitorenter | 獲得對(duì)象的鎖,用于同步方法或同步塊 |
| 0xc3 | monitorexit | 釋放對(duì)象的鎖,用于同步方法或同步塊 |
| 0xc4 | wide | <待補(bǔ)充> |
| 0xc5 | multianewarray | 創(chuàng)建指定類型和指定維度的多維數(shù)組(執(zhí)行該指令時(shí),操作棧中必須包含各維度的長度值),并將其引用值壓入棧頂 |
| 0xc6 | ifnull | 為 null 時(shí)跳轉(zhuǎn) |
| 0xc7 | ifnonnull | 不為 null 時(shí)跳轉(zhuǎn) |
| 0xc8 | goto_w | 無條件跳轉(zhuǎn)(寬索引) |
| 0xc9 | jsr_w | 跳轉(zhuǎn)至指定 32 位 offset 位置,并將 jsr_w 下一條指令地址壓入棧頂 |
總結(jié)
以上是生活随笔為你收集整理的JVM 字节码指令手册 - 查看 Java 字节码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: UI自动化测试工具-国产和国外
- 下一篇: Java完全自学手册pdf,flutte