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.

Constants.java 28KB

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