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

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