Changes: Christian Thalinger
- $Id: jit.h 868 2004-01-10 20:12:10Z edwin $
+ $Id: jit.h 1274 2004-07-05 17:24:40Z twisti $
*/
typedef struct jumpref jumpref;
typedef struct dataref dataref;
typedef varinfo *varinfoptr;
-
+typedef struct linenumberref linenumberref;
/************************** stack element structure ***************************/
/* slot types */
-/* XXX unified these with longer names. Maybe someday use only
+/* Unified these with longer names. Maybe someday use only
* one set of names? -Edwin
*/
/*#define TYPE_INT 0*/ /* the stack slot types must numbered in the */
/**************************** instruction structure ***************************/
struct instruction {
- stackptr dst; /* stack index of destination operand stack */
- u2 opc; /* opcode of intermediate code command */
- s4 op1; /* first operand, usually variable number */
- imm_union val; /* immediate constant */
- void *target; /* used for targets of branches and jumps */
- /* and as address for list of targets for */
- /* statements */
+ stackptr dst; /* stack index of destination operand stack */
+ u2 opc; /* opcode of intermediate code command */
+ s4 op1; /* first operand, usually variable number */
+ imm_union val; /* immediate constant */
+ void *target; /* used for targets of branches and jumps */
+ /* and as address for list of targets for */
+ /* statements */
+ u2 line; /* line number in source file */
+ methodinfo *method; /* needed for inlining. can't be done on */
+ /* basic block level, since an inlined */
+ /* function doesn't start necessarily start */
+ /* a new block */
};
int regoff; /* register number or memory offset */
};
-typedef varinfo varinfo5[5];
-
/***************** forward references in branch instructions ******************/
struct branchref {
s4 branchpos; /* patching position in code segment */
+ s4 reg; /* used for ArrayIndexOutOfBounds index reg */
branchref *next; /* next element in branchref list */
};
jumpref *next; /* next element in jumpref list */
};
+struct linenumberref {
+ s4 tablepos; /* patching position in data segment */
+ int targetmpc; /* machine code program counter of first instruction for given line*/
+ u2 linenumber; /* line number, used for inserting into the table and for validty checking*/
+ linenumberref *next; /* next element in linenumberref list */
+};
+
struct dataref {
u1 *pos; /* patching position in generated code */
#define ICMD_ICONST 3 /* val.i = constant */
#define JAVA_ICONST_1 4
-#define ICMD_IREM0X10001 4
#define JAVA_ICONST_2 5
#define ICMD_IDIVPOW2 5 /* val.i = constant */
#define JAVA_ICONST_4 7
#define JAVA_ICONST_5 8
-#define ICMD_LREM0X10001 8
#define JAVA_LCONST_0 9
#define ICMD_LCONST 9 /* val.l = constant */
#define JAVA_BREAKPOINT 202
+#define ICMD_CHECKEXCEPTION 203 /* check for an exception */
+
+#define ICMD_IASTORECONST 204
+
+#define ICMD_LASTORECONST 205
+
+#define ICMD_FASTORECONST 206
+
+#define ICMD_DASTORECONST 207
+
+#define ICMD_AASTORECONST 208
+
+#define ICMD_BASTORECONST 209
+
+#define ICMD_CASTORECONST 210
+
+#define ICMD_SASTORECONST 211
#define ICMD_BUILTIN3 253 /* internal opcode */
#define ICMD_BUILTIN2 254 /* internal opcode */
#if defined(USEBUILTINTABLE)
-/* XXX delete? */
-#if 0
-typedef struct {
- u1 opcode;
- u1 type_s1;
- u1 type_s2;
- u1 type_d;
- int icmd;
- functionptr builtin;
- bool supported;
- bool isfloat;
-} stdopdescriptor;
-
-
-extern stdopdescriptor builtintable[];
-
-stdopdescriptor *find_builtin(int icmd);
-#endif
-
builtin_descriptor *find_builtin(int opcode);
#endif /* USEBUILTINTABLE */
extern int nreg_parammode;
-/* compiler switches (set by main function) ***********************************/
-
-extern int count_jit_calls;
-extern int count_methods;
-extern int count_spills;
-extern int count_pcmd_activ;
-extern int count_pcmd_drop;
-extern int count_pcmd_zero;
-extern int count_pcmd_const_store;
-extern int count_pcmd_const_alu;
-extern int count_pcmd_const_bra;
-extern int count_pcmd_load;
-extern int count_pcmd_move;
-extern int count_load_instruction;
-extern int count_pcmd_store;
-extern int count_pcmd_store_comb;
-extern int count_dup_instruction;
-extern int count_pcmd_op;
-extern int count_pcmd_mem;
-extern int count_pcmd_met;
-extern int count_pcmd_bra;
-extern int count_pcmd_table;
-extern int count_pcmd_return;
-extern int count_pcmd_returnx;
-extern int count_check_null;
-extern int count_check_bound;
-extern int count_max_basic_blocks;
-extern int count_basic_blocks;
-extern int count_max_javainstr;
-extern int count_javainstr;
-extern int count_javacodesize;
-extern int count_javaexcsize;
-extern int count_calls;
-extern int count_tryblocks;
-extern int count_code_len;
-extern int count_data_len;
-extern int count_cstub_len;
-extern int count_nstub_len;
-extern int count_max_new_stack;
-extern int count_upper_bound_new_stack;
-extern int *count_block_stack;
-extern int *count_analyse_iterations;
-extern int *count_method_bb_distribution;
-extern int *count_block_size_distribution;
-extern int *count_store_length;
-extern int *count_store_depth;
-
-
-/* global compiler variables */
-
-extern classinfo *class; /* class the compiled method belongs to */
-extern methodinfo *method; /* pointer to method info of compiled method */
-extern int mparamcount; /* number of parameters (incl. this) */
-extern u1 *mparamtypes; /* types of all parameters (TYPE_INT, ...) */
-
-extern int maxstack; /* maximal JavaVM stack size */
-extern int maxlocals; /* maximal number of local JavaVM variables */
-extern int jcodelength; /* length of JavaVM-codes */
-extern u1 *jcode; /* pointer to start of JavaVM-code */
-extern int exceptiontablelength;/* length of exception table */
-extern xtable *extable; /* pointer to start of exception table */
-extern exceptiontable *raw_extable;
-
-extern int block_count; /* number of basic blocks */
-extern basicblock *block; /* points to basic block array */
-extern 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 */
-
-extern int instr_count; /* number of JavaVM instructions */
-extern instruction *instr; /* points to intermediate code instructions */
-
-extern int stack_count; /* number of stack elements */
-extern stackelement *stack; /* points to intermediate code instructions */
-
-extern bool isleafmethod; /* true if a method doesn't call subroutines */
-
-extern basicblock *last_block; /* points to the end of the BB list */
-
-extern bool regs_ok; /* true if registers have been allocated */
-
-
-/* list of all classes used by the compiled method which have to be */
-/* initialised (if not already done) before execution of this method */
-extern chain *uninitializedclasses;
-
extern int stackreq[256];
void removecompilerstub(u1 *stub);
void removenativestub(u1 *stub);
-void typecheck();
-
-/* debug helpers (in stack.c) */
-
-void icmd_print_stack(stackptr s);
-char *icmd_builtin_name(functionptr bptr);
-void show_icmd_block(basicblock *bptr);
-void show_icmd(instruction *iptr,bool deadcode);
-void show_icmd_method();
-
#endif /* _JIT_H */