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.

ConstantsInitializer.java 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. /* ====================================================================
  2. * The Apache Software License, Version 1.1
  3. *
  4. * Copyright (c) 2001 The Apache Software Foundation. All rights
  5. * reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. *
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the
  17. * distribution.
  18. *
  19. * 3. The end-user documentation included with the redistribution,
  20. * if any, must include the following acknowledgment:
  21. * "This product includes software developed by the
  22. * Apache Software Foundation (http://www.apache.org/)."
  23. * Alternately, this acknowledgment may appear in the software itself,
  24. * if and wherever such third-party acknowledgments normally appear.
  25. *
  26. * 4. The names "Apache" and "Apache Software Foundation" and
  27. * "Apache BCEL" must not be used to endorse or promote products
  28. * derived from this software without prior written permission. For
  29. * written permission, please contact apache@apache.org.
  30. *
  31. * 5. Products derived from this software may not be called "Apache",
  32. * "Apache BCEL", nor may "Apache" appear in their name, without
  33. * prior written permission of the Apache Software Foundation.
  34. *
  35. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46. * SUCH DAMAGE.
  47. * ====================================================================
  48. *
  49. * This software consists of voluntary contributions made by many
  50. * individuals on behalf of the Apache Software Foundation. For more
  51. * information on the Apache Software Foundation, please see
  52. * <http://www.apache.org/>.
  53. */
  54. package org.aspectj.apache.bcel;
  55. import org.aspectj.apache.bcel.generic.Type;
  56. public class ConstantsInitializer {
  57. public static Object initialize() {
  58. Constants.types[Constants.ILOAD] = Type.INT;
  59. Constants.types[Constants.ISTORE] = Type.INT;
  60. Constants.types[Constants.ILOAD_0] = Type.INT;
  61. Constants.types[Constants.ISTORE_0] = Type.INT;
  62. Constants.types[Constants.ILOAD_1] = Type.INT;
  63. Constants.types[Constants.ISTORE_1] = Type.INT;
  64. Constants.types[Constants.ILOAD_2] = Type.INT;
  65. Constants.types[Constants.ISTORE_2] = Type.INT;
  66. Constants.types[Constants.ILOAD_3] = Type.INT;
  67. Constants.types[Constants.ISTORE_3] = Type.INT;
  68. Constants.types[Constants.LLOAD] = Type.LONG;
  69. Constants.types[Constants.LSTORE] = Type.LONG;
  70. Constants.types[Constants.LLOAD_0] = Type.LONG;
  71. Constants.types[Constants.LSTORE_0] = Type.LONG;
  72. Constants.types[Constants.LLOAD_1] = Type.LONG;
  73. Constants.types[Constants.LSTORE_1] = Type.LONG;
  74. Constants.types[Constants.LLOAD_2] = Type.LONG;
  75. Constants.types[Constants.LSTORE_2] = Type.LONG;
  76. Constants.types[Constants.LLOAD_3] = Type.LONG;
  77. Constants.types[Constants.LSTORE_3] = Type.LONG;
  78. Constants.types[Constants.DLOAD] = Type.DOUBLE;
  79. Constants.types[Constants.DSTORE] = Type.DOUBLE;
  80. Constants.types[Constants.DLOAD_0] = Type.DOUBLE;
  81. Constants.types[Constants.DSTORE_0] = Type.DOUBLE;
  82. Constants.types[Constants.DLOAD_1] = Type.DOUBLE;
  83. Constants.types[Constants.DSTORE_1] = Type.DOUBLE;
  84. Constants.types[Constants.DLOAD_2] = Type.DOUBLE;
  85. Constants.types[Constants.DSTORE_2] = Type.DOUBLE;
  86. Constants.types[Constants.DLOAD_3] = Type.DOUBLE;
  87. Constants.types[Constants.DSTORE_3] = Type.DOUBLE;
  88. Constants.types[Constants.FLOAD] = Type.FLOAT;
  89. Constants.types[Constants.FSTORE] = Type.FLOAT;
  90. Constants.types[Constants.FLOAD_0] = Type.FLOAT;
  91. Constants.types[Constants.FSTORE_0] = Type.FLOAT;
  92. Constants.types[Constants.FLOAD_1] = Type.FLOAT;
  93. Constants.types[Constants.FSTORE_1] = Type.FLOAT;
  94. Constants.types[Constants.FLOAD_2] = Type.FLOAT;
  95. Constants.types[Constants.FSTORE_2] = Type.FLOAT;
  96. Constants.types[Constants.FLOAD_3] = Type.FLOAT;
  97. Constants.types[Constants.FSTORE_3] = Type.FLOAT;
  98. Constants.types[Constants.ALOAD] = Type.OBJECT;
  99. Constants.types[Constants.ASTORE] = Type.OBJECT;
  100. Constants.types[Constants.ALOAD_0] = Type.OBJECT;
  101. Constants.types[Constants.ASTORE_0] = Type.OBJECT;
  102. Constants.types[Constants.ALOAD_1] = Type.OBJECT;
  103. Constants.types[Constants.ASTORE_1] = Type.OBJECT;
  104. Constants.types[Constants.ALOAD_2] = Type.OBJECT;
  105. Constants.types[Constants.ASTORE_2] = Type.OBJECT;
  106. Constants.types[Constants.ALOAD_3] = Type.OBJECT;
  107. Constants.types[Constants.ASTORE_3] = Type.OBJECT;
  108. // INSTRUCTION_FLAGS - set for all
  109. Constants.instFlags[Constants.NOP] = 0;
  110. Constants.instFlags[Constants.ACONST_NULL] = Constants.PUSH_INST;
  111. Constants.instFlags[Constants.ICONST_M1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  112. Constants.instFlags[Constants.ICONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  113. Constants.instFlags[Constants.ICONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  114. Constants.instFlags[Constants.ICONST_2] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  115. Constants.instFlags[Constants.ICONST_3] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  116. Constants.instFlags[Constants.ICONST_4] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  117. Constants.instFlags[Constants.ICONST_5] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  118. Constants.instFlags[Constants.LCONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  119. Constants.instFlags[Constants.LCONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  120. Constants.instFlags[Constants.FCONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  121. Constants.instFlags[Constants.FCONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  122. Constants.instFlags[Constants.FCONST_2] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  123. Constants.instFlags[Constants.DCONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  124. Constants.instFlags[Constants.DCONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  125. Constants.instFlags[Constants.BIPUSH] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  126. Constants.instFlags[Constants.SIPUSH] = Constants.PUSH_INST | Constants.CONSTANT_INST;
  127. Constants.instFlags[Constants.LDC] = Constants.EXCEPTION_THROWER | Constants.PUSH_INST | Constants.CP_INST
  128. | Constants.INDEXED;
  129. Constants.instFlags[Constants.LDC_W] = Constants.EXCEPTION_THROWER | Constants.PUSH_INST | Constants.CP_INST
  130. | Constants.INDEXED;
  131. Constants.instFlags[Constants.LDC2_W] = Constants.EXCEPTION_THROWER | Constants.PUSH_INST | Constants.CP_INST
  132. | Constants.INDEXED;
  133. // the next five could be 'wide' prefixed and so have longer lengths
  134. Constants.instFlags[Constants.ILOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
  135. Constants.instFlags[Constants.LLOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
  136. Constants.instFlags[Constants.FLOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
  137. Constants.instFlags[Constants.DLOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
  138. Constants.instFlags[Constants.ALOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
  139. for (int ii = Constants.ILOAD_0; ii <= Constants.ALOAD_3; ii++) {
  140. Constants.instFlags[ii] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
  141. }
  142. // the next five could be 'wide' prefixed and so have longer lengths
  143. Constants.instFlags[Constants.ISTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
  144. Constants.instFlags[Constants.LSTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
  145. Constants.instFlags[Constants.FSTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
  146. Constants.instFlags[Constants.DSTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
  147. Constants.instFlags[Constants.ASTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
  148. for (int ii = Constants.ISTORE_0; ii <= Constants.ASTORE_3; ii++) {
  149. Constants.instFlags[ii] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
  150. }
  151. Constants.instFlags[Constants.IDIV] = Constants.EXCEPTION_THROWER;
  152. Constants.instExcs[Constants.IDIV] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
  153. Constants.instFlags[Constants.IREM] = Constants.EXCEPTION_THROWER;
  154. Constants.instExcs[Constants.IREM] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
  155. Constants.instFlags[Constants.LDIV] = Constants.EXCEPTION_THROWER;
  156. Constants.instExcs[Constants.LDIV] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
  157. Constants.instFlags[Constants.LREM] = Constants.EXCEPTION_THROWER;
  158. Constants.instExcs[Constants.LREM] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
  159. Constants.instFlags[Constants.ARRAYLENGTH] = Constants.EXCEPTION_THROWER;
  160. Constants.instExcs[Constants.ARRAYLENGTH] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
  161. Constants.instFlags[Constants.ATHROW] = Constants.EXCEPTION_THROWER;
  162. Constants.instExcs[Constants.ATHROW] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.THROWABLE };
  163. Constants.instFlags[Constants.AALOAD] = Constants.EXCEPTION_THROWER;
  164. Constants.instExcs[Constants.AALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  165. Constants.instFlags[Constants.IALOAD] = Constants.EXCEPTION_THROWER;
  166. Constants.instExcs[Constants.IALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  167. Constants.instFlags[Constants.BALOAD] = Constants.EXCEPTION_THROWER;
  168. Constants.instExcs[Constants.BALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  169. Constants.instFlags[Constants.FALOAD] = Constants.EXCEPTION_THROWER;
  170. Constants.instExcs[Constants.FALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  171. Constants.instFlags[Constants.DALOAD] = Constants.EXCEPTION_THROWER;
  172. Constants.instExcs[Constants.DALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  173. Constants.instFlags[Constants.CALOAD] = Constants.EXCEPTION_THROWER;
  174. Constants.instExcs[Constants.CALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  175. Constants.instFlags[Constants.LALOAD] = Constants.EXCEPTION_THROWER;
  176. Constants.instExcs[Constants.LALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  177. Constants.instFlags[Constants.SALOAD] = Constants.EXCEPTION_THROWER;
  178. Constants.instExcs[Constants.SALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  179. Constants.instFlags[Constants.AASTORE] = Constants.EXCEPTION_THROWER;
  180. Constants.instExcs[Constants.AASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  181. Constants.instFlags[Constants.IASTORE] = Constants.EXCEPTION_THROWER;
  182. Constants.instExcs[Constants.IASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  183. Constants.instFlags[Constants.BASTORE] = Constants.EXCEPTION_THROWER;
  184. Constants.instExcs[Constants.BASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  185. Constants.instFlags[Constants.FASTORE] = Constants.EXCEPTION_THROWER;
  186. Constants.instExcs[Constants.FASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  187. Constants.instFlags[Constants.DASTORE] = Constants.EXCEPTION_THROWER;
  188. Constants.instExcs[Constants.DASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  189. Constants.instFlags[Constants.CASTORE] = Constants.EXCEPTION_THROWER;
  190. Constants.instExcs[Constants.CASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  191. Constants.instFlags[Constants.LASTORE] = Constants.EXCEPTION_THROWER;
  192. Constants.instExcs[Constants.LASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  193. Constants.instFlags[Constants.SASTORE] = Constants.EXCEPTION_THROWER;
  194. Constants.instExcs[Constants.SASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  195. // stack instructions
  196. Constants.instFlags[Constants.DUP] = Constants.PUSH_INST | Constants.STACK_INST;
  197. Constants.instFlags[Constants.DUP_X1] = Constants.STACK_INST; // TODO fixme - aren't these two push/stack producers?
  198. // (although peculiar ones...)
  199. Constants.instFlags[Constants.DUP_X2] = Constants.STACK_INST;
  200. Constants.instFlags[Constants.DUP2] = Constants.PUSH_INST | Constants.STACK_INST;
  201. Constants.instFlags[Constants.DUP2_X1] = Constants.STACK_INST; // TODO fixme - aren't these two push/stack producers?
  202. // (although peculiar ones...)
  203. Constants.instFlags[Constants.DUP2_X2] = Constants.STACK_INST;
  204. Constants.instFlags[Constants.POP] = Constants.STACK_INST | Constants.POP_INST;
  205. Constants.instFlags[Constants.POP2] = Constants.STACK_INST | Constants.POP_INST;
  206. Constants.instFlags[Constants.SWAP] = Constants.STACK_INST;
  207. Constants.instFlags[Constants.MONITORENTER] = Constants.EXCEPTION_THROWER;
  208. Constants.instExcs[Constants.MONITORENTER] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
  209. Constants.instFlags[Constants.MONITOREXIT] = Constants.EXCEPTION_THROWER;
  210. Constants.instExcs[Constants.MONITOREXIT] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
  211. // branching instructions
  212. Constants.instFlags[Constants.GOTO] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
  213. Constants.instFlags[Constants.GOTO_W] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
  214. Constants.instFlags[Constants.JSR] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  215. | Constants.JSR_INSTRUCTION;
  216. Constants.instFlags[Constants.JSR_W] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  217. | Constants.JSR_INSTRUCTION;
  218. Constants.instFlags[Constants.IFGT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  219. | Constants.IF_INST;
  220. Constants.instFlags[Constants.IFLE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  221. | Constants.IF_INST;
  222. Constants.instFlags[Constants.IFNE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  223. | Constants.IF_INST;
  224. Constants.instFlags[Constants.IFEQ] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  225. | Constants.IF_INST;
  226. Constants.instFlags[Constants.IFGE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  227. | Constants.IF_INST;
  228. Constants.instFlags[Constants.IFLT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  229. | Constants.IF_INST;
  230. Constants.instFlags[Constants.IFNULL] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
  231. | Constants.IF_INST;
  232. Constants.instFlags[Constants.IFNONNULL] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  233. | Constants.NEGATABLE | Constants.IF_INST;
  234. Constants.instFlags[Constants.IF_ACMPEQ] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  235. | Constants.NEGATABLE | Constants.IF_INST;
  236. Constants.instFlags[Constants.IF_ACMPNE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  237. | Constants.NEGATABLE | Constants.IF_INST;
  238. Constants.instFlags[Constants.IF_ICMPEQ] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  239. | Constants.NEGATABLE | Constants.IF_INST;
  240. Constants.instFlags[Constants.IF_ICMPGE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  241. | Constants.NEGATABLE | Constants.IF_INST;
  242. Constants.instFlags[Constants.IF_ICMPGT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  243. | Constants.NEGATABLE | Constants.IF_INST;
  244. Constants.instFlags[Constants.IF_ICMPLE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  245. | Constants.NEGATABLE | Constants.IF_INST;
  246. Constants.instFlags[Constants.IF_ICMPLT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  247. | Constants.NEGATABLE | Constants.IF_INST;
  248. Constants.instFlags[Constants.IF_ICMPNE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
  249. | Constants.NEGATABLE | Constants.IF_INST;
  250. Constants.instFlags[Constants.LOOKUPSWITCH] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
  251. Constants.instFlags[Constants.TABLESWITCH] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
  252. // fixme these class arrays should be constants
  253. Constants.instFlags[Constants.ARETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
  254. Constants.instExcs[Constants.ARETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
  255. Constants.instFlags[Constants.DRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
  256. Constants.instExcs[Constants.DRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
  257. Constants.instFlags[Constants.FRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
  258. Constants.instExcs[Constants.FRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
  259. Constants.instFlags[Constants.IRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
  260. Constants.instExcs[Constants.IRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
  261. Constants.instFlags[Constants.LRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
  262. Constants.instExcs[Constants.LRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
  263. Constants.instFlags[Constants.RETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
  264. Constants.instExcs[Constants.RETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
  265. Constants.instFlags[Constants.NEW] = Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER | Constants.CP_INST
  266. | Constants.INDEXED;
  267. Constants.instExcs[Constants.NEW] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_FOR_ALLOCATIONS;
  268. Constants.instFlags[Constants.NEWARRAY] = Constants.EXCEPTION_THROWER;
  269. Constants.instExcs[Constants.NEWARRAY] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION };
  270. Constants.types[Constants.IINC] = Type.INT;
  271. Constants.instFlags[Constants.IINC] = Constants.LV_INST | Constants.INDEXED;
  272. Constants.instFlags[Constants.RET] = Constants.INDEXED;
  273. Constants.instFlags[Constants.ANEWARRAY] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
  274. | Constants.INDEXED;
  275. Constants.instExcs[Constants.ANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY;
  276. Constants.instFlags[Constants.CHECKCAST] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
  277. | Constants.INDEXED;
  278. Constants.instExcs[Constants.CHECKCAST] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_CHECKCAST;
  279. Constants.instFlags[Constants.INSTANCEOF] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
  280. | Constants.INDEXED;
  281. Constants.instExcs[Constants.INSTANCEOF] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION;
  282. Constants.instFlags[Constants.MULTIANEWARRAY] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
  283. | Constants.INDEXED;
  284. Constants.instExcs[Constants.MULTIANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY; // fixme i
  285. // think
  286. // this
  287. // is a
  288. // stackproducer, old
  289. // bcel says no...
  290. Constants.instFlags[Constants.GETFIELD] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
  291. | Constants.INDEXED;
  292. Constants.instExcs[Constants.GETFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
  293. Constants.instFlags[Constants.GETSTATIC] = Constants.PUSH_INST | Constants.EXCEPTION_THROWER | Constants.LOADCLASS_INST
  294. | Constants.CP_INST | Constants.INDEXED;
  295. Constants.instExcs[Constants.GETSTATIC] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC;
  296. Constants.instFlags[Constants.PUTFIELD] = Constants.POP_INST | Constants.EXCEPTION_THROWER | Constants.LOADCLASS_INST
  297. | Constants.CP_INST | Constants.INDEXED;
  298. Constants.instExcs[Constants.PUTFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
  299. Constants.instFlags[Constants.PUTSTATIC] = Constants.EXCEPTION_THROWER | Constants.POP_INST | Constants.CP_INST
  300. | Constants.LOADCLASS_INST | Constants.INDEXED;
  301. Constants.instExcs[Constants.PUTSTATIC] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC;
  302. Constants.instFlags[Constants.INVOKEINTERFACE] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
  303. | Constants.INDEXED;
  304. Constants.instExcs[Constants.INVOKEINTERFACE] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKEINTERFACE;
  305. Constants.instFlags[Constants.INVOKESPECIAL] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
  306. | Constants.INDEXED;
  307. Constants.instExcs[Constants.INVOKESPECIAL] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
  308. Constants.instFlags[Constants.INVOKESTATIC] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
  309. | Constants.INDEXED;
  310. Constants.instExcs[Constants.INVOKESTATIC] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESTATIC;
  311. Constants.instFlags[Constants.INVOKEVIRTUAL] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
  312. | Constants.INDEXED;
  313. Constants.instExcs[Constants.INVOKEVIRTUAL] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
  314. Constants.instFlags[Constants.INVOKEDYNAMIC] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
  315. | Constants.INDEXED;
  316. // TBD
  317. // Constants.instExcs[Constants.INVOKEDYNAMIC] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
  318. //@formatter:off
  319. char[] lengths = // . = varies in length, / = undefined
  320. ("1111111111111111" + // nop > dconst_1
  321. "2323322222111111" + // bipush > lload_1
  322. "1111111111111111" + // lload_2 > laload
  323. "1111112222211111" + // faload > lstore_0
  324. "1111111111111111" + // lstore_1 > iastore
  325. "1111111111111111" + // lastore > swap
  326. "1111111111111111" + // iadd > ddiv
  327. "1111111111111111" + // irem > land
  328. "1111311111111111" + // ior > d2l
  329. "1111111113333333" + // d2f > if_icmpeq
  330. "3333333332..1111" + // if_icmpne > dreturn
  331. "1133333335532311" + // areturn > athrow
  332. "3311.433551/////").toCharArray(); // checkcast >
  333. //@formatter:on
  334. int count = 0;
  335. for (; count < lengths.length; count++) {
  336. Constants.iLen[count] = (byte) (lengths[count] - 48);
  337. }
  338. while (count < 256) {
  339. Constants.iLen[count] = Constants.UNDEFINED;
  340. count++;
  341. }
  342. Constants.iLen[Constants.BREAKPOINT] = 1;
  343. Constants.iLen[Constants.IMPDEP1] = 1;
  344. Constants.iLen[Constants.IMPDEP2] = 1;
  345. char[] producesOnStack = ("0111111112211122" + // nop > dconst_1
  346. "1111212121111122" + // bipush > lload_1
  347. "2211112222111112" + // lload_2 > laload
  348. "1211110000000000" + // faload > lstore_0
  349. "0000000000000000" + // lstore_1 > iastore
  350. "0000000002344562" + // lastore > swap
  351. "1212121212121212" + // iadd > ddiv
  352. "1212121212121212" + // irem > land
  353. "1212021211212212" + // ior > d2l
  354. "1111111110000000" + // d2f > if_icmpeq
  355. "0000000010000000" + // if_icmpne > dreturn
  356. "00.0.0.....11111" + // areturn > athrow
  357. "11000100010/").toCharArray(); // checkcast >
  358. count = 0;
  359. for (; count < producesOnStack.length; count++) {
  360. Constants.stackEntriesProduced[count] = (byte) (producesOnStack[count] - 48);
  361. }
  362. while (count < 256) {
  363. Constants.iLen[count] = Constants.UNDEFINED;
  364. count++;
  365. }
  366. return null;
  367. }
  368. }