-/* jit/jit.c - calls the code generation functions
+/* src/vm/jit/jit.c - calls the code generation functions
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
- M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
- P. Tomsich, J. Wenninger
+ Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
This file is part of CACAO.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
- Contact: cacao@complang.tuwien.ac.at
+ Contact: cacao@cacaojvm.org
Authors: Andreas Krall
Reinhard Grafl
Changes: Edwin Steiner
+ Christian Thalinger
+ Christian Ullrich
- $Id: jit.c 1093 2004-05-27 15:49:43Z twisti $
+ $Id: jit.c 4357 2006-01-22 23:33:38Z twisti $
*/
-#include <stdlib.h>
-#include <string.h>
-#include "global.h"
-#include "main.h"
-#include "tables.h"
-#include "loader.h"
-#include "builtin.h"
-#include "native.h"
-#include "asmpart.h"
-#include "codegen.h"
-#include "types.h"
-#include "jit/inline.h"
-#include "jit/jit.h"
-#include "jit/parse.h"
-#include "jit/stack.h"
-#include "jit/reg.h"
-#include "jit/typecheck.h"
-#include "threads/thread.h"
-#include "disass.h"
-#include "loop/loop.h"
-#include "loop/graph.h"
-#include "loop/analyze.h"
-#include "toolbox/logging.h"
-#include "toolbox/memory.h"
-
-
-/* global switches ************************************************************/
-
-int count_jit_calls = 0;
-int count_methods = 0;
-int count_spills = 0;
-int count_pcmd_activ = 0;
-int count_pcmd_drop = 0;
-int count_pcmd_zero = 0;
-int count_pcmd_const_store = 0;
-int count_pcmd_const_alu = 0;
-int count_pcmd_const_bra = 0;
-int count_pcmd_load = 0;
-int count_pcmd_move = 0;
-int count_load_instruction = 0;
-int count_pcmd_store = 0;
-int count_pcmd_store_comb = 0;
-int count_dup_instruction = 0;
-int count_pcmd_op = 0;
-int count_pcmd_mem = 0;
-int count_pcmd_met = 0;
-int count_pcmd_bra = 0;
-int count_pcmd_table = 0;
-int count_pcmd_return = 0;
-int count_pcmd_returnx = 0;
-int count_check_null = 0;
-int count_check_bound = 0;
-int count_max_basic_blocks = 0;
-int count_basic_blocks = 0;
-int count_javainstr = 0;
-int count_max_javainstr = 0;
-int count_javacodesize = 0;
-int count_javaexcsize = 0;
-int count_calls = 0;
-int count_tryblocks = 0;
-int count_code_len = 0;
-int count_data_len = 0;
-int count_cstub_len = 0;
-int count_nstub_len = 0;
-int count_max_new_stack = 0;
-int count_upper_bound_new_stack = 0;
-static int count_block_stack_init[11] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0
-};
-int *count_block_stack = count_block_stack_init;
-static int count_analyse_iterations_init[5] = {
- 0, 0, 0, 0, 0
-};
-int *count_analyse_iterations = count_analyse_iterations_init;
-static int count_method_bb_distribution_init[9] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0
-};
-int *count_method_bb_distribution = count_method_bb_distribution_init;
-static int count_block_size_distribution_init[18] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0
-};
-int *count_block_size_distribution = count_block_size_distribution_init;
-static int count_store_length_init[21] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0
-};
-int *count_store_length = count_store_length_init;
-static int count_store_depth_init[11] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0
-};
-int *count_store_depth = count_store_depth_init;
+#include "config.h"
+#include "vm/types.h"
+#include "mm/memory.h"
+#include "native/native.h"
+#include "toolbox/logging.h"
+#include "vm/builtin.h"
+#include "vm/class.h"
+#include "vm/global.h"
+#include "vm/initialize.h"
+#include "vm/loader.h"
+#include "vm/method.h"
+#include "vm/options.h"
+#include "vm/statistics.h"
+#include "vm/jit/asmpart.h"
+#include "vm/jit/codegen-common.h"
+#include "vm/jit/disass.h"
+#include "vm/jit/dseg.h"
+#include "vm/jit/jit.h"
+
+
+#include "vm/jit/parse.h"
+#include "vm/jit/reg.h"
+#include "vm/jit/stack.h"
+#include "vm/jit/allocator/simplereg.h"
+#if defined(ENABLE_LSRA)
+# include "vm/jit/allocator/lsra.h"
+#endif
-/* global compiler variables **************************************************/
-
- /* data about the currently compiled method */
-
-classinfo *class; /* class the compiled method belongs to */
-methodinfo *method; /* pointer to method info of compiled method */
-utf *descriptor; /* type descriptor of compiled method */
-int mparamcount; /* number of parameters (incl. this) */
-u1 *mparamtypes; /* types of all parameters (TYPE_INT, ...) */
-static int mreturntype; /* return type of method */
-
-int maxstack; /* maximal JavaVM stack size */
-int maxlocals; /* maximal number of local JavaVM variables */
-int jcodelength; /* length of JavaVM-codes */
-u1 *jcode; /* pointer to start of JavaVM-code */
-lineinfo *jlinenumbers; /* line information array */
-u2 jlinenumbercount; /* number of entries in the linenumber array */
-int exceptiontablelength; /* length of exception table */
-xtable *extable; /* pointer to start of exception table */
-exceptiontable *raw_extable;
-
-int block_count; /* number of basic blocks */
-basicblock *block; /* points to basic block array */
-int *block_index; /* a table which contains for every byte of */
- /* JavaVM code a basic block index if at this */
- /* byte there is the start of a basic block */
+#if defined(USE_INLINING)
+# include "vm/jit/inline/inline.h"
+# include "vm/jit/inline/parseRT.h"
+# include "vm/jit/inline/parseXTA.h"
+#endif
-int instr_count; /* number of JavaVM instructions */
-instruction *instr; /* points to intermediate code instructions */
+#include "vm/jit/loop/analyze.h"
+#include "vm/jit/loop/graph.h"
+#include "vm/jit/loop/loop.h"
+#include "vm/jit/verify/typecheck.h"
-int stack_count; /* number of stack elements */
-stackelement *stack; /* points to intermediate code instructions */
+#if defined(USE_THREADS)
+# if defined(NATIVE_THREADS)
+# include "threads/native/threads.h"
+# else
+# include "threads/green/threads.h"
+# endif
+#endif
-bool isleafmethod; /* true if a method doesn't call subroutines */
-basicblock *last_block; /* points to the end of the BB list */
+/* debug macros ***************************************************************/
-bool regs_ok; /* true if registers have been allocated */
+#if !defined(NDEBUG)
+#define DEBUG_JIT_COMPILEVERBOSE(x) \
+ do { \
+ if (compileverbose) { \
+ log_message_method(x, m); \
+ } \
+ } while (0)
+#else
+#define DEBUG_JIT_COMPILEVERBOSE(x) /* nothing */
+#endif
-/* list of all classes used by the compiled method which have to be */
-/* initialised (if not already done) before execution of this method */
-chain *uninitializedclasses;
+
+/* global switches ************************************************************/
int stackreq[256];
-#if defined(__I386__)
-/* these define if a method has ICMDs which use %edx or %ecx */
-bool method_uses_ecx;
-bool method_uses_edx;
-#endif
-
-
int jcommandsize[256] = {
#define JAVA_NOP 0
#define ICMD_ACONST 1 /* val.a = constant */
1,
#define JAVA_ICONST_M1 2
-#define ICMD_NULLCHECKPOP 2
+#define ICMD_CHECKNULL 2
1,
#define JAVA_ICONST_0 3
#define ICMD_ICONST 3 /* val.i = constant */
1,
#define JAVA_ICONST_1 4
-#define ICMD_IREM0X10001 4
1,
#define JAVA_ICONST_2 5
#define ICMD_IDIVPOW2 5 /* val.i = constant */
#define JAVA_ICONST_4 7
1,
#define JAVA_ICONST_5 8
-#define ICMD_LREM0X10001 8
1,
#define JAVA_LCONST_0 9
#define ICMD_LCONST 9 /* val.l = constant */
#define JAVA_INVOKEINTERFACE 185
#define ICMD_INVOKEINTERFACE 185 /* val.a = method info pointer */
5,
-#define ICMD_CHECKASIZE 186 /* */
- 1, /* unused */
+/* UNDEF186 */
+ 1,
#define JAVA_NEW 187
#define ICMD_NEW 187 /* op1 = 1, val.a = class pointer */
3,
5,
#define JAVA_BREAKPOINT 202
1,
-#define ICMD_CHECKEXCEPTION 203
- 1, /* unused */
+/* UNDEF 203 */
+ 1,
+#define ICMD_IASTORECONST 204
+ 1,
+#define ICMD_LASTORECONST 205
+ 1,
+#define ICMD_FASTORECONST 206
+ 1,
+#define ICMD_DASTORECONST 207
+ 1,
+#define ICMD_AASTORECONST 208
+ 1,
+#define ICMD_BASTORECONST 209
+ 1,
+#define ICMD_CASTORECONST 210
+ 1,
+#define ICMD_SASTORECONST 211
+ 1,
+#define ICMD_PUTSTATICCONST 212
+ 1,
+#define ICMD_PUTFIELDCONST 213
+ 1,
+#define ICMD_IMULPOW2 214
+ 1,
+#define ICMD_LMULPOW2 215
+ 1,
- 1,1,1,1,1,1,1, /* unused */
- 1,1,1,1,1,1,1,1,1,1,
+ /* unused */
+ 1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
char *icmd_names[256] = {
- "NOP ", /* 0 */
- "ACONST ", /* 1 */
- "NULLCHECKPOP ", /* ICONST_M1 2 */
- "ICONST ", /* 3 */
- "IREM0X10001 ", /* ICONST_1 4 */
- "IDIVPOW2 ", /* ICONST_2 5 */
- "LDIVPOW2 ", /* ICONST_3 6 */
- "UNDEF__7 ", /* ICONST_4 7 */
- "LREM0X10001 ", /* ICONST_5 8 */
- "LCONST ", /* 9 */
- "LCMPCONST ", /* LCONST_1 10 */
- "FCONST ", /* 11 */
- "UNDEF_12 ", /* FCONST_1 12 */
- "ELSE_ICONST ", /* FCONST_2 13 */
- "DCONST ", /* 14 */
- "IFEQ_ICONST ", /* DCONST_1 15 */
- "IFNE_ICONST ", /* BIPUSH 16 */
- "IFLT_ICONST ", /* SIPUSH 17 */
- "IFGE_ICONST ", /* LDC1 18 */
- "IFGT_ICONST ", /* LDC2 19 */
- "IFLE_ICONST ", /* LDC2W 20 */
- "ILOAD ", /* 21 */
- "LLOAD ", /* 22 */
- "FLOAD ", /* 23 */
- "DLOAD ", /* 24 */
- "ALOAD ", /* 25 */
- "IADDCONST ", /* ILOAD_0 26 */
- "ISUBCONST ", /* ILOAD_1 27 */
- "IMULCONST ", /* ILOAD_2 28 */
- "IANDCONST ", /* ILOAD_3 29 */
- "IORCONST ", /* LLOAD_0 30 */
- "IXORCONST ", /* LLOAD_1 31 */
- "ISHLCONST ", /* LLOAD_2 32 */
- "ISHRCONST ", /* LLOAD_3 33 */
- "IUSHRCONST ", /* FLOAD_0 34 */
- "IREMPOW2 ", /* FLOAD_1 35 */
- "LADDCONST ", /* FLOAD_2 36 */
- "LSUBCONST ", /* FLOAD_3 37 */
- "LMULCONST ", /* DLOAD_0 38 */
- "LANDCONST ", /* DLOAD_1 39 */
- "LORCONST ", /* DLOAD_2 40 */
- "LXORCONST ", /* DLOAD_3 41 */
- "LSHLCONST ", /* ALOAD_0 42 */
- "LSHRCONST ", /* ALOAD_1 43 */
- "LUSHRCONST ", /* ALOAD_2 44 */
- "LREMPOW2 ", /* ALOAD_3 45 */
- "IALOAD ", /* 46 */
- "LALOAD ", /* 47 */
- "FALOAD ", /* 48 */
- "DALOAD ", /* 49 */
- "AALOAD ", /* 50 */
- "BALOAD ", /* 51 */
- "CALOAD ", /* 52 */
- "SALOAD ", /* 53 */
- "ISTORE ", /* 54 */
- "LSTORE ", /* 55 */
- "FSTORE ", /* 56 */
- "DSTORE ", /* 57 */
- "ASTORE ", /* 58 */
- "IF_LEQ ", /* ISTORE_0 59 */
- "IF_LNE ", /* ISTORE_1 60 */
- "IF_LLT ", /* ISTORE_2 61 */
- "IF_LGE ", /* ISTORE_3 62 */
- "IF_LGT ", /* LSTORE_0 63 */
- "IF_LLE ", /* LSTORE_1 64 */
- "IF_LCMPEQ ", /* LSTORE_2 65 */
- "IF_LCMPNE ", /* LSTORE_3 66 */
- "IF_LCMPLT ", /* FSTORE_0 67 */
- "IF_LCMPGE ", /* FSTORE_1 68 */
- "IF_LCMPGT ", /* FSTORE_2 69 */
- "IF_LCMPLE ", /* FSTORE_3 70 */
- "UNDEF_71 ", /* DSTORE_0 71 */
- "UNDEF_72 ", /* DSTORE_1 72 */
- "UNDEF_73 ", /* DSTORE_2 73 */
- "UNDEF_74 ", /* DSTORE_3 74 */
- "UNDEF_75 ", /* ASTORE_0 75 */
- "UNDEF_76 ", /* ASTORE_1 76 */
- "UNDEF_77 ", /* ASTORE_2 77 */
- "UNDEF_78 ", /* ASTORE_3 78 */
- "IASTORE ", /* 79 */
- "LASTORE ", /* 80 */
- "FASTORE ", /* 81 */
- "DASTORE ", /* 82 */
- "AASTORE ", /* 83 */
- "BASTORE ", /* 84 */
- "CASTORE ", /* 85 */
- "SASTORE ", /* 86 */
- "POP ", /* 87 */
- "POP2 ", /* 88 */
- "DUP ", /* 89 */
- "DUP_X1 ", /* 90 */
- "DUP_X2 ", /* 91 */
- "DUP2 ", /* 92 */
- "DUP2_X1 ", /* 93 */
- "DUP2_X2 ", /* 94 */
- "SWAP ", /* 95 */
- "IADD ", /* 96 */
- "LADD ", /* 97 */
- "FADD ", /* 98 */
- "DADD ", /* 99 */
- "ISUB ", /* 100 */
- "LSUB ", /* 101 */
- "FSUB ", /* 102 */
- "DSUB ", /* 103 */
- "IMUL ", /* 104 */
- "LMUL ", /* 105 */
- "FMUL ", /* 106 */
- "DMUL ", /* 107 */
- "IDIV ", /* 108 */
- "LDIV ", /* 109 */
- "FDIV ", /* 110 */
- "DDIV ", /* 111 */
- "IREM ", /* 112 */
- "LREM ", /* 113 */
- "FREM ", /* 114 */
- "DREM ", /* 115 */
- "INEG ", /* 116 */
- "LNEG ", /* 117 */
- "FNEG ", /* 118 */
- "DNEG ", /* 119 */
- "ISHL ", /* 120 */
- "LSHL ", /* 121 */
- "ISHR ", /* 122 */
- "LSHR ", /* 123 */
- "IUSHR ", /* 124 */
- "LUSHR ", /* 125 */
- "IAND ", /* 126 */
- "LAND ", /* 127 */
- "IOR ", /* 128 */
- "LOR ", /* 129 */
- "IXOR ", /* 130 */
- "LXOR ", /* 131 */
- "IINC ", /* 132 */
- "I2L ", /* 133 */
- "I2F ", /* 134 */
- "I2D ", /* 135 */
- "L2I ", /* 136 */
- "L2F ", /* 137 */
- "L2D ", /* 138 */
- "F2I ", /* 139 */
- "F2L ", /* 140 */
- "F2D ", /* 141 */
- "D2I ", /* 142 */
- "D2L ", /* 143 */
- "D2F ", /* 144 */
- "INT2BYTE ", /* 145 */
- "INT2CHAR ", /* 146 */
- "INT2SHORT ", /* 147 */
- "LCMP ", /* 148 */
- "FCMPL ", /* 149 */
- "FCMPG ", /* 150 */
- "DCMPL ", /* 151 */
- "DCMPG ", /* 152 */
- "IFEQ ", /* 153 */
- "IFNE ", /* 154 */
- "IFLT ", /* 155 */
- "IFGE ", /* 156 */
- "IFGT ", /* 157 */
- "IFLE ", /* 158 */
- "IF_ICMPEQ ", /* 159 */
- "IF_ICMPNE ", /* 160 */
- "IF_ICMPLT ", /* 161 */
- "IF_ICMPGE ", /* 162 */
- "IF_ICMPGT ", /* 163 */
- "IF_ICMPLE ", /* 164 */
- "IF_ACMPEQ ", /* 165 */
- "IF_ACMPNE ", /* 166 */
- "GOTO ", /* 167 */
- "JSR ", /* 168 */
- "RET ", /* 169 */
- "TABLESWITCH ", /* 170 */
- "LOOKUPSWITCH ", /* 171 */
- "IRETURN ", /* 172 */
- "LRETURN ", /* 173 */
- "FRETURN ", /* 174 */
- "DRETURN ", /* 175 */
- "ARETURN ", /* 176 */
- "RETURN ", /* 177 */
- "GETSTATIC ", /* 178 */
- "PUTSTATIC ", /* 179 */
- "GETFIELD ", /* 180 */
- "PUTFIELD ", /* 181 */
- "INVOKEVIRTUAL", /* 182 */
- "INVOKESPECIAL", /* 183 */
- "INVOKESTATIC ", /* 184 */
- "INVOKEINTERFACE",/* 185 */
- "CHECKASIZE ", /* UNDEF186 186 */
- "NEW ", /* 187 */
- "NEWARRAY ", /* 188 */
- "ANEWARRAY ", /* 189 */
- "ARRAYLENGTH ", /* 190 */
- "ATHROW ", /* 191 */
- "CHECKCAST ", /* 192 */
- "INSTANCEOF ", /* 193 */
- "MONITORENTER ", /* 194 */
- "MONITOREXIT ", /* 195 */
- "UNDEF196 ", /* WIDE 196 */
- "MULTIANEWARRAY",/* 197 */
- "IFNULL ", /* 198 */
- "IFNONNULL ", /* 199 */
- "UNDEF200 ", /* GOTO_W 200 */
- "UNDEF201 ", /* JSR_W 201 */
- "UNDEF202 ", /* BREAKPOINT 202 */
- "CHECKEXCEPTION", /* UNDEF204 203 */
-
- "UNDEF204","UNDEF205",
- "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
- "UNDEF251","UNDEF252",
-
- "BUILTIN3 ", /* 253 */
- "BUILTIN2 ", /* 254 */
- "BUILTIN1 " /* 255 */
+ "NOP ", /* 0 */
+ "ACONST ", /* 1 */
+ "CHECKNULL ", /* ICONST_M1 2 */
+ "ICONST ", /* 3 */
+ "UNDEF4 ", /* ICONST_1 4 */
+ "IDIVPOW2 ", /* ICONST_2 5 */
+ "LDIVPOW2 ", /* ICONST_3 6 */
+ "UNDEF7 ", /* ICONST_4 7 */
+ "UNDEF8 ", /* ICONST_5 8 */
+ "LCONST ", /* 9 */
+ "LCMPCONST ", /* LCONST_1 10 */
+ "FCONST ", /* 11 */
+ "UNDEF12 ", /* FCONST_1 12 */
+ "ELSE_ICONST ", /* FCONST_2 13 */
+ "DCONST ", /* 14 */
+ "IFEQ_ICONST ", /* DCONST_1 15 */
+ "IFNE_ICONST ", /* BIPUSH 16 */
+ "IFLT_ICONST ", /* SIPUSH 17 */
+ "IFGE_ICONST ", /* LDC1 18 */
+ "IFGT_ICONST ", /* LDC2 19 */
+ "IFLE_ICONST ", /* LDC2W 20 */
+ "ILOAD ", /* 21 */
+ "LLOAD ", /* 22 */
+ "FLOAD ", /* 23 */
+ "DLOAD ", /* 24 */
+ "ALOAD ", /* 25 */
+ "IADDCONST ", /* ILOAD_0 26 */
+ "ISUBCONST ", /* ILOAD_1 27 */
+ "IMULCONST ", /* ILOAD_2 28 */
+ "IANDCONST ", /* ILOAD_3 29 */
+ "IORCONST ", /* LLOAD_0 30 */
+ "IXORCONST ", /* LLOAD_1 31 */
+ "ISHLCONST ", /* LLOAD_2 32 */
+ "ISHRCONST ", /* LLOAD_3 33 */
+ "IUSHRCONST ", /* FLOAD_0 34 */
+ "IREMPOW2 ", /* FLOAD_1 35 */
+ "LADDCONST ", /* FLOAD_2 36 */
+ "LSUBCONST ", /* FLOAD_3 37 */
+ "LMULCONST ", /* DLOAD_0 38 */
+ "LANDCONST ", /* DLOAD_1 39 */
+ "LORCONST ", /* DLOAD_2 40 */
+ "LXORCONST ", /* DLOAD_3 41 */
+ "LSHLCONST ", /* ALOAD_0 42 */
+ "LSHRCONST ", /* ALOAD_1 43 */
+ "LUSHRCONST ", /* ALOAD_2 44 */
+ "LREMPOW2 ", /* ALOAD_3 45 */
+ "IALOAD ", /* 46 */
+ "LALOAD ", /* 47 */
+ "FALOAD ", /* 48 */
+ "DALOAD ", /* 49 */
+ "AALOAD ", /* 50 */
+ "BALOAD ", /* 51 */
+ "CALOAD ", /* 52 */
+ "SALOAD ", /* 53 */
+ "ISTORE ", /* 54 */
+ "LSTORE ", /* 55 */
+ "FSTORE ", /* 56 */
+ "DSTORE ", /* 57 */
+ "ASTORE ", /* 58 */
+ "IF_LEQ ", /* ISTORE_0 59 */
+ "IF_LNE ", /* ISTORE_1 60 */
+ "IF_LLT ", /* ISTORE_2 61 */
+ "IF_LGE ", /* ISTORE_3 62 */
+ "IF_LGT ", /* LSTORE_0 63 */
+ "IF_LLE ", /* LSTORE_1 64 */
+ "IF_LCMPEQ ", /* LSTORE_2 65 */
+ "IF_LCMPNE ", /* LSTORE_3 66 */
+ "IF_LCMPLT ", /* FSTORE_0 67 */
+ "IF_LCMPGE ", /* FSTORE_1 68 */
+ "IF_LCMPGT ", /* FSTORE_2 69 */
+ "IF_LCMPLE ", /* FSTORE_3 70 */
+ "UNDEF71 ", /* DSTORE_0 71 */
+ "UNDEF72 ", /* DSTORE_1 72 */
+ "UNDEF73 ", /* DSTORE_2 73 */
+ "UNDEF74 ", /* DSTORE_3 74 */
+ "UNDEF75 ", /* ASTORE_0 75 */
+ "UNDEF76 ", /* ASTORE_1 76 */
+ "UNDEF77 ", /* ASTORE_2 77 */
+ "UNDEF78 ", /* ASTORE_3 78 */
+ "IASTORE ", /* 79 */
+ "LASTORE ", /* 80 */
+ "FASTORE ", /* 81 */
+ "DASTORE ", /* 82 */
+ "AASTORE ", /* 83 */
+ "BASTORE ", /* 84 */
+ "CASTORE ", /* 85 */
+ "SASTORE ", /* 86 */
+ "POP ", /* 87 */
+ "POP2 ", /* 88 */
+ "DUP ", /* 89 */
+ "DUP_X1 ", /* 90 */
+ "DUP_X2 ", /* 91 */
+ "DUP2 ", /* 92 */
+ "DUP2_X1 ", /* 93 */
+ "DUP2_X2 ", /* 94 */
+ "SWAP ", /* 95 */
+ "IADD ", /* 96 */
+ "LADD ", /* 97 */
+ "FADD ", /* 98 */
+ "DADD ", /* 99 */
+ "ISUB ", /* 100 */
+ "LSUB ", /* 101 */
+ "FSUB ", /* 102 */
+ "DSUB ", /* 103 */
+ "IMUL ", /* 104 */
+ "LMUL ", /* 105 */
+ "FMUL ", /* 106 */
+ "DMUL ", /* 107 */
+ "IDIV ", /* 108 */
+ "LDIV ", /* 109 */
+ "FDIV ", /* 110 */
+ "DDIV ", /* 111 */
+ "IREM ", /* 112 */
+ "LREM ", /* 113 */
+ "FREM ", /* 114 */
+ "DREM ", /* 115 */
+ "INEG ", /* 116 */
+ "LNEG ", /* 117 */
+ "FNEG ", /* 118 */
+ "DNEG ", /* 119 */
+ "ISHL ", /* 120 */
+ "LSHL ", /* 121 */
+ "ISHR ", /* 122 */
+ "LSHR ", /* 123 */
+ "IUSHR ", /* 124 */
+ "LUSHR ", /* 125 */
+ "IAND ", /* 126 */
+ "LAND ", /* 127 */
+ "IOR ", /* 128 */
+ "LOR ", /* 129 */
+ "IXOR ", /* 130 */
+ "LXOR ", /* 131 */
+ "IINC ", /* 132 */
+ "I2L ", /* 133 */
+ "I2F ", /* 134 */
+ "I2D ", /* 135 */
+ "L2I ", /* 136 */
+ "L2F ", /* 137 */
+ "L2D ", /* 138 */
+ "F2I ", /* 139 */
+ "F2L ", /* 140 */
+ "F2D ", /* 141 */
+ "D2I ", /* 142 */
+ "D2L ", /* 143 */
+ "D2F ", /* 144 */
+ "INT2BYTE ", /* 145 */
+ "INT2CHAR ", /* 146 */
+ "INT2SHORT ", /* 147 */
+ "LCMP ", /* 148 */
+ "FCMPL ", /* 149 */
+ "FCMPG ", /* 150 */
+ "DCMPL ", /* 151 */
+ "DCMPG ", /* 152 */
+ "IFEQ ", /* 153 */
+ "IFNE ", /* 154 */
+ "IFLT ", /* 155 */
+ "IFGE ", /* 156 */
+ "IFGT ", /* 157 */
+ "IFLE ", /* 158 */
+ "IF_ICMPEQ ", /* 159 */
+ "IF_ICMPNE ", /* 160 */
+ "IF_ICMPLT ", /* 161 */
+ "IF_ICMPGE ", /* 162 */
+ "IF_ICMPGT ", /* 163 */
+ "IF_ICMPLE ", /* 164 */
+ "IF_ACMPEQ ", /* 165 */
+ "IF_ACMPNE ", /* 166 */
+ "GOTO ", /* 167 */
+ "JSR ", /* 168 */
+ "RET ", /* 169 */
+ "TABLESWITCH ", /* 170 */
+ "LOOKUPSWITCH ", /* 171 */
+ "IRETURN ", /* 172 */
+ "LRETURN ", /* 173 */
+ "FRETURN ", /* 174 */
+ "DRETURN ", /* 175 */
+ "ARETURN ", /* 176 */
+ "RETURN ", /* 177 */
+ "GETSTATIC ", /* 178 */
+ "PUTSTATIC ", /* 179 */
+ "GETFIELD ", /* 180 */
+ "PUTFIELD ", /* 181 */
+ "INVOKEVIRTUAL ", /* 182 */
+ "INVOKESPECIAL ", /* 183 */
+ "INVOKESTATIC ", /* 184 */
+ "INVOKEINTERFACE", /* 185 */
+ "UNDEF186 ", /* UNDEF186 186 */
+ "NEW ", /* 187 */
+ "NEWARRAY ", /* 188 */
+ "ANEWARRAY ", /* 189 */
+ "ARRAYLENGTH ", /* 190 */
+ "ATHROW ", /* 191 */
+ "CHECKCAST ", /* 192 */
+ "INSTANCEOF ", /* 193 */
+ "MONITORENTER ", /* 194 */
+ "MONITOREXIT ", /* 195 */
+ "UNDEF196 ", /* WIDE 196 */
+ "MULTIANEWARRAY ", /* 197 */
+ "IFNULL ", /* 198 */
+ "IFNONNULL ", /* 199 */
+ "UNDEF200 ", /* GOTO_W 200 */
+ "UNDEF201 ", /* JSR_W 201 */
+ "UNDEF202 ", /* BREAKPOINT 202 */
+ "UNDEF203 ", /* UNDEF203 203 */
+ "IASTORECONST ", /* 204 */
+ "LASTORECONST ", /* 205 */
+ "FASTORECONST ", /* 206 */
+ "DASTORECONST ", /* 207 */
+ "AASTORECONST ", /* 208 */
+ "BASTORECONST ", /* 209 */
+ "CASTORECONST ", /* 210 */
+ "SASTORECONST ", /* 211 */
+ "PUTSTATICCONST ", /* 212 */
+ "PUTFIELDCONST ", /* 213 */
+ "IMULPOW2 ", /* 214 */
+ "LMULPOW2 ", /* 215 */
+
+ "UNDEF216", "UNDEF217", "UNDEF218", "UNDEF219", "UNDEF220",
+ "UNDEF221", "UNDEF222", "UNDEF223", "UNDEF224", "UNDEF225",
+ "UNDEF226", "UNDEF227", "UNDEF228", "UNDEF229", "UNDEF230",
+ "UNDEF231", "UNDEF232", "UNDEF233", "UNDEF234", "UNDEF235",
+ "UNDEF236", "UNDEF237", "UNDEF238", "UNDEF239", "UNDEF240",
+ "UNDEF241", "UNDEF242", "UNDEF243", "UNDEF244", "UNDEF245",
+ "UNDEF246", "UNDEF247", "UNDEF248", "UNDEF249", "UNDEF250",
+
+ "INLINE_START ", /* 251 */
+ "INLINE_END ", /* 252 */
+
+ "UNDEF253", "UNDEF254",
+
+ "BUILTIN " /* 255 */
};
char *opcode_names[256] = {
- "NOP ", /* 0 */
- "ACONST ", /* 1 */
- "ICONST_M1 ", /* ICONST_M1 2 */
- "ICONST_0 ", /* ICONST_0 3 */
- "ICONST_1 ", /* ICONST_1 4 */
- "ICONST_2 ", /* ICONST_2 5 */
- "ICONST_3 ", /* ICONST_3 6 */
- "ICONST_4 ", /* ICONST_4 7 */
- "ICONST_5 ", /* ICONST_5 8 */
- "LCONST_0 ", /* LCONST_0 9 */
- "LCONST_1 ", /* LCONST_1 10 */
- "FCONST_0 ", /* FCONST_0 11 */
- "FCONST_1 ", /* FCONST_1 12 */
- "FCONST_2 ", /* FCONST_2 13 */
- "DCONST_0 ", /* DCONST_0 14 */
- "DCONST_1 ", /* DCONST_1 15 */
- "BIPUSH ", /* BIPUSH 16 */
- "SIPUSH ", /* SIPUSH 17 */
- "LDC ", /* LDC 18 */
- "LDC_W ", /* LDC_W 19 */
- "LDC2_W ", /* LDC2_W 20 */
- "ILOAD ", /* 21 */
- "LLOAD ", /* 22 */
- "FLOAD ", /* 23 */
- "DLOAD ", /* 24 */
- "ALOAD ", /* 25 */
- "ILOAD_0 ", /* ILOAD_0 26 */
- "ILOAD_1 ", /* ILOAD_1 27 */
- "ILOAD_2 ", /* ILOAD_2 28 */
- "ILOAD_3 ", /* ILOAD_3 29 */
- "LLOAD_0 ", /* LLOAD_0 30 */
- "LLOAD_1 ", /* LLOAD_1 31 */
- "LLOAD_2 ", /* LLOAD_2 32 */
- "LLOAD_3 ", /* LLOAD_3 33 */
- "FLOAD_0 ", /* FLOAD_0 34 */
- "FLOAD_1 ", /* FLOAD_1 35 */
- "FLOAD_2 ", /* FLOAD_2 36 */
- "FLOAD_3 ", /* FLOAD_3 37 */
- "DLOAD_0 ", /* DLOAD_0 38 */
- "DLOAD_1 ", /* DLOAD_1 39 */
- "DLOAD_2 ", /* DLOAD_2 40 */
- "DLOAD_3 ", /* DLOAD_3 41 */
- "ALOAD_0 ", /* ALOAD_0 42 */
- "ALOAD_1 ", /* ALOAD_1 43 */
- "ALOAD_2 ", /* ALOAD_2 44 */
- "ALOAD_3 ", /* ALOAD_3 45 */
- "IALOAD ", /* 46 */
- "LALOAD ", /* 47 */
- "FALOAD ", /* 48 */
- "DALOAD ", /* 49 */
- "AALOAD ", /* 50 */
- "BALOAD ", /* 51 */
- "CALOAD ", /* 52 */
- "SALOAD ", /* 53 */
- "ISTORE ", /* 54 */
- "LSTORE ", /* 55 */
- "FSTORE ", /* 56 */
- "DSTORE ", /* 57 */
- "ASTORE ", /* 58 */
- "ISTORE_0 ", /* ISTORE_0 59 */
- "ISTORE_1 ", /* ISTORE_1 60 */
- "ISTORE_2 ", /* ISTORE_2 61 */
- "ISTORE_3 ", /* ISTORE_3 62 */
- "LSTORE_0 ", /* LSTORE_0 63 */
- "LSTORE_1 ", /* LSTORE_1 64 */
- "LSTORE_2 ", /* LSTORE_2 65 */
- "LSTORE_3 ", /* LSTORE_3 66 */
- "FSTORE_0 ", /* FSTORE_0 67 */
- "FSTORE_1 ", /* FSTORE_1 68 */
- "FSTORE_2 ", /* FSTORE_2 69 */
- "FSTORE_3 ", /* FSTORE_3 70 */
- "DSTORE_0 ", /* DSTORE_0 71 */
- "DSTORE_1 ", /* DSTORE_1 72 */
- "DSTORE_2 ", /* DSTORE_2 73 */
- "DSTORE_3 ", /* DSTORE_3 74 */
- "ASTORE_0 ", /* ASTORE_0 75 */
- "ASTORE_1 ", /* ASTORE_1 76 */
- "ASTORE_2 ", /* ASTORE_2 77 */
- "ASTORE_3 ", /* ASTORE_3 78 */
- "IASTORE ", /* 79 */
- "LASTORE ", /* 80 */
- "FASTORE ", /* 81 */
- "DASTORE ", /* 82 */
- "AASTORE ", /* 83 */
- "BASTORE ", /* 84 */
- "CASTORE ", /* 85 */
- "SASTORE ", /* 86 */
- "POP ", /* 87 */
- "POP2 ", /* 88 */
- "DUP ", /* 89 */
- "DUP_X1 ", /* 90 */
- "DUP_X2 ", /* 91 */
- "DUP2 ", /* 92 */
- "DUP2_X1 ", /* 93 */
- "DUP2_X2 ", /* 94 */
- "SWAP ", /* 95 */
- "IADD ", /* 96 */
- "LADD ", /* 97 */
- "FADD ", /* 98 */
- "DADD ", /* 99 */
- "ISUB ", /* 100 */
- "LSUB ", /* 101 */
- "FSUB ", /* 102 */
- "DSUB ", /* 103 */
- "IMUL ", /* 104 */
- "LMUL ", /* 105 */
- "FMUL ", /* 106 */
- "DMUL ", /* 107 */
- "IDIV ", /* 108 */
- "LDIV ", /* 109 */
- "FDIV ", /* 110 */
- "DDIV ", /* 111 */
- "IREM ", /* 112 */
- "LREM ", /* 113 */
- "FREM ", /* 114 */
- "DREM ", /* 115 */
- "INEG ", /* 116 */
- "LNEG ", /* 117 */
- "FNEG ", /* 118 */
- "DNEG ", /* 119 */
- "ISHL ", /* 120 */
- "LSHL ", /* 121 */
- "ISHR ", /* 122 */
- "LSHR ", /* 123 */
- "IUSHR ", /* 124 */
- "LUSHR ", /* 125 */
- "IAND ", /* 126 */
- "LAND ", /* 127 */
- "IOR ", /* 128 */
- "LOR ", /* 129 */
- "IXOR ", /* 130 */
- "LXOR ", /* 131 */
- "IINC ", /* 132 */
- "I2L ", /* 133 */
- "I2F ", /* 134 */
- "I2D ", /* 135 */
- "L2I ", /* 136 */
- "L2F ", /* 137 */
- "L2D ", /* 138 */
- "F2I ", /* 139 */
- "F2L ", /* 140 */
- "F2D ", /* 141 */
- "D2I ", /* 142 */
- "D2L ", /* 143 */
- "D2F ", /* 144 */
- "INT2BYTE ", /* 145 */
- "INT2CHAR ", /* 146 */
- "INT2SHORT ", /* 147 */
- "LCMP ", /* 148 */
- "FCMPL ", /* 149 */
- "FCMPG ", /* 150 */
- "DCMPL ", /* 151 */
- "DCMPG ", /* 152 */
- "IFEQ ", /* 153 */
- "IFNE ", /* 154 */
- "IFLT ", /* 155 */
- "IFGE ", /* 156 */
- "IFGT ", /* 157 */
- "IFLE ", /* 158 */
- "IF_ICMPEQ ", /* 159 */
- "IF_ICMPNE ", /* 160 */
- "IF_ICMPLT ", /* 161 */
- "IF_ICMPGE ", /* 162 */
- "IF_ICMPGT ", /* 163 */
- "IF_ICMPLE ", /* 164 */
- "IF_ACMPEQ ", /* 165 */
- "IF_ACMPNE ", /* 166 */
- "GOTO ", /* 167 */
- "JSR ", /* 168 */
- "RET ", /* 169 */
- "TABLESWITCH ", /* 170 */
- "LOOKUPSWITCH ", /* 171 */
- "IRETURN ", /* 172 */
- "LRETURN ", /* 173 */
- "FRETURN ", /* 174 */
- "DRETURN ", /* 175 */
- "ARETURN ", /* 176 */
- "RETURN ", /* 177 */
- "GETSTATIC ", /* 178 */
- "PUTSTATIC ", /* 179 */
- "GETFIELD ", /* 180 */
- "PUTFIELD ", /* 181 */
- "INVOKEVIRTUAL", /* 182 */
- "INVOKESPECIAL", /* 183 */
- "INVOKESTATIC ", /* 184 */
- "INVOKEINTERFACE",/* 185 */
- "CHECKASIZE ", /* UNDEF186 186 */
- "NEW ", /* 187 */
- "NEWARRAY ", /* 188 */
- "ANEWARRAY ", /* 189 */
- "ARRAYLENGTH ", /* 190 */
- "ATHROW ", /* 191 */
- "CHECKCAST ", /* 192 */
- "INSTANCEOF ", /* 193 */
- "MONITORENTER ", /* 194 */
- "MONITOREXIT ", /* 195 */
- "WIDE ", /* WIDE 196 */
- "MULTIANEWARRAY",/* 197 */
- "IFNULL ", /* 198 */
- "IFNONNULL ", /* 199 */
- "GOTO_W ", /* GOTO_W 200 */
- "JSR_W ", /* JSR_W 201 */
- "BREAKPOINT ", /* BREAKPOINT 202 */
- "CHECKEXCEPTION", /* UNDEF203 203 */
-
- "UNDEF204","UNDEF205",
- "UNDEF206","UNDEF207","UNDEF208","UNDEF209","UNDEF210",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF216","UNDEF217","UNDEF218","UNDEF219","UNDEF220",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF226","UNDEF227","UNDEF228","UNDEF229","UNDEF230",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
- "UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
- "UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
- "UNDEF251","UNDEF252",
-
- "BUILTIN3 ", /* 253 */
- "BUILTIN2 ", /* 254 */
- "BUILTIN1 " /* 255 */
+ "NOP ", /* 0 */
+ "ACONST ", /* 1 */
+ "ICONST_M1 ", /* ICONST_M1 2 */
+ "ICONST_0 ", /* ICONST_0 3 */
+ "ICONST_1 ", /* ICONST_1 4 */
+ "ICONST_2 ", /* ICONST_2 5 */
+ "ICONST_3 ", /* ICONST_3 6 */
+ "ICONST_4 ", /* ICONST_4 7 */
+ "ICONST_5 ", /* ICONST_5 8 */
+ "LCONST_0 ", /* LCONST_0 9 */
+ "LCONST_1 ", /* LCONST_1 10 */
+ "FCONST_0 ", /* FCONST_0 11 */
+ "FCONST_1 ", /* FCONST_1 12 */
+ "FCONST_2 ", /* FCONST_2 13 */
+ "DCONST_0 ", /* DCONST_0 14 */
+ "DCONST_1 ", /* DCONST_1 15 */
+ "BIPUSH ", /* BIPUSH 16 */
+ "SIPUSH ", /* SIPUSH 17 */
+ "LDC ", /* LDC 18 */
+ "LDC_W ", /* LDC_W 19 */
+ "LDC2_W ", /* LDC2_W 20 */
+ "ILOAD ", /* 21 */
+ "LLOAD ", /* 22 */
+ "FLOAD ", /* 23 */
+ "DLOAD ", /* 24 */
+ "ALOAD ", /* 25 */
+ "ILOAD_0 ", /* ILOAD_0 26 */
+ "ILOAD_1 ", /* ILOAD_1 27 */
+ "ILOAD_2 ", /* ILOAD_2 28 */
+ "ILOAD_3 ", /* ILOAD_3 29 */
+ "LLOAD_0 ", /* LLOAD_0 30 */
+ "LLOAD_1 ", /* LLOAD_1 31 */
+ "LLOAD_2 ", /* LLOAD_2 32 */
+ "LLOAD_3 ", /* LLOAD_3 33 */
+ "FLOAD_0 ", /* FLOAD_0 34 */
+ "FLOAD_1 ", /* FLOAD_1 35 */
+ "FLOAD_2 ", /* FLOAD_2 36 */
+ "FLOAD_3 ", /* FLOAD_3 37 */
+ "DLOAD_0 ", /* DLOAD_0 38 */
+ "DLOAD_1 ", /* DLOAD_1 39 */
+ "DLOAD_2 ", /* DLOAD_2 40 */
+ "DLOAD_3 ", /* DLOAD_3 41 */
+ "ALOAD_0 ", /* ALOAD_0 42 */
+ "ALOAD_1 ", /* ALOAD_1 43 */
+ "ALOAD_2 ", /* ALOAD_2 44 */
+ "ALOAD_3 ", /* ALOAD_3 45 */
+ "IALOAD ", /* 46 */
+ "LALOAD ", /* 47 */
+ "FALOAD ", /* 48 */
+ "DALOAD ", /* 49 */
+ "AALOAD ", /* 50 */
+ "BALOAD ", /* 51 */
+ "CALOAD ", /* 52 */
+ "SALOAD ", /* 53 */
+ "ISTORE ", /* 54 */
+ "LSTORE ", /* 55 */
+ "FSTORE ", /* 56 */
+ "DSTORE ", /* 57 */
+ "ASTORE ", /* 58 */
+ "ISTORE_0 ", /* ISTORE_0 59 */
+ "ISTORE_1 ", /* ISTORE_1 60 */
+ "ISTORE_2 ", /* ISTORE_2 61 */
+ "ISTORE_3 ", /* ISTORE_3 62 */
+ "LSTORE_0 ", /* LSTORE_0 63 */
+ "LSTORE_1 ", /* LSTORE_1 64 */
+ "LSTORE_2 ", /* LSTORE_2 65 */
+ "LSTORE_3 ", /* LSTORE_3 66 */
+ "FSTORE_0 ", /* FSTORE_0 67 */
+ "FSTORE_1 ", /* FSTORE_1 68 */
+ "FSTORE_2 ", /* FSTORE_2 69 */
+ "FSTORE_3 ", /* FSTORE_3 70 */
+ "DSTORE_0 ", /* DSTORE_0 71 */
+ "DSTORE_1 ", /* DSTORE_1 72 */
+ "DSTORE_2 ", /* DSTORE_2 73 */
+ "DSTORE_3 ", /* DSTORE_3 74 */
+ "ASTORE_0 ", /* ASTORE_0 75 */
+ "ASTORE_1 ", /* ASTORE_1 76 */
+ "ASTORE_2 ", /* ASTORE_2 77 */
+ "ASTORE_3 ", /* ASTORE_3 78 */
+ "IASTORE ", /* 79 */
+ "LASTORE ", /* 80 */
+ "FASTORE ", /* 81 */
+ "DASTORE ", /* 82 */
+ "AASTORE ", /* 83 */
+ "BASTORE ", /* 84 */
+ "CASTORE ", /* 85 */
+ "SASTORE ", /* 86 */
+ "POP ", /* 87 */
+ "POP2 ", /* 88 */
+ "DUP ", /* 89 */
+ "DUP_X1 ", /* 90 */
+ "DUP_X2 ", /* 91 */
+ "DUP2 ", /* 92 */
+ "DUP2_X1 ", /* 93 */
+ "DUP2_X2 ", /* 94 */
+ "SWAP ", /* 95 */
+ "IADD ", /* 96 */
+ "LADD ", /* 97 */
+ "FADD ", /* 98 */
+ "DADD ", /* 99 */
+ "ISUB ", /* 100 */
+ "LSUB ", /* 101 */
+ "FSUB ", /* 102 */
+ "DSUB ", /* 103 */
+ "IMUL ", /* 104 */
+ "LMUL ", /* 105 */
+ "FMUL ", /* 106 */
+ "DMUL ", /* 107 */
+ "IDIV ", /* 108 */
+ "LDIV ", /* 109 */
+ "FDIV ", /* 110 */
+ "DDIV ", /* 111 */
+ "IREM ", /* 112 */
+ "LREM ", /* 113 */
+ "FREM ", /* 114 */
+ "DREM ", /* 115 */
+ "INEG ", /* 116 */
+ "LNEG ", /* 117 */
+ "FNEG ", /* 118 */
+ "DNEG ", /* 119 */
+ "ISHL ", /* 120 */
+ "LSHL ", /* 121 */
+ "ISHR ", /* 122 */
+ "LSHR ", /* 123 */
+ "IUSHR ", /* 124 */
+ "LUSHR ", /* 125 */
+ "IAND ", /* 126 */
+ "LAND ", /* 127 */
+ "IOR ", /* 128 */
+ "LOR ", /* 129 */
+ "IXOR ", /* 130 */
+ "LXOR ", /* 131 */
+ "IINC ", /* 132 */
+ "I2L ", /* 133 */
+ "I2F ", /* 134 */
+ "I2D ", /* 135 */
+ "L2I ", /* 136 */
+ "L2F ", /* 137 */
+ "L2D ", /* 138 */
+ "F2I ", /* 139 */
+ "F2L ", /* 140 */
+ "F2D ", /* 141 */
+ "D2I ", /* 142 */
+ "D2L ", /* 143 */
+ "D2F ", /* 144 */
+ "INT2BYTE ", /* 145 */
+ "INT2CHAR ", /* 146 */
+ "INT2SHORT ", /* 147 */
+ "LCMP ", /* 148 */
+ "FCMPL ", /* 149 */
+ "FCMPG ", /* 150 */
+ "DCMPL ", /* 151 */
+ "DCMPG ", /* 152 */
+ "IFEQ ", /* 153 */
+ "IFNE ", /* 154 */
+ "IFLT ", /* 155 */
+ "IFGE ", /* 156 */
+ "IFGT ", /* 157 */
+ "IFLE ", /* 158 */
+ "IF_ICMPEQ ", /* 159 */
+ "IF_ICMPNE ", /* 160 */
+ "IF_ICMPLT ", /* 161 */
+ "IF_ICMPGE ", /* 162 */
+ "IF_ICMPGT ", /* 163 */
+ "IF_ICMPLE ", /* 164 */
+ "IF_ACMPEQ ", /* 165 */
+ "IF_ACMPNE ", /* 166 */
+ "GOTO ", /* 167 */
+ "JSR ", /* 168 */
+ "RET ", /* 169 */
+ "TABLESWITCH ", /* 170 */
+ "LOOKUPSWITCH ", /* 171 */
+ "IRETURN ", /* 172 */
+ "LRETURN ", /* 173 */
+ "FRETURN ", /* 174 */
+ "DRETURN ", /* 175 */
+ "ARETURN ", /* 176 */
+ "RETURN ", /* 177 */
+ "GETSTATIC ", /* 178 */
+ "PUTSTATIC ", /* 179 */
+ "GETFIELD ", /* 180 */
+ "PUTFIELD ", /* 181 */
+ "INVOKEVIRTUAL ", /* 182 */
+ "INVOKESPECIAL ", /* 183 */
+ "INVOKESTATIC ", /* 184 */
+ "INVOKEINTERFACE", /* 185 */
+ "UNDEF186 ", /* 186 */
+ "NEW ", /* 187 */
+ "NEWARRAY ", /* 188 */
+ "ANEWARRAY ", /* 189 */
+ "ARRAYLENGTH ", /* 190 */
+ "ATHROW ", /* 191 */
+ "CHECKCAST ", /* 192 */
+ "INSTANCEOF ", /* 193 */
+ "MONITORENTER ", /* 194 */
+ "MONITOREXIT ", /* 195 */
+ "WIDE ", /* WIDE 196 */
+ "MULTIANEWARRAY ", /* 197 */
+ "IFNULL ", /* 198 */
+ "IFNONNULL ", /* 199 */
+ "GOTO_W ", /* GOTO_W 200 */
+ "JSR_W ", /* JSR_W 201 */
+ "BREAKPOINT ", /* BREAKPOINT 202 */
+
+ "UNDEF203", "UNDEF204", "UNDEF205",
+ "UNDEF206", "UNDEF207", "UNDEF208", "UNDEF209", "UNDEF210",
+ "UNDEF211", "UNDEF212", "UNDEF213", "UNDEF214", "UNDEF215",
+ "UNDEF216", "UNDEF217", "UNDEF218", "UNDEF219", "UNDEF220",
+ "UNDEF221", "UNDEF222", "UNDEF223", "UNDEF224", "UNDEF225",
+ "UNDEF226", "UNDEF227", "UNDEF228", "UNDEF229", "UNDEF230",
+ "UNDEF231", "UNDEF232", "UNDEF233", "UNDEF234", "UNDEF235",
+ "UNDEF236", "UNDEF237", "UNDEF238", "UNDEF239", "UNDEF240",
+ "UNDEF241", "UNDEF242", "UNDEF243", "UNDEF244", "UNDEF245",
+ "UNDEF246", "UNDEF247", "UNDEF248", "UNDEF249", "UNDEF250",
+ "UNDEF251", "UNDEF252", "UNDEF253", "UNDEF254", "UNDEF255"
};
-#if defined(USEBUILTINTABLE)
-
-#if 0
-stdopdescriptor builtintable[] = {
- { ICMD_LCMP, TYPE_LONG, TYPE_LONG, TYPE_INT, ICMD_BUILTIN2,
- (functionptr) builtin_lcmp , SUPPORT_LONG && SUPPORT_LONG_CMP, false },
- { ICMD_LAND, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_land , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
- { ICMD_LOR, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
- { ICMD_LXOR, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lxor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
- { ICMD_LSHL, TYPE_LONG, TYPE_INT, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lshl , SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
- { ICMD_LSHR, TYPE_LONG, TYPE_INT, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lshr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
- { ICMD_LUSHR, TYPE_LONG, TYPE_INT, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lushr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
- { ICMD_LADD, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_ladd , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
- { ICMD_LSUB, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lsub , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
- { ICMD_LNEG, TYPE_LONG, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
- (functionptr) builtin_lneg, SUPPORT_LONG && SUPPORT_LONG_ADD, true },
- { ICMD_LMUL, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lmul , SUPPORT_LONG && SUPPORT_LONG_MUL, false },
- { ICMD_I2F, TYPE_INT, TYPE_VOID, TYPE_FLOAT, ICMD_BUILTIN1,
- (functionptr) builtin_i2f, SUPPORT_FLOAT && SUPPORT_IFCVT, true },
- { ICMD_I2D, TYPE_INT, TYPE_VOID, TYPE_DOUBLE, ICMD_BUILTIN1,
- (functionptr) builtin_i2d, SUPPORT_DOUBLE && SUPPORT_IFCVT, true },
- { ICMD_L2F, TYPE_LONG, TYPE_VOID, TYPE_FLOAT, ICMD_BUILTIN1,
- (functionptr) builtin_l2f, SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT, true },
- { ICMD_L2D, TYPE_LONG, TYPE_VOID, TYPE_DOUBLE, ICMD_BUILTIN1,
- (functionptr) builtin_l2d, SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT, true },
- { ICMD_F2L, TYPE_FLOAT, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
- (functionptr) builtin_f2l, SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_ICVT, true },
- { ICMD_D2L, TYPE_DOUBLE, TYPE_VOID, TYPE_LONG, ICMD_BUILTIN1,
- (functionptr) builtin_d2l, SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_ICVT, true },
- { ICMD_F2I, TYPE_FLOAT, TYPE_VOID, TYPE_INT, ICMD_BUILTIN1,
- (functionptr) builtin_f2i, SUPPORT_FLOAT && SUPPORT_FICVT, true },
- { ICMD_D2I, TYPE_DOUBLE, TYPE_VOID, TYPE_INT, ICMD_BUILTIN1,
- (functionptr) builtin_d2i, SUPPORT_DOUBLE && SUPPORT_FICVT, true },
- { 255, 0, 0, 0, 0, NULL, true, false },
-};
+/* jit_init ********************************************************************
-#endif
+ Initializes the JIT subsystem.
-static int builtintablelen;
+*******************************************************************************/
-#endif /* USEBUILTINTABLE */
+void jit_init(void)
+{
+ s4 i;
+#if defined(__ALPHA__)
+ has_ext_instr_set = ! has_no_x_instr_set();
+#endif
-/*****************************************************************************
- TABLE OF BUILTIN FUNCTIONS
+ for (i = 0; i < 256; i++)
+ stackreq[i] = 1;
- This table lists the builtin functions which are used inside
- BUILTIN* opcodes.
+ stackreq[JAVA_NOP] = 0;
+ stackreq[JAVA_ISTORE] = 0;
+ stackreq[JAVA_LSTORE] = 0;
+ stackreq[JAVA_FSTORE] = 0;
+ stackreq[JAVA_DSTORE] = 0;
+ stackreq[JAVA_ASTORE] = 0;
+ stackreq[JAVA_ISTORE_0] = 0;
+ stackreq[JAVA_ISTORE_1] = 0;
+ stackreq[JAVA_ISTORE_2] = 0;
+ stackreq[JAVA_ISTORE_3] = 0;
+ stackreq[JAVA_LSTORE_0] = 0;
+ stackreq[JAVA_LSTORE_1] = 0;
+ stackreq[JAVA_LSTORE_2] = 0;
+ stackreq[JAVA_LSTORE_3] = 0;
+ stackreq[JAVA_FSTORE_0] = 0;
+ stackreq[JAVA_FSTORE_1] = 0;
+ stackreq[JAVA_FSTORE_2] = 0;
+ stackreq[JAVA_FSTORE_3] = 0;
+ stackreq[JAVA_DSTORE_0] = 0;
+ stackreq[JAVA_DSTORE_1] = 0;
+ stackreq[JAVA_DSTORE_2] = 0;
+ stackreq[JAVA_DSTORE_3] = 0;
+ stackreq[JAVA_ASTORE_0] = 0;
+ stackreq[JAVA_ASTORE_1] = 0;
+ stackreq[JAVA_ASTORE_2] = 0;
+ stackreq[JAVA_ASTORE_3] = 0;
+ stackreq[JAVA_IASTORE] = 0;
+ stackreq[JAVA_LASTORE] = 0;
+ stackreq[JAVA_FASTORE] = 0;
+ stackreq[JAVA_DASTORE] = 0;
+ stackreq[JAVA_AASTORE] = 0;
+ stackreq[JAVA_BASTORE] = 0;
+ stackreq[JAVA_CASTORE] = 0;
+ stackreq[JAVA_SASTORE] = 0;
+ stackreq[JAVA_POP] = 0;
+ stackreq[JAVA_POP2] = 0;
+ stackreq[JAVA_IFEQ] = 0;
+ stackreq[JAVA_IFNE] = 0;
+ stackreq[JAVA_IFLT] = 0;
+ stackreq[JAVA_IFGE] = 0;
+ stackreq[JAVA_IFGT] = 0;
+ stackreq[JAVA_IFLE] = 0;
+ stackreq[JAVA_IF_ICMPEQ] = 0;
+ stackreq[JAVA_IF_ICMPNE] = 0;
+ stackreq[JAVA_IF_ICMPLT] = 0;
+ stackreq[JAVA_IF_ICMPGE] = 0;
+ stackreq[JAVA_IF_ICMPGT] = 0;
+ stackreq[JAVA_IF_ICMPLE] = 0;
+ stackreq[JAVA_IF_ACMPEQ] = 0;
+ stackreq[JAVA_IF_ACMPNE] = 0;
+ stackreq[JAVA_GOTO] = 0;
+ stackreq[JAVA_RET] = 0;
+ stackreq[JAVA_TABLESWITCH] = 0;
+ stackreq[JAVA_LOOKUPSWITCH] = 0;
+ stackreq[JAVA_IRETURN] = 0;
+ stackreq[JAVA_LRETURN] = 0;
+ stackreq[JAVA_FRETURN] = 0;
+ stackreq[JAVA_DRETURN] = 0;
+ stackreq[JAVA_ARETURN] = 0;
+ stackreq[JAVA_RETURN] = 0;
+ stackreq[JAVA_PUTSTATIC] = 0;
+ stackreq[JAVA_PUTFIELD] = 0;
+ stackreq[JAVA_MONITORENTER] = 0;
+ stackreq[JAVA_MONITOREXIT] = 0;
+ stackreq[JAVA_WIDE] = 0;
+ stackreq[JAVA_IFNULL] = 0;
+ stackreq[JAVA_IFNONNULL] = 0;
+ stackreq[JAVA_GOTO_W] = 0;
+ stackreq[JAVA_BREAKPOINT] = 0;
- The first part of the table (up to the 255-marker) lists the
- opcodes which are automatically replaced in stack.c.
+ /* we need one dummy stack slot for IINC in order to */
+ /* avoid that the modified local variable is */
+ /* kept on the stack (see stack.c, ICMD_IINC) */
+ stackreq[JAVA_IINC] = 1;
+
+ stackreq[JAVA_SWAP] = 2;
+ stackreq[JAVA_DUP2] = 2;
+ stackreq[JAVA_DUP_X1] = 3;
+ stackreq[JAVA_DUP_X2] = 4;
+ stackreq[JAVA_DUP2_X1] = 3;
+ stackreq[JAVA_DUP2_X2] = 4;
- The second part lists the builtin functions which are "manually"
- used for BUILTIN* opcodes in parse.c and stack.c.
+ /* initialize stack analysis subsystem */
-*****************************************************************************/
+ (void) stack_init();
-builtin_descriptor builtin_desc[] = {
-#if defined(USEBUILTINTABLE)
- {ICMD_LCMP , BUILTIN_lcmp ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_INT ,
- SUPPORT_LONG && SUPPORT_LONG_CMP,false,"lcmp"},
-
- {ICMD_LAND , BUILTIN_land ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_LOG,false,"land"},
- {ICMD_LOR , BUILTIN_lor ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_LOG,false,"lor"},
- {ICMD_LXOR , BUILTIN_lxor ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_LOG,false,"lxor"},
-
- {ICMD_LSHL , BUILTIN_lshl ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_INT ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_SHIFT,false,"lshl"},
- {ICMD_LSHR , BUILTIN_lshr ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_INT ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_SHIFT,false,"lshr"},
- {ICMD_LUSHR, BUILTIN_lushr,ICMD_BUILTIN2,TYPE_LONG ,TYPE_INT ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_SHIFT,false,"lushr"},
-
- {ICMD_LADD , BUILTIN_ladd ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_ADD,false,"ladd"},
- {ICMD_LSUB , BUILTIN_lsub ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_ADD,false,"lsub"},
- {ICMD_LNEG , BUILTIN_lneg ,ICMD_BUILTIN1,TYPE_LONG ,TYPE_VOID ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_ADD,false,"lneg"},
- {ICMD_LMUL , BUILTIN_lmul ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_MUL,false,"lmul"},
-
- {ICMD_I2F , BUILTIN_i2f ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_FLOAT ,
- SUPPORT_FLOAT && SUPPORT_IFCVT,true ,"i2f"},
- {ICMD_I2D , BUILTIN_i2d ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_DOUBLE,
- SUPPORT_DOUBLE && SUPPORT_IFCVT,true ,"i2d"},
- {ICMD_L2F , BUILTIN_l2f ,ICMD_BUILTIN1,TYPE_LONG ,TYPE_VOID ,TYPE_VOID ,TYPE_FLOAT ,
- SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT,true ,"l2f"},
- {ICMD_L2D , BUILTIN_l2d ,ICMD_BUILTIN1,TYPE_LONG ,TYPE_VOID ,TYPE_VOID ,TYPE_DOUBLE,
- SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT,true ,"l2d"},
- {ICMD_F2L , BUILTIN_f2l ,ICMD_BUILTIN1,TYPE_FLOAT ,TYPE_VOID ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_ICVT,true ,"f2l"},
- {ICMD_D2L , BUILTIN_d2l ,ICMD_BUILTIN1,TYPE_DOUBLE,TYPE_VOID ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_ICVT,true ,"d2l"},
- {ICMD_F2I , BUILTIN_f2i ,ICMD_BUILTIN1,TYPE_FLOAT ,TYPE_VOID ,TYPE_VOID ,TYPE_INT ,
- SUPPORT_FLOAT && SUPPORT_FICVT,true ,"f2i"},
- {ICMD_D2I , BUILTIN_d2i ,ICMD_BUILTIN1,TYPE_DOUBLE,TYPE_VOID ,TYPE_VOID ,TYPE_INT ,
- SUPPORT_DOUBLE && SUPPORT_FICVT,true ,"d2i"},
-#endif
+ /* initialize codegen subsystem */
- /* this record marks the end of the automatically replaced opcodes */
- {255,NULL,0,0,0,0,0,0,0,"<INVALID>"},
+ codegen_init();
+}
- /* the following functions are not replaced automatically */
-
-#if defined(__ALPHA__)
- {255, BUILTIN_f2l ,ICMD_BUILTIN1,TYPE_FLOAT ,TYPE_VOID ,TYPE_VOID ,TYPE_LONG ,0,0,"f2l"},
- {255, BUILTIN_d2l ,ICMD_BUILTIN1,TYPE_DOUBLE,TYPE_VOID ,TYPE_VOID ,TYPE_LONG ,0,0,"d2l"},
- {255, BUILTIN_f2i ,ICMD_BUILTIN1,TYPE_FLOAT ,TYPE_VOID ,TYPE_VOID ,TYPE_INT ,0,0,"f2i"},
- {255, BUILTIN_d2i ,ICMD_BUILTIN1,TYPE_DOUBLE,TYPE_VOID ,TYPE_VOID ,TYPE_INT ,0,0,"d2i"},
-#endif
- {255,BUILTIN_instanceof ,ICMD_BUILTIN2,TYPE_ADR ,TYPE_ADR ,TYPE_VOID ,TYPE_INT ,0,0,"instanceof"},
- {255,BUILTIN_arrayinstanceof ,ICMD_BUILTIN2,TYPE_ADR ,TYPE_ADR ,TYPE_VOID ,TYPE_INT ,0,0,"arrayinstanceof"},
- {255,BUILTIN_checkarraycast ,ICMD_BUILTIN2,TYPE_ADR ,TYPE_ADR ,TYPE_VOID ,TYPE_VOID ,0,0,"checkarraycast"},
- {255,BUILTIN_aastore ,ICMD_BUILTIN3,TYPE_ADR ,TYPE_INT ,TYPE_ADR ,TYPE_VOID ,0,0,"aastore"},
- {255,BUILTIN_new ,ICMD_BUILTIN1,TYPE_ADR ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"new"},
- {255,BUILTIN_newarray ,ICMD_BUILTIN2,TYPE_INT ,TYPE_ADR ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray"},
- {255,BUILTIN_newarray_boolean,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_boolean"},
- {255,BUILTIN_newarray_char ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_char"},
- {255,BUILTIN_newarray_float ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_float"},
- {255,BUILTIN_newarray_double ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_double"},
- {255,BUILTIN_newarray_byte ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_byte"},
- {255,BUILTIN_newarray_short ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_short"},
- {255,BUILTIN_newarray_int ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_int"},
- {255,BUILTIN_newarray_long ,ICMD_BUILTIN1,TYPE_INT ,TYPE_VOID ,TYPE_VOID ,TYPE_ADR ,0,0,"newarray_long"},
- {255,BUILTIN_monitorenter ,ICMD_BUILTIN1,TYPE_ADR ,TYPE_VOID ,TYPE_VOID ,TYPE_VOID ,0,0,"monitorenter"},
- {255,BUILTIN_monitorexit ,ICMD_BUILTIN1,TYPE_ADR ,TYPE_VOID ,TYPE_VOID ,TYPE_VOID ,0,0,"monitorexit"},
-#if !SUPPORT_DIVISION
- {255,BUILTIN_idiv ,ICMD_BUILTIN2,TYPE_INT ,TYPE_INT ,TYPE_VOID ,TYPE_INT ,0,0,"idiv"},
- {255,BUILTIN_irem ,ICMD_BUILTIN2,TYPE_INT ,TYPE_INT ,TYPE_VOID ,TYPE_INT ,0,0,"irem"},
-#endif
-#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
- {255,BUILTIN_ldiv ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,0,0,"ldiv"},
- {255,BUILTIN_lrem ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,0,0,"lrem"},
-#endif
- {255,BUILTIN_frem ,ICMD_BUILTIN2,TYPE_FLOAT ,TYPE_FLOAT ,TYPE_VOID ,TYPE_FLOAT ,0,0,"frem"},
- {255,BUILTIN_drem ,ICMD_BUILTIN2,TYPE_DOUBLE,TYPE_DOUBLE,TYPE_VOID ,TYPE_DOUBLE,0,0,"drem"},
+/* jit_close *******************************************************************
- /* this record marks the end of the list */
- { 0,NULL,0,0,0,0,0,0,0,"<END>"}
-};
+ Close the JIT subsystem.
-/* include compiler subsystems ************************************************/
+*******************************************************************************/
-/* from codegen.inc */
-extern int dseglen;
+void jit_close(void)
+{
+ /* do nothing */
+}
/* dummy function, used when there is no JavaVM code available */
-static void* do_nothing_function()
+static u1 *do_nothing_function(void)
{
return NULL;
}
/* jit_compile *****************************************************************
- jit_compile, new version of compiler, translates one method to machine code
+ jit_compile, new version of compiler, translates one method to machine code
*******************************************************************************/
-static methodptr jit_compile_intern(methodinfo *m);
+static u1 *jit_compile_intern(methodinfo *m, codegendata *cd, registerdata *rd,
+ loopdata *ld, t_inlining_globals *id);
-methodptr jit_compile(methodinfo *m)
+u1 *jit_compile(methodinfo *m)
{
- static bool jitrunning;
- methodptr r;
- s4 dumpsize;
- s8 starttime = 0;
- s8 stoptime = 0;
+ u1 *r;
+ codegendata *cd;
+ registerdata *rd;
+ loopdata *ld;
+ t_inlining_globals *id;
+ s4 dumpsize;
+
+ STATISTICS(count_jit_calls++);
#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
- compiler_lock();
-#else
- intsDisable(); /* disable interrupts */
-#endif
-#endif
+ /* enter a monitor on the method */
- if (opt_stat)
- count_jit_calls++;
+ builtin_monitorenter((java_objectheader *) m);
+#endif
/* if method has been already compiled return immediately */
if (m->entrypoint) {
#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
- compiler_unlock();
-#else
- intsRestore(); /* enable interrupts again */
-#endif
+ builtin_monitorexit((java_objectheader *) m);
#endif
return m->entrypoint;
}
- if (opt_stat)
- count_methods++;
-
- /* initialize the static function's class */
+ STATISTICS(count_methods++);
- if (m->flags & ACC_STATIC && !m->class->initialized) {
- if (initverbose)
- log_message_class("Initialize class ", m->class);
+#if defined(ENABLE_STATISTICS)
+ /* measure time */
- if (!class_init(m->class)) {
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
- compiler_unlock();
-#else
- intsRestore();
-#endif
+ if (getcompilingtime)
+ compilingtime_start();
#endif
- return NULL;
- }
- }
-
- if (jitrunning) {
- printf("current method=");
- utf_display_classname(method->class->name);printf(".");utf_display(method->name);
- printf(", new method=");
- utf_display_classname(m->class->name);printf(".");utf_display(m->name);
- printf("\n");
- panic("Compiler lock recursion");
- }
-
- /* now the jit is running */
-
- jitrunning = true;
/* mark start of dump memory area */
dumpsize = dump_size();
- /* measure time */
+ /* allocate memory */
+
+ cd = DNEW(codegendata);
+ rd = DNEW(registerdata);
+ ld = DNEW(loopdata);
+ id = DNEW(t_inlining_globals);
+
+#if defined(USE_INLINING)
+ /* RTA static analysis must be called before inlining */
+ if (opt_rt)
+ RT_jit_parse(m); /* will be called just once */
+ /* return value ignored for now */
+ /* XTA static analysis must be called before inlining */
+ if (opt_xta)
+ XTA_jit_parse(m); /* will be called just once */
+ /* return value ignored for now */
+
+ /* must be called before reg_setup, because it can change maxlocals */
+ /* init reqd to initialize for parse even in no inlining */
+ inlining_setup(m, id);
+#endif
- if (getcompilingtime)
- starttime = getcputime();
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (!opt_intrp)
+# endif
+ /* initialize the register allocator */
+ reg_setup(m, rd, id);
+#endif
+
+ /* setup the codegendata memory */
+ codegen_setup(m, cd, id);
/* now call internal compile function */
- r = jit_compile_intern(m);
+ r = jit_compile_intern(m, cd, rd, ld, id);
- if (r) {
- /* intermediate and assembly code listings */
-
- if (showintermediate)
- show_icmd_method();
- else if (showdisassemble)
- disassemble((void *) (m->mcode + dseglen), m->mcodelength - dseglen);
+ /* free some memory */
- if (showddatasegment)
- dseg_display((void *) (m->mcode));
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (!opt_intrp)
+# endif
+ codegen_free(m, cd);
+#endif
- if (compileverbose)
- log_message_method("Running: ", m);
- }
+ /* clear pointers to dump memory area */
+
+ m->basicblocks = NULL;
+ m->basicblockindex = NULL;
+ m->instructions = NULL;
+ m->stack = NULL;
+ /* NO !!! m->exceptiontable = NULL; */
/* release dump area */
dump_release(dumpsize);
+#if defined(ENABLE_STATISTICS)
/* measure time */
- if (getcompilingtime) {
- stoptime = getcputime();
- compilingtime += (stoptime - starttime);
- }
+ if (getcompilingtime)
+ compilingtime_stop();
+#endif
- jitrunning = false;
#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
- compiler_unlock();
-#else
- intsRestore();
-#endif
+ /* leave the monitor */
+
+ builtin_monitorexit((java_objectheader *) m );
#endif
+ if (r) {
+ if (compileverbose)
+ log_message_method("Running: ", m);
+ }
+
/* return pointer to the methods entry point */
return r;
}
-static methodptr jit_compile_intern(methodinfo *m)
-{
- /* if there is no javacode, print error message and return empty method */
+/* jit_compile_intern **********************************************************
- if (!m->jcode) {
- if (compileverbose)
- log_message_method("No code given for: ", m);
+ Static internal function which does the actual compilation.
- return (methodptr) do_nothing_function; /* return empty method */
- }
+*******************************************************************************/
+static u1 *jit_compile_intern(methodinfo *m, codegendata *cd, registerdata *rd,
+ loopdata *ld, t_inlining_globals *id)
+{
/* print log message for compiled method */
- if (compileverbose)
- log_message_method("Compiling: ", m);
+ DEBUG_JIT_COMPILEVERBOSE("Compiling: ");
-#if 0
/* initialize the static function's class */
- if (m->flags & ACC_STATIC && !m->class->initialized) {
+ if ((m->flags & ACC_STATIC) && !CLASS_IS_OR_ALMOST_INITIALIZED(m->class)) {
+#if !defined(NDEBUG)
if (initverbose)
log_message_class("Initialize class ", m->class);
+#endif
- if (!class_init(m->class))
+ if (!initialize_class(m->class))
return NULL;
}
-#endif
- /* initialisation of variables and subsystems */
+ /* handle native methods and create a native stub */
- isleafmethod = true;
-
- method = m;
- class = m->class;
- descriptor = m->descriptor;
- maxstack = m->maxstack;
- maxlocals = m->maxlocals;
- jcodelength = m->jcodelength;
- jcode = m->jcode;
- jlinenumbers = m->linenumbers;
- jlinenumbercount = m->linenumbercount;
- exceptiontablelength = m->exceptiontablelength;
- raw_extable = m->exceptiontable;
- regs_ok = false;
-
-#ifdef STATISTICS
- if (opt_stat) {
- count_tryblocks += exceptiontablelength;
- count_javacodesize += jcodelength + 18;
- count_javaexcsize += exceptiontablelength * POINTERSIZE;
- }
-#endif
+ if (m->flags & ACC_NATIVE) {
+ functionptr f;
- /* initialise parameter type descriptor */
+#if defined(ENABLE_STATICVM)
+ f = native_findfunction(m->class->name, m->name, m->descriptor,
+ (m->flags & ACC_STATIC));
+ if (!f)
+ return NULL;
+#else
- descriptor2types(m);
- mreturntype = m->returntype;
- mparamcount = m->paramcount;
- mparamtypes = m->paramtypes;
+ f = NULL;
+#endif
-#if defined(__I386__)
- /* we try to use these registers as scratch registers */
- if (m->exceptiontablelength > 0) {
- method_uses_ecx = true;
- method_uses_edx = true;
+ m->entrypoint = codegen_createnativestub(f, m);
- } else {
- method_uses_ecx = false;
- method_uses_edx = false;
+ return m->entrypoint;
}
-#endif
- /* call the compiler passes ***********************************************/
+ /* if there is no javacode, print error message and return empty method */
- /* must be called before reg_init, because it can change maxlocals */
- if (useinlining)
- inlining_init(m);
+ if (!m->jcode) {
+ DEBUG_JIT_COMPILEVERBOSE("No code given for: ");
- reg_setup();
+ m->entrypoint = (u1 *) (ptrint) do_nothing_function;
- codegen_init();
+ return m->entrypoint; /* return empty method */
+ }
- if (compileverbose)
- log_message_method("Parsing: ", m);
+ /* initialisation of variables and subsystems */
- if (!parse(m))
- return NULL;
+ m->isleafmethod = true;
- if (compileverbose) {
- log_message_method("Parsing done: ", m);
- log_message_method("Analysing: ", m);
+#if defined(ENABLE_STATISTICS)
+ if (opt_stat) {
+ count_tryblocks += m->exceptiontablelength;
+ count_javacodesize += m->jcodelength + 18;
+ count_javaexcsize += m->exceptiontablelength * SIZEOF_VOID_P;
}
+#endif
- if (!analyse_stack(m))
- return NULL;
-
- if (compileverbose)
- log_message_method("Analysing done: ", m);
+ /* initialise parameter type descriptor */
-#ifdef CACAO_TYPECHECK
- if (opt_verify) {
- if (compileverbose)
- log_message_method("Typechecking: ", m);
+ method_descriptor2types(m);
- if (!typecheck(m))
- return NULL;
+ /* call the compiler passes ***********************************************/
- if (compileverbose)
- log_message_method("Typechecking done: ", m);
- }
-#endif
-
- if (opt_loops) {
- depthFirst();
- analyseGraph();
- optimize_loops();
- }
-
-#ifdef SPECIALMEMUSE
- preregpass();
-#endif
+ DEBUG_JIT_COMPILEVERBOSE("Parsing: ");
- if (compileverbose)
- log_message_method("Allocating registers: ", m);
+ /* call parse pass */
- regalloc();
- regs_ok = true;
+ if (!parse(m, cd, id)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while parsing: ");
- if (compileverbose) {
- log_message_method("Allocating registers done: ", m);
- log_message_method("Generating code: ", m);
+ return NULL;
}
- codegen();
+ DEBUG_JIT_COMPILEVERBOSE("Parsing done: ");
+ DEBUG_JIT_COMPILEVERBOSE("Analysing: ");
- if (compileverbose)
- log_message_method("Generating code done: ", m);
+ /* call stack analysis pass */
- /* return pointer to the methods entry point */
+ if (!analyse_stack(m, cd, rd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while analysing: ");
- return m->entrypoint;
-}
+ return NULL;
+ }
+ DEBUG_JIT_COMPILEVERBOSE("Analysing done: ");
+#ifdef ENABLE_VERIFIER
+ if (opt_verify) {
+ DEBUG_JIT_COMPILEVERBOSE("Typechecking: ");
-/* functions for compiler initialisation and finalisation *********************/
+ /* call typecheck pass */
+ if (!typecheck(m, cd, rd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking: ");
-#ifdef USEBUILTINTABLE
+ return NULL;
+ }
-static int stdopcompare(const void *a, const void *b)
-{
- builtin_descriptor *o1 = (builtin_descriptor *) a;
- builtin_descriptor *o2 = (builtin_descriptor *) b;
- if (!o1->supported && o2->supported)
- return -1;
- if (o1->supported && !o2->supported)
- return 1;
- return (o1->opcode < o2->opcode) ? -1 : (o1->opcode > o2->opcode);
-}
+ DEBUG_JIT_COMPILEVERBOSE("Typechecking done: ");
+ }
+#endif
-static inline void sort_builtintable()
-{
- int len;
+ if (opt_loops) {
+ depthFirst(m, ld);
+ analyseGraph(m, ld);
+ optimize_loops(m, cd, ld);
+ }
- len = 0;
- while (builtin_desc[len].opcode != 255) len++;
- qsort(builtin_desc, len, sizeof(builtin_descriptor), stdopcompare);
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (!opt_intrp) {
+# endif
+ DEBUG_JIT_COMPILEVERBOSE("Allocating registers: ");
- for (--len; len>=0 && builtin_desc[len].supported; len--);
- builtintablelen = ++len;
-}
+ /* allocate registers */
+# if defined(ENABLE_LSRA)
+ if (opt_lsra) {
+ lsra(m, cd, rd, id);
+ STATISTICS(count_methods_allocated_by_lsra++);
-builtin_descriptor *find_builtin(int icmd)
-{
- builtin_descriptor *first = builtin_desc;
- builtin_descriptor *last = builtin_desc + builtintablelen;
- int len = last - first;
- int half;
- builtin_descriptor *middle;
-
- while (len > 0) {
- half = len / 2;
- middle = first + half;
- if (middle->opcode < icmd) {
- first = middle + 1;
- len -= half + 1;
} else
- len = half;
- }
- return first != last ? first : NULL;
-}
+# endif /* defined(ENABLE_LSRA) */
+ {
+ STATISTICS(count_locals_conflicts += (cd->maxlocals - 1) * (cd->maxlocals));
-#endif
+ regalloc(m, cd, rd);
+ }
+ STATISTICS(reg_make_statistics(m, cd, rd));
+ DEBUG_JIT_COMPILEVERBOSE("Allocating registers done: ");
+# if defined(ENABLE_INTRP)
+ }
+# endif
+#endif /* defined(ENABLE_JIT) */
-void jit_init()
-{
- s4 i;
+ DEBUG_JIT_COMPILEVERBOSE("Generating code: ");
-#ifdef USEBUILTINTABLE
- sort_builtintable();
-#endif
+ /* now generate the machine code */
-#if defined(__ALPHA__)
- has_ext_instr_set = ! has_no_x_instr_set();
-#endif
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp) {
+ if (!intrp_codegen(m, cd, rd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
- for (i = 0; i < 256; i++)
- stackreq[i] = 1;
+ return NULL;
+ }
+ } else
+# endif
+ {
+ if (!codegen(m, cd, rd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
+
+ return NULL;
+ }
+ }
+#else
+ if (!intrp_codegen(m, cd, rd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
- stackreq[JAVA_NOP] = 0;
- stackreq[JAVA_ISTORE] = 0;
- stackreq[JAVA_LSTORE] = 0;
- stackreq[JAVA_FSTORE] = 0;
- stackreq[JAVA_DSTORE] = 0;
- stackreq[JAVA_ASTORE] = 0;
- stackreq[JAVA_ISTORE_0] = 0;
- stackreq[JAVA_ISTORE_1] = 0;
- stackreq[JAVA_ISTORE_2] = 0;
- stackreq[JAVA_ISTORE_3] = 0;
- stackreq[JAVA_LSTORE_0] = 0;
- stackreq[JAVA_LSTORE_1] = 0;
- stackreq[JAVA_LSTORE_2] = 0;
- stackreq[JAVA_LSTORE_3] = 0;
- stackreq[JAVA_FSTORE_0] = 0;
- stackreq[JAVA_FSTORE_1] = 0;
- stackreq[JAVA_FSTORE_2] = 0;
- stackreq[JAVA_FSTORE_3] = 0;
- stackreq[JAVA_DSTORE_0] = 0;
- stackreq[JAVA_DSTORE_1] = 0;
- stackreq[JAVA_DSTORE_2] = 0;
- stackreq[JAVA_DSTORE_3] = 0;
- stackreq[JAVA_ASTORE_0] = 0;
- stackreq[JAVA_ASTORE_1] = 0;
- stackreq[JAVA_ASTORE_2] = 0;
- stackreq[JAVA_ASTORE_3] = 0;
- stackreq[JAVA_IASTORE] = 0;
- stackreq[JAVA_LASTORE] = 0;
- stackreq[JAVA_FASTORE] = 0;
- stackreq[JAVA_DASTORE] = 0;
- stackreq[JAVA_AASTORE] = 0;
- stackreq[JAVA_BASTORE] = 0;
- stackreq[JAVA_CASTORE] = 0;
- stackreq[JAVA_SASTORE] = 0;
- stackreq[JAVA_POP] = 0;
- stackreq[JAVA_POP2] = 0;
- stackreq[JAVA_IINC] = 0;
- stackreq[JAVA_IFEQ] = 0;
- stackreq[JAVA_IFNE] = 0;
- stackreq[JAVA_IFLT] = 0;
- stackreq[JAVA_IFGE] = 0;
- stackreq[JAVA_IFGT] = 0;
- stackreq[JAVA_IFLE] = 0;
- stackreq[JAVA_IF_ICMPEQ] = 0;
- stackreq[JAVA_IF_ICMPNE] = 0;
- stackreq[JAVA_IF_ICMPLT] = 0;
- stackreq[JAVA_IF_ICMPGE] = 0;
- stackreq[JAVA_IF_ICMPGT] = 0;
- stackreq[JAVA_IF_ICMPLE] = 0;
- stackreq[JAVA_IF_ACMPEQ] = 0;
- stackreq[JAVA_IF_ACMPNE] = 0;
- stackreq[JAVA_GOTO] = 0;
- stackreq[JAVA_RET] = 0;
- stackreq[JAVA_TABLESWITCH] = 0;
- stackreq[JAVA_LOOKUPSWITCH] = 0;
- stackreq[JAVA_IRETURN] = 0;
- stackreq[JAVA_LRETURN] = 0;
- stackreq[JAVA_FRETURN] = 0;
- stackreq[JAVA_DRETURN] = 0;
- stackreq[JAVA_ARETURN] = 0;
- stackreq[JAVA_RETURN] = 0;
- stackreq[JAVA_PUTSTATIC] = 0;
- stackreq[JAVA_PUTFIELD] = 0;
- stackreq[JAVA_MONITORENTER] = 0;
- stackreq[JAVA_MONITOREXIT] = 0;
- stackreq[JAVA_WIDE] = 0;
- stackreq[JAVA_IFNULL] = 0;
- stackreq[JAVA_IFNONNULL] = 0;
- stackreq[JAVA_GOTO_W] = 0;
- stackreq[JAVA_BREAKPOINT] = 0;
+ return NULL;
+ }
+#endif
- stackreq[JAVA_SWAP] = 2;
- stackreq[JAVA_DUP2] = 2;
- stackreq[JAVA_DUP_X1] = 3;
- stackreq[JAVA_DUP_X2] = 4;
- stackreq[JAVA_DUP2_X1] = 3;
- stackreq[JAVA_DUP2_X2] = 4;
+ DEBUG_JIT_COMPILEVERBOSE("Generating code done: ");
- reg_init();
- init_exceptions();
+#if !defined(NDEBUG)
+ /* intermediate and assembly code listings */
+
+ if (opt_showintermediate) {
+ show_icmd_method(m, cd, rd);
- /* initialize exceptions used in the system */
+ } else if (opt_showdisassemble) {
+ DISASSEMBLE(m->entrypoint,
+ m->entrypoint + (m->mcodelength - cd->dseglen));
+ }
- init_system_exceptions();
-}
+ if (opt_showddatasegment)
+ dseg_display(m, cd);
+#endif
+ DEBUG_JIT_COMPILEVERBOSE("Compiling done: ");
+ /* return pointer to the methods entry point */
-void jit_close()
-{
- codegen_close();
- reg_close();
-}
+ return m->entrypoint;
+}
/*