Unified variables changes for common/i386.
[cacao.git] / src / vm / jit / codegen-common.h
index 6a4132b700965c57cd47f24c48d17f73ed1417b2..81fb1d4477a3f989ccc36a1db65d0abcf973325d 100644 (file)
@@ -27,9 +27,9 @@
    Authors: Christian Thalinger
 
    Changes: Christian Ullrich
-                       Edwin Steiner
+            Edwin Steiner
 
-   $Id: codegen-common.h 4699 2006-03-28 14:52:32Z twisti $
+   $Id: codegen-common.h 5404 2006-09-07 13:29:05Z christian $
 
 */
 
@@ -40,7 +40,7 @@
 /* forward typedefs ***********************************************************/
 
 typedef struct codegendata codegendata;
-typedef struct threadcritnodetemp threadcritnodetemp;
+typedef struct codegen_critical_section_t codegen_critical_section_t;
 
 
 #include "config.h"
@@ -64,7 +64,7 @@ typedef struct threadcritnodetemp threadcritnodetemp;
 /* 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) )
@@ -75,8 +75,8 @@ typedef struct threadcritnodetemp threadcritnodetemp;
 
 /************************* critical sections  *********************************/
 
-struct threadcritnodetemp {
-       threadcritnodetemp *next;
+struct codegen_critical_section_t {
+       codegen_critical_section_t *next;
        s4                  mcodebegin;
        s4                  mcodeend;
        s4                  mcoderestart;
@@ -85,13 +85,10 @@ struct threadcritnodetemp {
 
 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       */
@@ -106,8 +103,7 @@ struct codegendata {
        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     */
 
@@ -131,23 +127,24 @@ struct codegendata {
        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 *********************************************************/
+
+typedef struct methodtree_element methodtree_element;
 
-struct _methodtree_element {
+struct methodtree_element {
        u1 *startpc;
        u1 *endpc;
 };
-#endif
 
 
 /* function prototypes ********************************************************/
@@ -157,61 +154,65 @@ void codegen_setup(jitdata *jd);
 
 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(jitdata *jd, s4 mcodelen);
+void codegen_finish(jitdata *jd);
 
 codeinfo *codegen_createnativestub(functionptr f, methodinfo *m);
-#if !defined(NDEBUG)
+#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, 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);
 
+#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);
+u1 *md_codegen_get_pv_from_pc(u1 *ra);
 
 bool codegen(jitdata *jd);