Opcode Tables
Total Page:16
File Type:pdf, Size:1020Kb
A Appendix Opcode Tables In Chapter 2, you saw that Java bytecode is found in the code attribute part of the Java class file. Table A-1 lists all the possible Java bytecodes. The hex value for each opcode is shown along with the assembler-like opcode mnemonic. Table A-1. Java Bytecode-to-Opcode Mapping Opcode Hex Value Opcode Mnemonic 0 (OXOo) Nop 1 (OX01) aconst null 2 (OX02) iconst ml 3 (OX03) iconst 0 4 (OX04) iconst 1 5 (OXOS) iconst 2 6 (Ox06) iconst_3 7 (OX07) iconst_4 8 (ox08) iconst_5 9 (OX09) lconst 0 256 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 10 (oxoa) Ieonst 1 11 (oxOb) feonst 0 12 (oxoe) feonst 1 13 (oxOd) feonst 2 14 (oxoe) deonst 0 15 (oxof) deonst 1 16 (OX10) bipush 17 (OXll) sipush 18 (OX12) Ide 19 (OX13) Ide w 20 (OX14) Ide2 w 21 (OX1S) iload 22 (OX16) Hoad 23 (OX17) Hoad 24 (OX18) dload 25 (OX19) aload 26 (oxla) iload 0 27 (oxlb) iload 1 28 (oxle) iload 2 29 (oxld) iload_3 30 (oxle) Hoad 0 APPENDIX A: Opcode Tables 257 31 (Ox1f) Hoad 1 32 (OX20) Hoad 2 33 (OX21) Hoad_3 34 (OX22) Hoad 0 35 (OX23) Hoad 1 36 (OX24) Hoad 2 37 (OX25) Hoad_3 38 (OX26) dload 0 39 (OX27) dload 1 40 (OX28) dload 2 41 (OX29) dload_3 42 (Ox2a) aload 0 43 (Ox2b) aload 1 44 (OX2C) aload 2 45 (OX2d) aload_3 46 (Ox2e) iaload 47 (ox2f) laload 48 (OX30) faload 49 (OX31) daload 50 (OX32) aaload 51 (OX33) baload 52 (OX34) caload 258 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 53 (OX35) saload 54 (OX36) istore 55 (OX37) lstore 56 (OX38) fstore 57 (OX39) dstore 58 (ox3a) astore 59 (OX3b) istore 0 60 (OX3C) istore 1 61 (OX3d) istore 2 62 (ox3e) istore_3 63 (OX3f) lstore 0 64 (ox40) lstore 1 65 (ox41) lstore 2 66 (OX42) lstore_3 67 (ox43) fstore 0 68 (ox44) fstore 1 69 (ox45) fstore 2 70 (OX46) fstore_3 71 (OX47) dstore 0 72 (ox48) dstore 1 73 (ox49) dstore 2 APPENDIX A: Opcode Tables 259 74 (Ox4a) dstore_3 75 (Ox4b) astore 0 76 (OX4C) astore 1 77 (OX4d) astore 2 78 (Ox4e) astore_3 79 (OX4f) iastore 80 (Ox50) lastore 81 (OX51) fastore 82 (Ox52) dastore 83 (OX53) aastore 84 (OX54) bastore 85 (Ox55) castore 86 (OX56) sastore 87 (OX57) pop 88 (Ox58) pop2 89 (OX59) dup 90 (Ox5a) dup_X1 91 (OX5b) dup_X2 92 (Ox5c) dup2 93 (Ox5d) dup2_X1 94 (Ox5e) dup2_X2 95 (OX5f) swap 260 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 96 (ox60) iadd 97 (ox61) ladd 98 (Ox62) fadd 99 (ox63) dadd 100 (ox64) isub 101 (Ox6S) lsub 102 (Ox66) fsub 103 (Ox67) dsub 104 (ox68) imul 105 (Ox69) Imul 106 (ox6a) fmul 107 (ox6b) dmul 108 (ox6c) idiv 109 (Ox6d) Idiv 110 (ox6e) fdiv 111 (ox6f) ddiv 112 (ox70) irem 113 (OX71) lrem 114 (OX72) frem 115 (OX73) drem 116 (ox74) ineg APPENDIX A: Opcode Tables 261 117 (OX75) lneg 118 (OX76) fneg 119 (OX77) dneg 120 (OX78) ish I 121 (OX79) Ish I 122 (Ox7a) ishr 123 (Ox7b) lshr 124 (Ox7e) iushr 125 (OX7d) lushr 126 (Ox7e) iand 127 (OX7f) land 128 (ox80) ior 129 (Ox81) lor 130 (Ox82) ixor 131 (Ox83) lxor 132 (Ox84) iine 133 (Ox85) i21 134 (Ox86) i2f 135 (Ox87) i2d 136 (Ox88) 12i 137 (Ox89) 12f 138 (Ox8a) 12d 262 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 139 (ox8b) f2i 140 (ox8e) f21 141 (Ox8d) f2d 142 (ox8e) d2i 143 (ox8f) d21 144 (OX90) d2f 145 (OX91) i2b 146 (OX92) i2e 147 (OX93) i2s 148 (OX94) lemp 149 (OX95) fempl 150 (OX96) fempg 151 (OX97) dempl 152 (OX98) dempg 153 (OX99) ifeq 154 (ox9a) ifne 155 (OX9b) iflt 156 (oxge) ifge 157 (OX9d) ifgt 158 (oxge) ifle 159 (OX9f) if_iempeq APPENDIX A: Opcode Tables 263 160 (oxao) if_iempne 161 (Oxal) if_iemplt 162 (Oxa2) if_iempge 163 (Oxa3) if_iempgt 164 (Oxa4) if_iemple 165 (Oxa5) if_aempeq 166 (Oxa6) if_aempne 167 (Oxa7) goto 168 (Oxa8) jsr 169 (oxa9) ret 170 (oxaa) tableswiteh 171 (oxab) lookupswiteh 172 (oxae) ireturn 173 (oxad) lreturn 174 (oxae) freturn 175 (oxaf) dreturn 176 (oxbo) areturn 177 (Oxbl) return 178 (oxb2) getstatie 179 (oxb3) putstatie 180 (oxb4) getfield 181 (oxb5) putfield 264 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 182 (oxb6) invokevirtual 183 (oxb7) invokespecial 184 (oxb8) invokestatie 185 (oxb9) invokeinterfaee 186 (oxba) invokedynamie 187 (oxbb) new 188 (oxbe) newarray 189 (oxbd) anewarray 190 (oxbe) array length 191 (oxbf) athrow 192 (oxeo) eheekeast 193 (oxel) instaneeof 194 (oxe2) monitorenter 195 (oxe3) monitorexit 196 (oxe4) wide 197 (oxes) multianewarray 198 (oxe6) ifnull 199 (oxel) ifnonnull 200 (oxe8) goto_w 201 (oxe9) jsr_w APPENDIX A: Opcode Tables 265 Table A-2 lists all the possible Dalvik bytecodes encountered first in Chapter 3 and then throughput the book. The hex value for each opcode is shown along with the assembler-like opcode mnemonic. Table A-2. Dalvik 8ytecode-to-Opcode Mapping Opcode Hex Value Opcode Mnemonic 1 (OXOo) Nop 2 (OX01) move vx, vy 3 (OX02) movelfrom16 VX, vy 4 (OX03) move/16 5 (OX04) move-wide 6 (OX05) move-wide/from16 VX, vy 7 (Ox06) move-wide/16 8 (oxo7) move-object VX, vy 9 (ox08) move-object/from16 VX, vy 10 (OX09) move-object/16 11 (OXOA) move-result vx 12 (OXOB) move-result-wide vx 13 (OXOC) move-result-object vx 14 (oxOD) move-exception vx 15 (OxOE) return-void 16 (OxOF) return vx 17 (OX10) return-wide vx 18 (OXll) return-object vx 19 (OX12) const/4 VX, lit4 266 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 20 (OX13) const/16 VX, lit16 21 (OX14) const VX, lit32 22 (OX1S) const/high16 vo, lit16 23 (OX16) const-wide/16 VX, lit16 24 (ox17) const-wide/32 VX, lit32 2S (OX18) const-wide VX, lit64 26 (OX19) const-wide/high16 VX, lit16 27 (OX1A) const-string VX, string_id 28 (OX1B) const-string-jumbo 29 (OX1C) const-class VX, type_id 30 (OX1D) monitor-enter vx 31 (OX1E) monitor-exit 32 (OX1F) check-cast VX, type_id 33 (OX20) instance-of VX, vy, type_id 34 (OX21) array-length VX, vy 3S (OX22) new-instance VX, type 36 (OX23) new-array VX, vy, type_id 37 (OX24) filled-new-array {parameters}, type_id 38 (OX2S) filled-new-array-range {vx .. vy}, type_id 39 (OX26) fill-array-data VX, array_data_offset 40 (OX27) throw vx APPENDIX A: Opcode Tables 267 41 (OX28) goto target 42 (OX29) gotO/16 target 43 (OX2A) gotO/32 target 44 (OX2B) packed-switch VX, table 45 (OX2C) sparse-switch VX, table 46 (OX2D) cmpl-float 47 (OX2E) cmpg-float VX, vy, vz 48 (OX2F) cmpl-double VX, vy, vz 49 (OX30) cmpg-double VX, vy, vz 50 (OX31) cmp-Iong VX, vy, vz 51 (OX32) if-eq VX, vy, target 52 (OX33) if-ne VX, vy, target 53 (OX34) if-lt VX, vy, target 54 (OX35) if-ge VX, vy, target 55 (OX36) if-gt VX, vy, target 56 (OX37) if-Ie VX, vy, target 57 (OX38) if-eqz VX, target 58 (OX39) if-nez VX, target 59 (OX3A) if-ltz VX, target 60 (OX3B) if-gez VX, target 61 (OX3C) if-gtz VX, target 62 (OX3D) if-Iez VX, target 268 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 63 (OX3E) unused_3E 64 (OX3F) unused_3F 65 (OX40) unused_40 66 (ox41) unused_41 67 (ox42) unused_42 68 (OX43) unused_43 69 (OX44) aget vx, vy, vz 70 (OX45) aget-wide vx, vy, vz 71 (ox46) aget-object vx, vy, vz 72 (OX47) aget-boolean vx, vy, vz 73 (OX48) aget-byte vx, vy, vz 74 (ox49) aget-char vx, vy, vz 75 (ox4A) aget-short vx, vy, vz 76 (OX4B) aput vx, vy, vz 77 (ox4C) aput-wide vx, vy, vz 78 (ox4D) aput-object vx, vy, vz 79 (ox4E) aput-boolean vx, vy, vz 80 (OX4F) aput-byte vx, vy, vz 81 (OX50) aput-char vx, vy, vz 82 (ox51) aput-short vx, vy, vz 83 (ox52) iget vx, vy, field id APPENDIX A: Opcode Tables 269 84 (Ox53) iget-wide vx, vy, field_id 85 (Ox54) iget-object vx, vy, field_id 86 (OX55) iget-boolean VX, vy, field_id 87 (Ox56) iget-byte VX, vy, field id 88 (ox57) iget-char VX, vy, field id 89 (OX58) iget-short VX, vy, field_id 90 (Ox59) iput VX, vy, field_id 91 (OX5A) iput-wide VX, vy, field_id 92 (ox5B) iput-object vx, vy,field_id 93 (OX5C) iput-boolean vx, vy, field_id 94 (OX5D) iput-byte VX, vy, field id 95 (ox5E) iput-char vx, vy, field id 96 (OX5F) iput-short VX, vy, field id 97 (Ox60) sget vx, field_id 98 (ox61) sget-wide vx, field_id 99 (Ox62) sget-object vx, field_id 100 (ox63) sget-boolean vx, field_id 101 (Ox64) sget-byte vx, field id 102 (ox65) sget-char vx, field id 103 (ox66) sget-short vx, field_id 104 (ox67) sput vx, field_id 105 (Ox68) sput-wide vx, field id 270 APPENDIX A: Opcode Tables Opcode Hex Value Opcode Mnemonic 106 (ox69) sput-object vx, field id 107 (ox6A) sput-boolean vx, field_id 108 (Ox6B) sput-byte vx, field id 109 (ox6C) sput-char vx, field id 110 (ox6D) sput-short vx, field_id 111 (Ox6E) invoke-virtual { parameters }, methodtocall 112 (Ox6F) invoke-super {parameter}, methodtocall 113 (OX70) invoke-direct { parameters }, methodtocall 114 (ox71) invoke-static {parameters}, methodtocall 115 (oxn) invoke-interface {parameters}, methodtocall 116 (OX73) unused_73 117 (ox74) invoke-virtual/range {vx .. vy}, methodtocall 118 (ox75) invoke-super/range 119 (OX76) invoke-direct/range {vx .. vy}, methodtocall 120 (oxn) invoke-static/range {vx .