Changes: Christian Thalinger
- $Id: jit.h 665 2003-11-21 18:36:43Z jowenn $
+ $Id: jit.h 760 2003-12-13 22:38:03Z twisti $
*/
#include "toolbox/chain.h"
#include "global.h"
+#include "builtin.h"
+#include "typeinfo.h"
/**************************** resolve typedef-cycles **************************/
/* slot types */
-#define TYPE_INT 0 /* the stack slot types must numbered in the */
-#define TYPE_LNG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
-#define TYPE_FLT 2 /* instructions (LOAD and STORE) */
-#define TYPE_DBL 3 /* integer, long, float, double, address */
-#define TYPE_ADR 4
+/* XXX 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 */
+#define TYPE_LNG TYPE_LONG /*1*/ /* same order as the ICMD_Ixxx to ICMD_Axxx */
+#define TYPE_FLT TYPE_FLOAT /*2*/ /* instructions (LOAD and STORE) */
+#define TYPE_DBL TYPE_DOUBLE /*3*/ /* integer, long, float, double, address */
+#define TYPE_ADR TYPE_ADDRESS /*4*/
#define IS_INT_LNG_TYPE(a) (!((a)&TYPE_FLT))
#define IS_FLT_DBL_TYPE(a) ((a)&TYPE_FLT)
struct stackelement {
stackptr prev; /* pointer to next element towards bottom */
int type; /* slot type of stack element */
+#ifdef CACAO_TYPECHECK
+ typeinfo typeinfo; /* info on reference types */
+#endif
int flags; /* flags (SAVED, INMEMORY) */
int varkind; /* kind of variable or register */
int varnum; /* number of variable */
stackptr dst; /* stack index of destination operand stack */
u2 opc; /* opcode of intermediate code command */
s4 op1; /* first operand, usually variable number */
-
- union {
- s4 i; /* integer operand */
- s8 l; /* long operand */
- float f; /* float operand */
- double d; /* double operand */
- void *a; /* address operand */
- } val; /* immediate constant */
-
+ imm_union val; /* immediate constant */
void *target; /* used for targets of branches and jumps */
/* and as address for list of targets for */
/* statements */
#define BBUNDEF -1
#define BBREACHED 0
#define BBFINISHED 1
+#define BBTYPECHECK_UNDEF 2
+#define BBTYPECHECK_REACHED 3
#define BBTYPE_STD 0 /* standard basic block type */
#define BBTYPE_EXH 1 /* exception handler basic block type */
#if defined(USEBUILTINTABLE)
+/* XXX delete? */
+#if 0
typedef struct {
u1 opcode;
u1 type_s1;
extern stdopdescriptor builtintable[];
stdopdescriptor *find_builtin(int icmd);
+#endif
+
+builtin_descriptor *find_builtin(int opcode);
#endif /* USEBUILTINTABLE */
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];
+#if defined(__I386__)
+extern bool method_uses_ecx;
+extern bool method_uses_edx;
+#endif
+
+
/* function prototypes */
methodptr jit_compile (methodinfo *m); /* compile a method with jit compiler */
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 */