You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Opcode.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. /*
  2. * Javassist, a Java-bytecode translator toolkit.
  3. * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. Alternatively, the contents of this file may be used under
  8. * the terms of the GNU Lesser General Public License Version 2.1 or later,
  9. * or the Apache License Version 2.0.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. */
  16. package javassist.bytecode;
  17. /**
  18. * JVM Instruction Set.
  19. *
  20. * <p>This interface defines opcodes and
  21. * array types for the NEWARRAY instruction.
  22. *
  23. * @see Mnemonic
  24. */
  25. public interface Opcode {
  26. /* Opcodes */
  27. int AALOAD = 50;
  28. int AASTORE = 83;
  29. int ACONST_NULL = 1;
  30. int ALOAD = 25;
  31. int ALOAD_0 = 42;
  32. int ALOAD_1 = 43;
  33. int ALOAD_2 = 44;
  34. int ALOAD_3 = 45;
  35. int ANEWARRAY = 189;
  36. int ARETURN = 176;
  37. int ARRAYLENGTH = 190;
  38. int ASTORE = 58;
  39. int ASTORE_0 = 75;
  40. int ASTORE_1 = 76;
  41. int ASTORE_2 = 77;
  42. int ASTORE_3 = 78;
  43. int ATHROW = 191;
  44. int BALOAD = 51;
  45. int BASTORE = 84;
  46. int BIPUSH = 16;
  47. int CALOAD = 52;
  48. int CASTORE = 85;
  49. int CHECKCAST = 192;
  50. int D2F = 144;
  51. int D2I = 142;
  52. int D2L = 143;
  53. int DADD = 99;
  54. int DALOAD = 49;
  55. int DASTORE = 82;
  56. int DCMPG = 152;
  57. int DCMPL = 151;
  58. int DCONST_0 = 14;
  59. int DCONST_1 = 15;
  60. int DDIV = 111;
  61. int DLOAD = 24;
  62. int DLOAD_0 = 38;
  63. int DLOAD_1 = 39;
  64. int DLOAD_2 = 40;
  65. int DLOAD_3 = 41;
  66. int DMUL = 107;
  67. int DNEG = 119;
  68. int DREM = 115;
  69. int DRETURN = 175;
  70. int DSTORE = 57;
  71. int DSTORE_0 = 71;
  72. int DSTORE_1 = 72;
  73. int DSTORE_2 = 73;
  74. int DSTORE_3 = 74;
  75. int DSUB = 103;
  76. int DUP = 89;
  77. int DUP2 = 92;
  78. int DUP2_X1 = 93;
  79. int DUP2_X2 = 94;
  80. int DUP_X1 = 90;
  81. int DUP_X2 = 91;
  82. int F2D = 141;
  83. int F2I = 139;
  84. int F2L = 140;
  85. int FADD = 98;
  86. int FALOAD = 48;
  87. int FASTORE = 81;
  88. int FCMPG = 150;
  89. int FCMPL = 149;
  90. int FCONST_0 = 11;
  91. int FCONST_1 = 12;
  92. int FCONST_2 = 13;
  93. int FDIV = 110;
  94. int FLOAD = 23;
  95. int FLOAD_0 = 34;
  96. int FLOAD_1 = 35;
  97. int FLOAD_2 = 36;
  98. int FLOAD_3 = 37;
  99. int FMUL = 106;
  100. int FNEG = 118;
  101. int FREM = 114;
  102. int FRETURN = 174;
  103. int FSTORE = 56;
  104. int FSTORE_0 = 67;
  105. int FSTORE_1 = 68;
  106. int FSTORE_2 = 69;
  107. int FSTORE_3 = 70;
  108. int FSUB = 102;
  109. int GETFIELD = 180;
  110. int GETSTATIC = 178;
  111. int GOTO = 167;
  112. int GOTO_W = 200;
  113. int I2B = 145;
  114. int I2C = 146;
  115. int I2D = 135;
  116. int I2F = 134;
  117. int I2L = 133;
  118. int I2S = 147;
  119. int IADD = 96;
  120. int IALOAD = 46;
  121. int IAND = 126;
  122. int IASTORE = 79;
  123. int ICONST_0 = 3;
  124. int ICONST_1 = 4;
  125. int ICONST_2 = 5;
  126. int ICONST_3 = 6;
  127. int ICONST_4 = 7;
  128. int ICONST_5 = 8;
  129. int ICONST_M1 = 2;
  130. int IDIV = 108;
  131. int IFEQ = 153;
  132. int IFGE = 156;
  133. int IFGT = 157;
  134. int IFLE = 158;
  135. int IFLT = 155;
  136. int IFNE = 154;
  137. int IFNONNULL = 199;
  138. int IFNULL = 198;
  139. int IF_ACMPEQ = 165;
  140. int IF_ACMPNE = 166;
  141. int IF_ICMPEQ = 159;
  142. int IF_ICMPGE = 162;
  143. int IF_ICMPGT = 163;
  144. int IF_ICMPLE = 164;
  145. int IF_ICMPLT = 161;
  146. int IF_ICMPNE = 160;
  147. int IINC = 132;
  148. int ILOAD = 21;
  149. int ILOAD_0 = 26;
  150. int ILOAD_1 = 27;
  151. int ILOAD_2 = 28;
  152. int ILOAD_3 = 29;
  153. int IMUL = 104;
  154. int INEG = 116;
  155. int INSTANCEOF = 193;
  156. int INVOKEINTERFACE = 185;
  157. int INVOKESPECIAL = 183;
  158. int INVOKESTATIC = 184;
  159. int INVOKEVIRTUAL = 182;
  160. int IOR = 128;
  161. int IREM = 112;
  162. int IRETURN = 172;
  163. int ISHL = 120;
  164. int ISHR = 122;
  165. int ISTORE = 54;
  166. int ISTORE_0 = 59;
  167. int ISTORE_1 = 60;
  168. int ISTORE_2 = 61;
  169. int ISTORE_3 = 62;
  170. int ISUB = 100;
  171. int IUSHR = 124;
  172. int IXOR = 130;
  173. int JSR = 168;
  174. int JSR_W = 201;
  175. int L2D = 138;
  176. int L2F = 137;
  177. int L2I = 136;
  178. int LADD = 97;
  179. int LALOAD = 47;
  180. int LAND = 127;
  181. int LASTORE = 80;
  182. int LCMP = 148;
  183. int LCONST_0 = 9;
  184. int LCONST_1 = 10;
  185. int LDC = 18;
  186. int LDC2_W = 20;
  187. int LDC_W = 19;
  188. int LDIV = 109;
  189. int LLOAD = 22;
  190. int LLOAD_0 = 30;
  191. int LLOAD_1 = 31;
  192. int LLOAD_2 = 32;
  193. int LLOAD_3 = 33;
  194. int LMUL = 105;
  195. int LNEG = 117;
  196. int LOOKUPSWITCH = 171;
  197. int LOR = 129;
  198. int LREM = 113;
  199. int LRETURN = 173;
  200. int LSHL = 121;
  201. int LSHR = 123;
  202. int LSTORE = 55;
  203. int LSTORE_0 = 63;
  204. int LSTORE_1 = 64;
  205. int LSTORE_2 = 65;
  206. int LSTORE_3 = 66;
  207. int LSUB = 101;
  208. int LUSHR = 125;
  209. int LXOR = 131;
  210. int MONITORENTER = 194;
  211. int MONITOREXIT = 195;
  212. int MULTIANEWARRAY = 197;
  213. int NEW = 187;
  214. int NEWARRAY = 188;
  215. int NOP = 0;
  216. int POP = 87;
  217. int POP2 = 88;
  218. int PUTFIELD = 181;
  219. int PUTSTATIC = 179;
  220. int RET = 169;
  221. int RETURN = 177;
  222. int SALOAD = 53;
  223. int SASTORE = 86;
  224. int SIPUSH = 17;
  225. int SWAP = 95;
  226. int TABLESWITCH = 170;
  227. int WIDE = 196;
  228. /* array-type code for the newarray instruction */
  229. int T_BOOLEAN = 4;
  230. int T_CHAR = 5;
  231. int T_FLOAT = 6;
  232. int T_DOUBLE = 7;
  233. int T_BYTE = 8;
  234. int T_SHORT = 9;
  235. int T_INT = 10;
  236. int T_LONG = 11;
  237. /* how many values are pushed on the operand stack. */
  238. int[] STACK_GROW = {
  239. 0, // nop, 0
  240. 1, // aconst_null, 1
  241. 1, // iconst_m1, 2
  242. 1, // iconst_0, 3
  243. 1, // iconst_1, 4
  244. 1, // iconst_2, 5
  245. 1, // iconst_3, 6
  246. 1, // iconst_4, 7
  247. 1, // iconst_5, 8
  248. 2, // lconst_0, 9
  249. 2, // lconst_1, 10
  250. 1, // fconst_0, 11
  251. 1, // fconst_1, 12
  252. 1, // fconst_2, 13
  253. 2, // dconst_0, 14
  254. 2, // dconst_1, 15
  255. 1, // bipush, 16
  256. 1, // sipush, 17
  257. 1, // ldc, 18
  258. 1, // ldc_w, 19
  259. 2, // ldc2_w, 20
  260. 1, // iload, 21
  261. 2, // lload, 22
  262. 1, // fload, 23
  263. 2, // dload, 24
  264. 1, // aload, 25
  265. 1, // iload_0, 26
  266. 1, // iload_1, 27
  267. 1, // iload_2, 28
  268. 1, // iload_3, 29
  269. 2, // lload_0, 30
  270. 2, // lload_1, 31
  271. 2, // lload_2, 32
  272. 2, // lload_3, 33
  273. 1, // fload_0, 34
  274. 1, // fload_1, 35
  275. 1, // fload_2, 36
  276. 1, // fload_3, 37
  277. 2, // dload_0, 38
  278. 2, // dload_1, 39
  279. 2, // dload_2, 40
  280. 2, // dload_3, 41
  281. 1, // aload_0, 42
  282. 1, // aload_1, 43
  283. 1, // aload_2, 44
  284. 1, // aload_3, 45
  285. -1, // iaload, 46
  286. 0, // laload, 47
  287. -1, // faload, 48
  288. 0, // daload, 49
  289. -1, // aaload, 50
  290. -1, // baload, 51
  291. -1, // caload, 52
  292. -1, // saload, 53
  293. -1, // istore, 54
  294. -2, // lstore, 55
  295. -1, // fstore, 56
  296. -2, // dstore, 57
  297. -1, // astore, 58
  298. -1, // istore_0, 59
  299. -1, // istore_1, 60
  300. -1, // istore_2, 61
  301. -1, // istore_3, 62
  302. -2, // lstore_0, 63
  303. -2, // lstore_1, 64
  304. -2, // lstore_2, 65
  305. -2, // lstore_3, 66
  306. -1, // fstore_0, 67
  307. -1, // fstore_1, 68
  308. -1, // fstore_2, 69
  309. -1, // fstore_3, 70
  310. -2, // dstore_0, 71
  311. -2, // dstore_1, 72
  312. -2, // dstore_2, 73
  313. -2, // dstore_3, 74
  314. -1, // astore_0, 75
  315. -1, // astore_1, 76
  316. -1, // astore_2, 77
  317. -1, // astore_3, 78
  318. -3, // iastore, 79
  319. -4, // lastore, 80
  320. -3, // fastore, 81
  321. -4, // dastore, 82
  322. -3, // aastore, 83
  323. -3, // bastore, 84
  324. -3, // castore, 85
  325. -3, // sastore, 86
  326. -1, // pop, 87
  327. -2, // pop2, 88
  328. 1, // dup, 89
  329. 1, // dup_x1, 90
  330. 1, // dup_x2, 91
  331. 2, // dup2, 92
  332. 2, // dup2_x1, 93
  333. 2, // dup2_x2, 94
  334. 0, // swap, 95
  335. -1, // iadd, 96
  336. -2, // ladd, 97
  337. -1, // fadd, 98
  338. -2, // dadd, 99
  339. -1, // isub, 100
  340. -2, // lsub, 101
  341. -1, // fsub, 102
  342. -2, // dsub, 103
  343. -1, // imul, 104
  344. -2, // lmul, 105
  345. -1, // fmul, 106
  346. -2, // dmul, 107
  347. -1, // idiv, 108
  348. -2, // ldiv, 109
  349. -1, // fdiv, 110
  350. -2, // ddiv, 111
  351. -1, // irem, 112
  352. -2, // lrem, 113
  353. -1, // frem, 114
  354. -2, // drem, 115
  355. 0, // ineg, 116
  356. 0, // lneg, 117
  357. 0, // fneg, 118
  358. 0, // dneg, 119
  359. -1, // ishl, 120
  360. -1, // lshl, 121
  361. -1, // ishr, 122
  362. -1, // lshr, 123
  363. -1, // iushr, 124
  364. -1, // lushr, 125
  365. -1, // iand, 126
  366. -2, // land, 127
  367. -1, // ior, 128
  368. -2, // lor, 129
  369. -1, // ixor, 130
  370. -2, // lxor, 131
  371. 0, // iinc, 132
  372. 1, // i2l, 133
  373. 0, // i2f, 134
  374. 1, // i2d, 135
  375. -1, // l2i, 136
  376. -1, // l2f, 137
  377. 0, // l2d, 138
  378. 0, // f2i, 139
  379. 1, // f2l, 140
  380. 1, // f2d, 141
  381. -1, // d2i, 142
  382. 0, // d2l, 143
  383. -1, // d2f, 144
  384. 0, // i2b, 145
  385. 0, // i2c, 146
  386. 0, // i2s, 147
  387. -3, // lcmp, 148
  388. -1, // fcmpl, 149
  389. -1, // fcmpg, 150
  390. -3, // dcmpl, 151
  391. -3, // dcmpg, 152
  392. -1, // ifeq, 153
  393. -1, // ifne, 154
  394. -1, // iflt, 155
  395. -1, // ifge, 156
  396. -1, // ifgt, 157
  397. -1, // ifle, 158
  398. -2, // if_icmpeq, 159
  399. -2, // if_icmpne, 160
  400. -2, // if_icmplt, 161
  401. -2, // if_icmpge, 162
  402. -2, // if_icmpgt, 163
  403. -2, // if_icmple, 164
  404. -2, // if_acmpeq, 165
  405. -2, // if_acmpne, 166
  406. 0, // goto, 167
  407. 1, // jsr, 168
  408. 0, // ret, 169
  409. -1, // tableswitch, 170
  410. -1, // lookupswitch, 171
  411. -1, // ireturn, 172
  412. -2, // lreturn, 173
  413. -1, // freturn, 174
  414. -2, // dreturn, 175
  415. -1, // areturn, 176
  416. 0, // return, 177
  417. 0, // getstatic, 178 depends on the type
  418. 0, // putstatic, 179 depends on the type
  419. 0, // getfield, 180 depends on the type
  420. 0, // putfield, 181 depends on the type
  421. 0, // invokevirtual, 182 depends on the type
  422. 0, // invokespecial, 183 depends on the type
  423. 0, // invokestatic, 184 depends on the type
  424. 0, // invokeinterface, 185 depends on the type
  425. 0, // undefined, 186
  426. 1, // new, 187
  427. 0, // newarray, 188
  428. 0, // anewarray, 189
  429. 0, // arraylength, 190
  430. -1, // athrow, 191 stack is cleared
  431. 0, // checkcast, 192
  432. 0, // instanceof, 193
  433. -1, // monitorenter, 194
  434. -1, // monitorexit, 195
  435. 0, // wide, 196 depends on the following opcode
  436. 0, // multianewarray, 197 depends on the dimensions
  437. -1, // ifnull, 198
  438. -1, // ifnonnull, 199
  439. 0, // goto_w, 200
  440. 1 // jsr_w, 201
  441. };
  442. }