Authors: Christian Thalinger
Changes: Christian Ullrich
- Edwin Steiner
+ Edwin Steiner
- $Id: codegen-common.h 4615 2006-03-15 16:36:43Z twisti $
+ $Id: codegen-common.h 5404 2006-09-07 13:29:05Z christian $
*/
/* forward typedefs ***********************************************************/
typedef struct codegendata codegendata;
-typedef struct threadcritnodetemp threadcritnodetemp;
+typedef struct codegen_critical_section_t codegen_critical_section_t;
#include "config.h"
/* Register Pack/Unpack Macros ************************************************/
/* ATTENTION: Don't change the order where low and high bits are
- stored! At least mips32 relys in one case on that order. */
+ stored! At least mips32 relies in one case on that order. */
#define PACK_REGS(low,high) \
( (((high) & 0x0000ffff) << 16) | ((low) & 0x0000ffff) )
/************************* critical sections *********************************/
-struct threadcritnodetemp {
- threadcritnodetemp *next;
+struct codegen_critical_section_t {
+ codegen_critical_section_t *next;
s4 mcodebegin;
s4 mcodeend;
s4 mcoderestart;
struct codegendata {
u1 *mcodebase; /* base pointer of code area */
- s4 *mcodeend; /* pointer to end of code area */
+ u1 *mcodeend; /* pointer to end of code area */
s4 mcodesize; /* complete size of code area (bytes) */
u1 *mcodeptr; /* code generation pointer */
-
-#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(ENABLE_INTRP)
u1 *lastmcodeptr; /* last patcher position of basic block */
-#endif
#if defined(ENABLE_INTRP)
u1 *ncodebase; /* base pointer of native code area */
struct superstart *superstarts; /* list of supers without patchers */
#endif
- u1 *dsegtop; /* pointer to top (end) of data area */
- s4 dsegsize; /* complete size of data area (bytes) */
+ dsegentry *dseg; /* chain of data segment entries */
s4 dseglen; /* used size of data area (bytes) */
/* data area grows from top to bottom */
s4 linenumbertab;
methodinfo *method;
- codeinfo *code;
s4 exceptiontablelength; /* exceptiontable length */
exceptiontable *exceptiontable; /* the exceptiontable */
- threadcritnodetemp *threadcrit; /* List of critical code regions */
- threadcritnodetemp threadcritcurrent;
+ codegen_critical_section_t *threadcrit; /* List of critical code regions */
+ codegen_critical_section_t threadcritcurrent;
s4 threadcritcount; /* Number of critical regions */
s4 maxstack;
s4 maxlocals;
+ s4 stackframesize; /* stackframe size of this method */
};
-#if defined(__I386__) || defined(__X86_64__) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
-typedef struct _methodtree_element methodtree_element;
+/* methodtree_element *********************************************************/
-struct _methodtree_element {
+typedef struct methodtree_element methodtree_element;
+
+struct methodtree_element {
u1 *startpc;
u1 *endpc;
};
-#endif
/* function prototypes ********************************************************/
void codegen_init(void);
-void codegen_setup(methodinfo *m, codegendata *cd);
+void codegen_setup(jitdata *jd);
-void codegen_free(methodinfo *m, codegendata *cd);
void codegen_close(void);
-s4 *codegen_increase(codegendata *cd, u1 *mcodeptr);
+void codegen_increase(codegendata *cd);
#if defined(ENABLE_INTRP)
u1 *codegen_ncode_increase(codegendata *cd, u1 *ncodeptr);
#endif
-void codegen_addreference(codegendata *cd, basicblock *target, void *branchptr);
+void codegen_addreference(codegendata *cd, basicblock *target);
-void codegen_add_arithmeticexception_ref(codegendata *cd, void *branchptr);
-void codegen_add_arrayindexoutofboundsexception_ref(codegendata *cd,
- void *branchptr, s4 reg);
-void codegen_add_arraystoreexception_ref(codegendata *cd, void *branchptr);
-void codegen_add_classcastexception_ref(codegendata *cd, void *branchptr);
-void codegen_add_nullpointerexception_ref(codegendata *cd, void *branchptr);
-void codegen_add_fillinstacktrace_ref(codegendata *cd, void *branchptr);
+void codegen_add_arithmeticexception_ref(codegendata *cd);
+void codegen_add_arrayindexoutofboundsexception_ref(codegendata *cd, s4 reg);
+void codegen_add_arraystoreexception_ref(codegendata *cd);
+void codegen_add_classcastexception_ref(codegendata *cd, s4 reg);
+void codegen_add_nullpointerexception_ref(codegendata *cd);
+void codegen_add_fillinstacktrace_ref(codegendata *cd);
-void codegen_addpatchref(codegendata *cd, voidptr branchptr,
- functionptr patcher, voidptr ref, s4 disp);
+void codegen_addpatchref(codegendata *cd, functionptr patcher, voidptr ref,
+ s4 disp);
void codegen_insertmethod(u1 *startpc, u1 *endpc);
-u1 *codegen_findmethod(u1 *pc);
+u1 *codegen_get_pv_from_pc(u1 *pc);
+u1 *codegen_get_pv_from_pc_nocheck(u1 *pc);
-void codegen_finish(methodinfo *m, codegendata *cd, s4 mcodelen);
+void codegen_finish(jitdata *jd);
codeinfo *codegen_createnativestub(functionptr f, methodinfo *m);
+#if defined(ENABLE_DISASSEMBLER)
void codegen_disassemble_nativestub(methodinfo *m, u1 *start, u1 *end);
+#endif
void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra);
-void codegen_finish_native_call(u1 *datasp);
+java_objectheader *codegen_finish_native_call(u1 *datasp);
u1 *createcompilerstub(methodinfo *m);
-u1 *createnativestub(functionptr f, methodinfo *m, codegendata *cd,
- registerdata *rd, methoddesc *md);
+u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd);
#if defined(ENABLE_INTRP)
u1 *intrp_createcompilerstub(methodinfo *m);
-u1 *intrp_createnativestub(functionptr f, methodinfo *m, codegendata *cd,
- registerdata *rd, methoddesc *md);
+u1 *intrp_createnativestub(functionptr f, jitdata *jd, methoddesc *md);
#endif
void removecompilerstub(u1 *stub);
void removenativestub(u1 *stub);
-s4 reg_of_var(registerdata *rd, stackptr v, s4 tempregnum);
+#if defined(NEW_VAR)
+s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum);
+#else
+s4 codegen_reg_of_var(registerdata *rd, u2 opcode, stackptr v, s4 tempregnum);
+#endif
+s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum);
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
void codegen_threadcritrestart(codegendata *cd, int offset);
void codegen_threadcritstart(codegendata *cd, int offset);
void codegen_threadcritstop(codegendata *cd, int offset);
#endif
/* machine dependent functions */
-u1 *md_codegen_findmethod(u1 *ra);
-bool codegen(methodinfo *m, codegendata *cd, registerdata *rd);
+u1 *md_codegen_get_pv_from_pc(u1 *ra);
+
+bool codegen(jitdata *jd);
#if defined(ENABLE_INTRP)
-bool intrp_codegen(methodinfo *m, codegendata *cd, registerdata *rd);
+bool intrp_codegen(jitdata *jd);
#endif
#endif /* _CODEGEN_COMMON_H */