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.

пре 4 година
пре 15 година
пре 15 година
пре 4 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 4 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 6 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 15 година
пре 12 година
пре 15 година
пре 15 година
пре 4 година
пре 4 година
пре 15 година
пре 4 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. package org.aspectj.apache.bcel;
  2. import org.aspectj.apache.bcel.generic.Type;
  3. /* ====================================================================
  4. * The Apache Software License, Version 1.1
  5. *
  6. * Copyright (c) 2001 The Apache Software Foundation. All rights
  7. * reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. *
  16. * 2. Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in
  18. * the documentation and/or other materials provided with the
  19. * distribution.
  20. *
  21. * 3. The end-user documentation included with the redistribution,
  22. * if any, must include the following acknowledgment:
  23. * "This product includes software developed by the
  24. * Apache Software Foundation (http://www.apache.org/)."
  25. * Alternately, this acknowledgment may appear in the software itself,
  26. * if and wherever such third-party acknowledgments normally appear.
  27. *
  28. * 4. The names "Apache" and "Apache Software Foundation" and
  29. * "Apache BCEL" must not be used to endorse or promote products
  30. * derived from this software without prior written permission. For
  31. * written permission, please contact apache@apache.org.
  32. *
  33. * 5. Products derived from this software may not be called "Apache",
  34. * "Apache BCEL", nor may "Apache" appear in their name, without
  35. * prior written permission of the Apache Software Foundation.
  36. *
  37. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  38. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  39. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  40. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  41. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  42. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  43. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  44. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  45. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  46. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  47. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  48. * SUCH DAMAGE.
  49. * ====================================================================
  50. *
  51. * This software consists of voluntary contributions made by many
  52. * individuals on behalf of the Apache Software Foundation. For more
  53. * information on the Apache Software Foundation, please see
  54. * <http://www.apache.org/>.
  55. */
  56. /**
  57. * Constants for the project, mostly defined in the JVM specification.
  58. *
  59. * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  60. * @author Andy Clement
  61. */
  62. public interface Constants {
  63. // Major and minor version of the code
  64. short MAJOR_1_1 = 45;
  65. short MINOR_1_1 = 3;
  66. short MAJOR_1_2 = 46;
  67. short MINOR_1_2 = 0;
  68. short MAJOR_1_3 = 47;
  69. short MINOR_1_3 = 0;
  70. short MAJOR_1_4 = 48;
  71. short MINOR_1_4 = 0;
  72. short MAJOR_1_5 = 49;
  73. short MINOR_1_5 = 0;
  74. short MAJOR_1_6 = 50;
  75. short MINOR_1_6 = 0;
  76. short MAJOR_1_7 = 51;
  77. short MINOR_1_7 = 0;
  78. short MAJOR_1_8 = 52;
  79. short MINOR_1_8 = 0;
  80. short MAJOR_1_9 = 53;
  81. short MINOR_1_9 = 0;
  82. short MAJOR_10 = 54;
  83. short MINOR_10 = 0;
  84. short MAJOR_11 = 55;
  85. short MINOR_11 = 0;
  86. short MAJOR_12 = 56;
  87. short MINOR_12 = 0;
  88. short MAJOR_13 = 57;
  89. short MINOR_13 = 0;
  90. short MAJOR_14 = 58;
  91. short MINOR_14 = 0;
  92. short MAJOR_15 = 59;
  93. short MINOR_15 = 0;
  94. short MAJOR_16 = 60;
  95. short MINOR_16 = 0;
  96. short MAJOR_17 = 61;
  97. short MINOR_17 = 0;
  98. short MAJOR_18 = 62;
  99. short MINOR_18 = 0;
  100. short MAJOR_19 = 63;
  101. short MINOR_19 = 0;
  102. // short MAJOR_20 = 64;
  103. // short MINOR_20 = 0;
  104. int PREVIEW_MINOR_VERSION = 65535;
  105. // Defaults
  106. short MAJOR = MAJOR_1_1;
  107. short MINOR = MINOR_1_1;
  108. /** Maximum value for an unsigned short */
  109. int MAX_SHORT = 65535; // 2^16 - 1
  110. /** Maximum value for an unsigned byte */
  111. int MAX_BYTE = 255; // 2^8 - 1
  112. /** Access flags for classes, fields and methods */
  113. short ACC_PUBLIC = 0x0001;
  114. short ACC_PRIVATE = 0x0002;
  115. short ACC_PROTECTED = 0x0004;
  116. short ACC_STATIC = 0x0008;
  117. short ACC_FINAL = 0x0010;
  118. short ACC_SYNCHRONIZED = 0x0020;
  119. short ACC_VOLATILE = 0x0040;
  120. short ACC_TRANSIENT = 0x0080;
  121. short ACC_NATIVE = 0x0100;
  122. short ACC_INTERFACE = 0x0200;
  123. short ACC_ABSTRACT = 0x0400;
  124. short ACC_STRICT = 0x0800;
  125. short ACC_SYNTHETIC = 0x1000;
  126. short ACC_ANNOTATION = 0x2000;
  127. short ACC_ENUM = 0x4000;
  128. int ACC_MODULE = 0x8000;
  129. short ACC_BRIDGE = 0x0040;
  130. short ACC_VARARGS = 0x0080;
  131. // Module related
  132. // Indicates that any module which depends on the current module,
  133. // implicitly declares a dependence on the module indicated by this entry.
  134. int MODULE_ACC_TRANSITIVE = 0x0020;
  135. // Indicates that this dependence is mandatory in the static phase, i.e., at
  136. // compile time, but is optional in the dynamic phase, i.e., at run time.
  137. int MODULE_ACC_STATIC_PHASE = 0x0040;
  138. // Indicates that this dependence was not explicitly or implicitly declared
  139. // in the source of the module declaration.
  140. int MODULE_ACC_SYNTHETIC = 0x1000;
  141. // Indicates that this dependence was implicitly declared in the source of
  142. // the module declaration
  143. int MODULE_ACC_MANDATED = 0x8000;
  144. // Applies to classes compiled by new compilers only
  145. short ACC_SUPER = 0x0020;
  146. short MAX_ACC_FLAG = ACC_STRICT;
  147. String[] ACCESS_NAMES = { "public", "private", "protected", "static", "final", "synchronized", "volatile",
  148. "transient", "native", "interface", "abstract", "strictfp" };
  149. /** Tags in constant pool to denote type of constant */
  150. byte CONSTANT_Utf8 = 1;
  151. byte CONSTANT_Integer = 3;
  152. byte CONSTANT_Float = 4;
  153. byte CONSTANT_Long = 5;
  154. byte CONSTANT_Double = 6;
  155. byte CONSTANT_Class = 7;
  156. byte CONSTANT_Fieldref = 9;
  157. byte CONSTANT_String = 8;
  158. byte CONSTANT_Methodref = 10;
  159. byte CONSTANT_InterfaceMethodref = 11;
  160. byte CONSTANT_NameAndType = 12;
  161. byte CONSTANT_MethodHandle = 15;
  162. byte CONSTANT_MethodType = 16;
  163. byte CONSTANT_Dynamic = 17;
  164. byte CONSTANT_InvokeDynamic = 18;
  165. byte CONSTANT_Module = 19;
  166. byte CONSTANT_Package = 20;
  167. String[] CONSTANT_NAMES = { "", "CONSTANT_Utf8", "", "CONSTANT_Integer", "CONSTANT_Float", "CONSTANT_Long",
  168. "CONSTANT_Double", "CONSTANT_Class", "CONSTANT_String", "CONSTANT_Fieldref", "CONSTANT_Methodref",
  169. "CONSTANT_InterfaceMethodref", "CONSTANT_NameAndType","","","CONSTANT_MethodHandle","CONSTANT_MethodType","CONSTANT_Dynamic","CONSTANT_InvokeDynamic",
  170. // J9:
  171. "CONSTANT_Module", "CONSTANT_Package"};
  172. /**
  173. * The name of the static initializer, also called &quot;class initialization method&quot; or &quot;interface initialization
  174. * method&quot;. This is &quot;&lt;clinit&gt;&quot;.
  175. */
  176. String STATIC_INITIALIZER_NAME = "<clinit>";
  177. /**
  178. * The name of every constructor method in a class, also called &quot;instance initialization method&quot;. This is
  179. * &quot;&lt;init&gt;&quot;.
  180. */
  181. String CONSTRUCTOR_NAME = "<init>";
  182. /** The names of the interfaces implemented by arrays */
  183. String[] INTERFACES_IMPLEMENTED_BY_ARRAYS = { "java.lang.Cloneable", "java.io.Serializable" };
  184. /**
  185. * Limitations of the Java Virtual Machine. See The Java Virtual Machine Specification, Second Edition, page 152, chapter 4.10.
  186. */
  187. int MAX_CP_ENTRIES = 65535;
  188. int MAX_CODE_SIZE = 65536; // bytes
  189. /**
  190. * Java VM opcodes.
  191. */
  192. short NOP = 0;
  193. short ACONST_NULL = 1;
  194. short ICONST_M1 = 2;
  195. short ICONST_0 = 3;
  196. short ICONST_1 = 4;
  197. short ICONST_2 = 5;
  198. short ICONST_3 = 6;
  199. short ICONST_4 = 7;
  200. short ICONST_5 = 8;
  201. short LCONST_0 = 9;
  202. short LCONST_1 = 10;
  203. short FCONST_0 = 11;
  204. short FCONST_1 = 12;
  205. short FCONST_2 = 13;
  206. short DCONST_0 = 14;
  207. short DCONST_1 = 15;
  208. short BIPUSH = 16;
  209. short SIPUSH = 17;
  210. short LDC = 18;
  211. short LDC_W = 19;
  212. short LDC2_W = 20;
  213. short ILOAD = 21;
  214. short LLOAD = 22;
  215. short FLOAD = 23;
  216. short DLOAD = 24;
  217. short ALOAD = 25;
  218. short ILOAD_0 = 26;
  219. short ILOAD_1 = 27;
  220. short ILOAD_2 = 28;
  221. short ILOAD_3 = 29;
  222. short LLOAD_0 = 30;
  223. short LLOAD_1 = 31;
  224. short LLOAD_2 = 32;
  225. short LLOAD_3 = 33;
  226. short FLOAD_0 = 34;
  227. short FLOAD_1 = 35;
  228. short FLOAD_2 = 36;
  229. short FLOAD_3 = 37;
  230. short DLOAD_0 = 38;
  231. short DLOAD_1 = 39;
  232. short DLOAD_2 = 40;
  233. short DLOAD_3 = 41;
  234. short ALOAD_0 = 42;
  235. short ALOAD_1 = 43;
  236. short ALOAD_2 = 44;
  237. short ALOAD_3 = 45;
  238. short IALOAD = 46;
  239. short LALOAD = 47;
  240. short FALOAD = 48;
  241. short DALOAD = 49;
  242. short AALOAD = 50;
  243. short BALOAD = 51;
  244. short CALOAD = 52;
  245. short SALOAD = 53;
  246. short ISTORE = 54;
  247. short LSTORE = 55;
  248. short FSTORE = 56;
  249. short DSTORE = 57;
  250. short ASTORE = 58;
  251. short ISTORE_0 = 59;
  252. short ISTORE_1 = 60;
  253. short ISTORE_2 = 61;
  254. short ISTORE_3 = 62;
  255. short LSTORE_0 = 63;
  256. short LSTORE_1 = 64;
  257. short LSTORE_2 = 65;
  258. short LSTORE_3 = 66;
  259. short FSTORE_0 = 67;
  260. short FSTORE_1 = 68;
  261. short FSTORE_2 = 69;
  262. short FSTORE_3 = 70;
  263. short DSTORE_0 = 71;
  264. short DSTORE_1 = 72;
  265. short DSTORE_2 = 73;
  266. short DSTORE_3 = 74;
  267. short ASTORE_0 = 75;
  268. short ASTORE_1 = 76;
  269. short ASTORE_2 = 77;
  270. short ASTORE_3 = 78;
  271. short IASTORE = 79;
  272. short LASTORE = 80;
  273. short FASTORE = 81;
  274. short DASTORE = 82;
  275. short AASTORE = 83;
  276. short BASTORE = 84;
  277. short CASTORE = 85;
  278. short SASTORE = 86;
  279. short POP = 87;
  280. short POP2 = 88;
  281. short DUP = 89;
  282. short DUP_X1 = 90;
  283. short DUP_X2 = 91;
  284. short DUP2 = 92;
  285. short DUP2_X1 = 93;
  286. short DUP2_X2 = 94;
  287. short SWAP = 95;
  288. short IADD = 96;
  289. short LADD = 97;
  290. short FADD = 98;
  291. short DADD = 99;
  292. short ISUB = 100;
  293. short LSUB = 101;
  294. short FSUB = 102;
  295. short DSUB = 103;
  296. short IMUL = 104;
  297. short LMUL = 105;
  298. short FMUL = 106;
  299. short DMUL = 107;
  300. short IDIV = 108;
  301. short LDIV = 109;
  302. short FDIV = 110;
  303. short DDIV = 111;
  304. short IREM = 112;
  305. short LREM = 113;
  306. short FREM = 114;
  307. short DREM = 115;
  308. short INEG = 116;
  309. short LNEG = 117;
  310. short FNEG = 118;
  311. short DNEG = 119;
  312. short ISHL = 120;
  313. short LSHL = 121;
  314. short ISHR = 122;
  315. short LSHR = 123;
  316. short IUSHR = 124;
  317. short LUSHR = 125;
  318. short IAND = 126;
  319. short LAND = 127;
  320. short IOR = 128;
  321. short LOR = 129;
  322. short IXOR = 130;
  323. short LXOR = 131;
  324. short IINC = 132;
  325. short I2L = 133;
  326. short I2F = 134;
  327. short I2D = 135;
  328. short L2I = 136;
  329. short L2F = 137;
  330. short L2D = 138;
  331. short F2I = 139;
  332. short F2L = 140;
  333. short F2D = 141;
  334. short D2I = 142;
  335. short D2L = 143;
  336. short D2F = 144;
  337. short I2B = 145;
  338. short INT2BYTE = 145; // Old notion
  339. short I2C = 146;
  340. short INT2CHAR = 146; // Old notion
  341. short I2S = 147;
  342. short INT2SHORT = 147; // Old notion
  343. short LCMP = 148;
  344. short FCMPL = 149;
  345. short FCMPG = 150;
  346. short DCMPL = 151;
  347. short DCMPG = 152;
  348. short IFEQ = 153;
  349. short IFNE = 154;
  350. short IFLT = 155;
  351. short IFGE = 156;
  352. short IFGT = 157;
  353. short IFLE = 158;
  354. short IF_ICMPEQ = 159;
  355. short IF_ICMPNE = 160;
  356. short IF_ICMPLT = 161;
  357. short IF_ICMPGE = 162;
  358. short IF_ICMPGT = 163;
  359. short IF_ICMPLE = 164;
  360. short IF_ACMPEQ = 165;
  361. short IF_ACMPNE = 166;
  362. short GOTO = 167;
  363. short JSR = 168;
  364. short RET = 169;
  365. short TABLESWITCH = 170;
  366. short LOOKUPSWITCH = 171;
  367. short IRETURN = 172;
  368. short LRETURN = 173;
  369. short FRETURN = 174;
  370. short DRETURN = 175;
  371. short ARETURN = 176;
  372. short RETURN = 177;
  373. short GETSTATIC = 178;
  374. short PUTSTATIC = 179;
  375. short GETFIELD = 180;
  376. short PUTFIELD = 181;
  377. short INVOKEVIRTUAL = 182;
  378. short INVOKESPECIAL = 183;
  379. short INVOKENONVIRTUAL = 183; // Old name in JDK 1.0
  380. short INVOKESTATIC = 184;
  381. short INVOKEINTERFACE = 185;
  382. short INVOKEDYNAMIC = 186;
  383. short NEW = 187;
  384. short NEWARRAY = 188;
  385. short ANEWARRAY = 189;
  386. short ARRAYLENGTH = 190;
  387. short ATHROW = 191;
  388. short CHECKCAST = 192;
  389. short INSTANCEOF = 193;
  390. short MONITORENTER = 194;
  391. short MONITOREXIT = 195;
  392. short WIDE = 196;
  393. short MULTIANEWARRAY = 197;
  394. short IFNULL = 198;
  395. short IFNONNULL = 199;
  396. short GOTO_W = 200;
  397. short JSR_W = 201;
  398. /**
  399. * Non-legal opcodes, may be used by JVM internally.
  400. */
  401. short BREAKPOINT = 202;
  402. short LDC_QUICK = 203;
  403. short LDC_W_QUICK = 204;
  404. short LDC2_W_QUICK = 205;
  405. short GETFIELD_QUICK = 206;
  406. short PUTFIELD_QUICK = 207;
  407. short GETFIELD2_QUICK = 208;
  408. short PUTFIELD2_QUICK = 209;
  409. short GETSTATIC_QUICK = 210;
  410. short PUTSTATIC_QUICK = 211;
  411. short GETSTATIC2_QUICK = 212;
  412. short PUTSTATIC2_QUICK = 213;
  413. short INVOKEVIRTUAL_QUICK = 214;
  414. short INVOKENONVIRTUAL_QUICK = 215;
  415. short INVOKESUPER_QUICK = 216;
  416. short INVOKESTATIC_QUICK = 217;
  417. short INVOKEINTERFACE_QUICK = 218;
  418. short INVOKEVIRTUALOBJECT_QUICK = 219;
  419. short NEW_QUICK = 221;
  420. short ANEWARRAY_QUICK = 222;
  421. short MULTIANEWARRAY_QUICK = 223;
  422. short CHECKCAST_QUICK = 224;
  423. short INSTANCEOF_QUICK = 225;
  424. short INVOKEVIRTUAL_QUICK_W = 226;
  425. short GETFIELD_QUICK_W = 227;
  426. short PUTFIELD_QUICK_W = 228;
  427. short IMPDEP1 = 254;
  428. short IMPDEP2 = 255;
  429. /**
  430. * For internal purposes only.
  431. */
  432. short PUSH = 4711;
  433. short SWITCH = 4712;
  434. /**
  435. * Illegal codes
  436. */
  437. short UNDEFINED = '/' - '0'; // -1;
  438. short UNPREDICTABLE = '.' - '0';// -2;
  439. short RESERVED = -3;
  440. String ILLEGAL_OPCODE = "<illegal opcode>";
  441. String ILLEGAL_TYPE = "<illegal type>";
  442. byte T_BOOLEAN = 4;
  443. byte T_CHAR = 5;
  444. byte T_FLOAT = 6;
  445. byte T_DOUBLE = 7;
  446. byte T_BYTE = 8;
  447. byte T_SHORT = 9;
  448. byte T_INT = 10;
  449. byte T_LONG = 11;
  450. byte T_VOID = 12; // Non-standard
  451. byte T_ARRAY = 13;
  452. byte T_OBJECT = 14;
  453. byte T_REFERENCE = 14; // Deprecated
  454. byte T_UNKNOWN = 15;
  455. byte T_ADDRESS = 16;
  456. /**
  457. * The primitive type names corresponding to the T_XX constants, e.g., TYPE_NAMES[T_INT] = "int"
  458. */
  459. String[] TYPE_NAMES = { ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, "boolean", "char", "float",
  460. "double", "byte", "short", "int", "long", "void", "array", "object", "unknown" // Non-standard
  461. };
  462. /**
  463. * The primitive class names corresponding to the T_XX constants, e.g., CLASS_TYPE_NAMES[T_INT] = "java.lang.Integer"
  464. */
  465. String[] CLASS_TYPE_NAMES = { ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, "java.lang.Boolean",
  466. "java.lang.Character", "java.lang.Float", "java.lang.Double", "java.lang.Byte", "java.lang.Short", "java.lang.Integer",
  467. "java.lang.Long", "java.lang.Void", ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE };
  468. /**
  469. * The signature characters corresponding to primitive types, e.g., SHORT_TYPE_NAMES[T_INT] = "I"
  470. */
  471. String[] SHORT_TYPE_NAMES = { ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, "Z", "C", "F", "D",
  472. "B", "S", "I", "J", "V", ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE };
  473. int PUSH_INST = 0x0001;
  474. int CONSTANT_INST = 0x0002;
  475. long LOADCLASS_INST = 0x0004;
  476. int CP_INST = 0x0008;
  477. int INDEXED = 0x0010;
  478. int LOAD_INST = 0x0020; // load instruction
  479. int LV_INST = 0x0040; // local variable instruction
  480. int POP_INST = 0x0080;
  481. int STORE_INST = 0x0100;
  482. long STACK_INST = 0x0200;
  483. long BRANCH_INSTRUCTION = 0x0400;
  484. long TARGETER_INSTRUCTION = 0x0800;
  485. long NEGATABLE = 0x1000;
  486. long IF_INST = 0x2000;
  487. long JSR_INSTRUCTION = 0x4000;
  488. long RET_INST = 0x8000;
  489. long EXCEPTION_THROWER = 0x10000;
  490. byte[] iLen = new byte[256];
  491. byte UNDEFINED_LENGTH = 'X' - '0';
  492. byte VARIABLE_LENGTH = 'V' - '0';
  493. byte[] stackEntriesProduced = new byte[256];
  494. Type[] types = new Type[256];
  495. long[] instFlags = new long[256];
  496. Class<Throwable>[][] instExcs = new Class[256][];
  497. Object _unused = ConstantsInitializer.initialize();
  498. /**
  499. * How the byte code operands are to be interpreted.
  500. */
  501. short[][] TYPE_OF_OPERANDS = { {}/* nop */, {}/* aconst_null */, {}/* iconst_m1 */, {}/* iconst_0 */,
  502. {}/* iconst_1 */, {}/* iconst_2 */, {}/* iconst_3 */, {}/* iconst_4 */, {}/* iconst_5 */, {}/* lconst_0 */, {}/* lconst_1 */,
  503. {}/* fconst_0 */, {}/* fconst_1 */, {}/* fconst_2 */, {}/* dconst_0 */, {}/* dconst_1 */, { T_BYTE }/* bipush */,
  504. { T_SHORT }/* sipush */, { T_BYTE }/* ldc */, { T_SHORT }/* ldc_w */, { T_SHORT }/* ldc2_w */, { T_BYTE }/* iload */,
  505. { T_BYTE }/* lload */, { T_BYTE }/* fload */, { T_BYTE }/* dload */, { T_BYTE }/* aload */, {}/* iload_0 */,
  506. {}/* iload_1 */, {}/* iload_2 */, {}/* iload_3 */, {}/* lload_0 */, {}/* lload_1 */, {}/* lload_2 */, {}/* lload_3 */,
  507. {}/* fload_0 */, {}/* fload_1 */, {}/* fload_2 */, {}/* fload_3 */, {}/* dload_0 */, {}/* dload_1 */, {}/* dload_2 */,
  508. {}/* dload_3 */, {}/* aload_0 */, {}/* aload_1 */, {}/* aload_2 */, {}/* aload_3 */, {}/* iaload */, {}/* laload */,
  509. {}/* faload */, {}/* daload */, {}/* aaload */, {}/* baload */, {}/* caload */, {}/* saload */, { T_BYTE }/* istore */,
  510. { T_BYTE }/* lstore */, { T_BYTE }/* fstore */, { T_BYTE }/* dstore */, { T_BYTE }/* astore */, {}/* istore_0 */,
  511. {}/* istore_1 */, {}/* istore_2 */, {}/* istore_3 */, {}/* lstore_0 */, {}/* lstore_1 */, {}/* lstore_2 */, {}/* lstore_3 */,
  512. {}/* fstore_0 */, {}/* fstore_1 */, {}/* fstore_2 */, {}/* fstore_3 */, {}/* dstore_0 */, {}/* dstore_1 */, {}/* dstore_2 */,
  513. {}/* dstore_3 */, {}/* astore_0 */, {}/* astore_1 */, {}/* astore_2 */, {}/* astore_3 */, {}/* iastore */, {}/* lastore */,
  514. {}/* fastore */, {}/* dastore */, {}/* aastore */, {}/* bastore */, {}/* castore */, {}/* sastore */, {}/* pop */, {}/* pop2 */,
  515. {}/* dup */, {}/* dup_x1 */, {}/* dup_x2 */, {}/* dup2 */, {}/* dup2_x1 */, {}/* dup2_x2 */, {}/* swap */, {}/* iadd */,
  516. {}/* ladd */, {}/* fadd */, {}/* dadd */, {}/* isub */, {}/* lsub */, {}/* fsub */, {}/* dsub */, {}/* imul */, {}/* lmul */, {}/* fmul */,
  517. {}/* dmul */, {}/* idiv */, {}/* ldiv */, {}/* fdiv */, {}/* ddiv */, {}/* irem */, {}/* lrem */, {}/* frem */, {}/* drem */, {}/* ineg */,
  518. {}/* lneg */, {}/* fneg */, {}/* dneg */, {}/* ishl */, {}/* lshl */, {}/* ishr */, {}/* lshr */, {}/* iushr */, {}/* lushr */,
  519. {}/* iand */, {}/* land */, {}/* ior */, {}/* lor */, {}/* ixor */, {}/* lxor */, { T_BYTE, T_BYTE }/* iinc */, {}/* i2l */,
  520. {}/* i2f */, {}/* i2d */, {}/* l2i */, {}/* l2f */, {}/* l2d */, {}/* f2i */, {}/* f2l */, {}/* f2d */, {}/* d2i */, {}/* d2l */,
  521. {}/* d2f */, {}/* i2b */, {}/* i2c */, {}/* i2s */, {}/* lcmp */, {}/* fcmpl */, {}/* fcmpg */, {}/* dcmpl */,
  522. {}/* dcmpg */, { T_SHORT }/* ifeq */, { T_SHORT }/* ifne */, { T_SHORT }/* iflt */, { T_SHORT }/* ifge */,
  523. { T_SHORT }/* ifgt */, { T_SHORT }/* ifle */, { T_SHORT }/* if_icmpeq */, { T_SHORT }/* if_icmpne */,
  524. { T_SHORT }/* if_icmplt */, { T_SHORT }/* if_icmpge */, { T_SHORT }/* if_icmpgt */, { T_SHORT }/* if_icmple */,
  525. { T_SHORT }/* if_acmpeq */, { T_SHORT }/* if_acmpne */, { T_SHORT }/* goto */, { T_SHORT }/* jsr */,
  526. { T_BYTE }/* ret */, {}/* tableswitch */, {}/* lookupswitch */, {}/* ireturn */, {}/* lreturn */, {}/* freturn */,
  527. {}/* dreturn */, {}/* areturn */, {}/* return */, { T_SHORT }/* getstatic */, { T_SHORT }/* putstatic */,
  528. { T_SHORT }/* getfield */, { T_SHORT }/* putfield */, { T_SHORT }/* invokevirtual */,
  529. { T_SHORT }/* invokespecial */, { T_SHORT }/* invokestatic */, { T_SHORT, T_BYTE, T_BYTE }/* invokeinterface */, {},
  530. { T_SHORT }/* new */, { T_BYTE }/* newarray */, { T_SHORT }/* anewarray */, {}/* arraylength */, {}/* athrow */,
  531. { T_SHORT }/* checkcast */, { T_SHORT }/* instanceof */, {}/* monitorenter */, {}/* monitorexit */, { T_BYTE }/* wide */,
  532. { T_SHORT, T_BYTE }/* multianewarray */, { T_SHORT }/* ifnull */, { T_SHORT }/* ifnonnull */, { T_INT }/* goto_w */,
  533. { T_INT }/* jsr_w */, {}/* breakpoint */, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  534. {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
  535. {}, {}, {}/* impdep1 */, {} /* impdep2 */
  536. };
  537. /**
  538. * Names of opcodes.
  539. */
  540. String[] OPCODE_NAMES = { "nop", "aconst_null", "iconst_m1", "iconst_0", "iconst_1", "iconst_2",
  541. "iconst_3", "iconst_4", "iconst_5", "lconst_0", "lconst_1", "fconst_0", "fconst_1", "fconst_2", "dconst_0", "dconst_1",
  542. "bipush", "sipush", "ldc", "ldc_w", "ldc2_w", "iload", "lload", "fload", "dload", "aload", "iload_0", "iload_1",
  543. "iload_2", "iload_3", "lload_0", "lload_1", "lload_2", "lload_3", "fload_0", "fload_1", "fload_2", "fload_3",
  544. "dload_0", "dload_1", "dload_2", "dload_3", "aload_0", "aload_1", "aload_2", "aload_3", "iaload", "laload", "faload",
  545. "daload", "aaload", "baload", "caload", "saload", "istore", "lstore", "fstore", "dstore", "astore", "istore_0",
  546. "istore_1", "istore_2", "istore_3", "lstore_0", "lstore_1", "lstore_2", "lstore_3", "fstore_0", "fstore_1", "fstore_2",
  547. "fstore_3", "dstore_0", "dstore_1", "dstore_2", "dstore_3", "astore_0", "astore_1", "astore_2", "astore_3", "iastore",
  548. "lastore", "fastore", "dastore", "aastore", "bastore", "castore", "sastore", "pop", "pop2", "dup", "dup_x1", "dup_x2",
  549. "dup2", "dup2_x1", "dup2_x2", "swap", "iadd", "ladd", "fadd", "dadd", "isub", "lsub", "fsub", "dsub", "imul", "lmul",
  550. "fmul", "dmul", "idiv", "ldiv", "fdiv", "ddiv", "irem", "lrem", "frem", "drem", "ineg", "lneg", "fneg", "dneg", "ishl",
  551. "lshl", "ishr", "lshr", "iushr", "lushr", "iand", "land", "ior", "lor", "ixor", "lxor", "iinc", "i2l", "i2f", "i2d",
  552. "l2i", "l2f", "l2d", "f2i", "f2l", "f2d", "d2i", "d2l", "d2f", "i2b", "i2c", "i2s", "lcmp", "fcmpl", "fcmpg", "dcmpl",
  553. "dcmpg", "ifeq", "ifne", "iflt", "ifge", "ifgt", "ifle", "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpge",
  554. "if_icmpgt", "if_icmple", "if_acmpeq", "if_acmpne", "goto", "jsr", "ret", "tableswitch", "lookupswitch", "ireturn",
  555. "lreturn", "freturn", "dreturn", "areturn", "return", "getstatic", "putstatic", "getfield", "putfield",
  556. "invokevirtual", "invokespecial", "invokestatic", "invokeinterface", "invokedynamic", "new", "newarray", "anewarray",
  557. "arraylength", "athrow", "checkcast", "instanceof", "monitorenter", "monitorexit", "wide", "multianewarray", "ifnull",
  558. "ifnonnull", "goto_w", "jsr_w", "breakpoint", ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  559. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  560. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  561. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  562. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  563. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  564. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
  565. ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, "impdep1", "impdep2" };
  566. /**
  567. * Number of words consumed on operand stack by instructions.
  568. */
  569. int[] CONSUME_STACK = { 0/* nop */, 0/* aconst_null */, 0/* iconst_m1 */, 0/* iconst_0 */, 0/* iconst_1 */,
  570. 0/* iconst_2 */, 0/* iconst_3 */, 0/* iconst_4 */, 0/* iconst_5 */, 0/* lconst_0 */, 0/* lconst_1 */, 0/* fconst_0 */,
  571. 0/* fconst_1 */, 0/* fconst_2 */, 0/* dconst_0 */, 0/* dconst_1 */, 0/* bipush */, 0/* sipush */, 0/* ldc */,
  572. 0/* ldc_w */, 0/* ldc2_w */, 0/* iload */, 0/* lload */, 0/* fload */, 0/* dload */, 0/* aload */, 0/* iload_0 */, 0/* iload_1 */,
  573. 0/* iload_2 */, 0/* iload_3 */, 0/* lload_0 */, 0/* lload_1 */, 0/* lload_2 */, 0/* lload_3 */, 0/* fload_0 */,
  574. 0/* fload_1 */, 0/* fload_2 */, 0/* fload_3 */, 0/* dload_0 */, 0/* dload_1 */, 0/* dload_2 */, 0/* dload_3 */,
  575. 0/* aload_0 */, 0/* aload_1 */, 0/* aload_2 */, 0/* aload_3 */, 2/* iaload */, 2/* laload */, 2/* faload */,
  576. 2/* daload */, 2/* aaload */, 2/* baload */, 2/* caload */, 2/* saload */, 1/* istore */, 2/* lstore */,
  577. 1/* fstore */, 2/* dstore */, 1/* astore */, 1/* istore_0 */, 1/* istore_1 */, 1/* istore_2 */, 1/* istore_3 */,
  578. 2/* lstore_0 */, 2/* lstore_1 */, 2/* lstore_2 */, 2/* lstore_3 */, 1/* fstore_0 */, 1/* fstore_1 */, 1/* fstore_2 */,
  579. 1/* fstore_3 */, 2/* dstore_0 */, 2/* dstore_1 */, 2/* dstore_2 */, 2/* dstore_3 */, 1/* astore_0 */, 1/* astore_1 */,
  580. 1/* astore_2 */, 1/* astore_3 */, 3/* iastore */, 4/* lastore */, 3/* fastore */, 4/* dastore */, 3/* aastore */,
  581. 3/* bastore */, 3/* castore */, 3/* sastore */, 1/* pop */, 2/* pop2 */, 1/* dup */, 2/* dup_x1 */, 3/* dup_x2 */,
  582. 2/* dup2 */, 3/* dup2_x1 */, 4/* dup2_x2 */, 2/* swap */, 2/* iadd */, 4/* ladd */, 2/* fadd */, 4/* dadd */, 2/* isub */,
  583. 4/* lsub */, 2/* fsub */, 4/* dsub */, 2/* imul */, 4/* lmul */, 2/* fmul */, 4/* dmul */, 2/* idiv */, 4/* ldiv */, 2/* fdiv */,
  584. 4/* ddiv */, 2/* irem */, 4/* lrem */, 2/* frem */, 4/* drem */, 1/* ineg */, 2/* lneg */, 1/* fneg */, 2/* dneg */, 2/* ishl */,
  585. 3/* lshl */, 2/* ishr */, 3/* lshr */, 2/* iushr */, 3/* lushr */, 2/* iand */, 4/* land */, 2/* ior */, 4/* lor */, 2/* ixor */,
  586. 4/* lxor */, 0/* iinc */, 1/* i2l */, 1/* i2f */, 1/* i2d */, 2/* l2i */, 2/* l2f */, 2/* l2d */, 1/* f2i */, 1/* f2l */,
  587. 1/* f2d */, 2/* d2i */, 2/* d2l */, 2/* d2f */, 1/* i2b */, 1/* i2c */, 1/* i2s */, 4/* lcmp */, 2/* fcmpl */,
  588. 2/* fcmpg */, 4/* dcmpl */, 4/* dcmpg */, 1/* ifeq */, 1/* ifne */, 1/* iflt */, 1/* ifge */, 1/* ifgt */, 1/* ifle */,
  589. 2/* if_icmpeq */, 2/* if_icmpne */, 2/* if_icmplt */, 2 /* if_icmpge */, 2/* if_icmpgt */, 2/* if_icmple */, 2/* if_acmpeq */,
  590. 2/* if_acmpne */, 0/* goto */, 0/* jsr */, 0/* ret */, 1/* tableswitch */, 1/* lookupswitch */, 1/* ireturn */,
  591. 2/* lreturn */, 1/* freturn */, 2/* dreturn */, 1/* areturn */, 0/* return */, 0/* getstatic */,
  592. UNPREDICTABLE/* putstatic */, 1/* getfield */, UNPREDICTABLE/* putfield */, UNPREDICTABLE/* invokevirtual */,
  593. UNPREDICTABLE/* invokespecial */, UNPREDICTABLE/* invokestatic */, UNPREDICTABLE/* invokeinterface */, UNDEFINED,
  594. 0/* new */, 1/* newarray */, 1/* anewarray */, 1/* arraylength */, 1/* athrow */, 1/* checkcast */, 1/* instanceof */,
  595. 1/* monitorenter */, 1/* monitorexit */, 0/* wide */, UNPREDICTABLE/* multianewarray */, 1/* ifnull */,
  596. 1/* ifnonnull */, 0/* goto_w */, 0/* jsr_w */, 0/* breakpoint */, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
  597. UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
  598. UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
  599. UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
  600. UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
  601. UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNPREDICTABLE/* impdep1 */, UNPREDICTABLE /* impdep2 */
  602. };
  603. // Attributes and their corresponding names.
  604. byte ATTR_UNKNOWN = -1;
  605. byte ATTR_SOURCE_FILE = 0;
  606. byte ATTR_CONSTANT_VALUE = 1;
  607. byte ATTR_CODE = 2;
  608. byte ATTR_EXCEPTIONS = 3;
  609. byte ATTR_LINE_NUMBER_TABLE = 4;
  610. byte ATTR_LOCAL_VARIABLE_TABLE = 5;
  611. byte ATTR_INNER_CLASSES = 6;
  612. byte ATTR_SYNTHETIC = 7;
  613. byte ATTR_DEPRECATED = 8;
  614. byte ATTR_PMG = 9;
  615. byte ATTR_SIGNATURE = 10;
  616. byte ATTR_STACK_MAP = 11;
  617. byte ATTR_RUNTIME_VISIBLE_ANNOTATIONS = 12;
  618. byte ATTR_RUNTIME_INVISIBLE_ANNOTATIONS = 13;
  619. byte ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = 14;
  620. byte ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = 15;
  621. byte ATTR_LOCAL_VARIABLE_TYPE_TABLE = 16;
  622. byte ATTR_ENCLOSING_METHOD = 17;
  623. byte ATTR_ANNOTATION_DEFAULT = 18;
  624. byte ATTR_BOOTSTRAPMETHODS = 19;
  625. byte ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = 20;
  626. byte ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = 21;
  627. byte ATTR_METHOD_PARAMETERS = 22;
  628. // J9:
  629. byte ATTR_MODULE = 23;
  630. byte ATTR_MODULE_PACKAGES = 24;
  631. byte ATTR_MODULE_MAIN_CLASS = 25;
  632. // J11:
  633. byte ATTR_NEST_HOST = 26;
  634. byte ATTR_NEST_MEMBERS = 27;
  635. short KNOWN_ATTRIBUTES = 28;
  636. String[] ATTRIBUTE_NAMES = {
  637. "SourceFile", "ConstantValue", "Code", "Exceptions", "LineNumberTable", "LocalVariableTable",
  638. "InnerClasses", "Synthetic", "Deprecated", "PMGClass", "Signature", "StackMap",
  639. "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations", "RuntimeVisibleParameterAnnotations",
  640. "RuntimeInvisibleParameterAnnotations", "LocalVariableTypeTable", "EnclosingMethod",
  641. "AnnotationDefault","BootstrapMethods", "RuntimeVisibleTypeAnnotations", "RuntimeInvisibleTypeAnnotations",
  642. "MethodParameters", "Module", "ModulePackages", "ModuleMainClass", "NestHost", "NestMembers"
  643. };
  644. /**
  645. * Constants used in the StackMap attribute.
  646. */
  647. byte ITEM_Bogus = 0;
  648. byte ITEM_Integer = 1;
  649. byte ITEM_Float = 2;
  650. byte ITEM_Double = 3;
  651. byte ITEM_Long = 4;
  652. byte ITEM_Null = 5;
  653. byte ITEM_InitObject = 6;
  654. byte ITEM_Object = 7;
  655. byte ITEM_NewObject = 8;
  656. String[] ITEM_NAMES = { "Bogus", "Integer", "Float", "Double", "Long", "Null", "InitObject", "Object",
  657. "NewObject" };
  658. }