* gen_inst: Use lastmcodeptr instead of last_compiled.
[cacao.git] / src / vm / jit / codegen.inc.h
index 5d7aea8ccfa7e255e10b18adfda91e70825fdfa2..4cdeb48005d0379aa11b4be27a026ac53ef577a2 100644 (file)
@@ -26,9 +26,9 @@
 
    Authors: Christian Thalinger
 
-   Changes:
+   Changes: Christian Ullrich
 
-   $Id: codegen.inc.h 2983 2005-07-11 11:56:49Z twisti $
+   $Id: codegen.inc.h 3778 2005-11-23 22:36:14Z twisti $
 
 */
 
@@ -48,7 +48,9 @@ typedef struct linenumberref linenumberref;
 typedef struct threadcritnodetemp threadcritnodetemp;
 
 
-#include "types.h"
+#include "config.h"
+#include "vm/types.h"
+
 #include "vm/global.h"
 #include "vm/references.h"
 #include "vm/method.h"
@@ -60,6 +62,7 @@ typedef struct threadcritnodetemp threadcritnodetemp;
 #define MCODEINITSIZE (1<<15)       /* 32 Kbyte code area initialization size */
 #define DSEGINITSIZE  (1<<12)       /*  4 Kbyte data area initialization size */
 
+
 /* Register Pack/Unpack Macros ************************************************/
 
 #define GET_LOW_REG(a)  (((a) & 0xffff0000) >> 16)
@@ -91,10 +94,14 @@ struct codegendata {
        s4             *mcodeend;       /* pointer to end of code area            */
        s4              mcodesize;      /* complete size of code area (bytes)     */
 
-#if defined(__I386__) || defined(__X86_64__)
+#if defined(__I386__) || defined(__X86_64__) || defined(ENABLE_INTRP)
        u1             *mcodeptr;       /* code generation pointer                */
 #endif
 
+#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(ENABLE_INTRP)
+       u1             *lastmcodeptr;   /* last patcher position of basic block   */
+#endif
+
        u1             *dsegtop;        /* pointer to top (end) of data area      */
        s4              dsegsize;       /* complete size of data area (bytes)     */
        s4              dseglen;        /* used size of data area (bytes)         */
@@ -103,7 +110,6 @@ struct codegendata {
        jumpref        *jumpreferences; /* list of jumptable target addresses     */
        dataref        *datareferences; /* list of data segment references        */
        branchref      *xboundrefs;     /* list of bound check branches           */
-       branchref      *xcheckarefs;    /* list of array size check branches      */
        branchref      *xnullrefs;      /* list of null check branches            */
        branchref      *xcastrefs;      /* list of cast check branches            */
        branchref      *xstorerefs;     /* list of array store check branches     */
@@ -160,6 +166,7 @@ struct patchref {
        functionptr  patcher;
        voidptr      ref;
        patchref    *next;
+       s4           disp;
 };
 
 
@@ -173,12 +180,12 @@ struct linenumberref {
 };
 
 
-#if defined(__I386__) || defined(__X86_64__)
+#if defined(__I386__) || defined(__X86_64__) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
 typedef struct _methodtree_element methodtree_element;
 
 struct _methodtree_element {
-       functionptr startpc;
-       functionptr endpc;
+       u1 *startpc;
+       u1 *endpc;
 };
 #endif
 
@@ -187,12 +194,12 @@ struct _methodtree_element {
 
 void codegen_init(void);
 void codegen_setup(methodinfo *m, codegendata *cd, t_inlining_globals *e);
-void codegen(methodinfo *m, codegendata *cd, registerdata *rd);
+bool codegen(methodinfo *m, codegendata *cd, registerdata *rd);
 void codegen_free(methodinfo *m, codegendata *cd);
-void codegen_close();
-void codegen_insertmethod(functionptr startpc, functionptr endpc);
+void codegen_close(void);
+void codegen_insertmethod(u1 *startpc, u1 *endpc);
 
-functionptr codegen_findmethod(functionptr pc);
+u1 *codegen_findmethod(u1 *pc);
 
 #if defined(__I386__) || defined(__X86_64__)
 void codegen_addreference(codegendata *cd, struct basicblock *target, void *branchptr);
@@ -200,17 +207,21 @@ void codegen_addreference(codegendata *cd, struct basicblock *target, void *bran
 
 void dseg_display(methodinfo *m, codegendata *cd);
 
-functionptr codegen_createnativestub(functionptr f, methodinfo *m);
-void codegen_disassemble_nativestub(methodinfo *m, s4 *code, s4 len);
+u1 *codegen_createnativestub(functionptr f, methodinfo *m);
+void codegen_disassemble_nativestub(methodinfo *m, u1 *start, u1 *end);
+
+void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra);
+void codegen_finish_native_call(u1 *datasp);
 
-void init_exceptions();
+u1 *createcompilerstub(methodinfo *m);
+u1 *createnativestub(functionptr f, methodinfo *m, codegendata *cd,
+                                        registerdata *rd, methoddesc *md);
 
-functionptr createcompilerstub(methodinfo *m);
-functionptr createnativestub(functionptr f, methodinfo *m, codegendata *cd,
-                                                        registerdata *rd, methoddesc *md);
+void removecompilerstub(u1 *stub);
+void removenativestub(u1 *stub);
 
-void removecompilerstub(functionptr stub);
-void removenativestub(functionptr stub);
+/* machine dependent find method function */
+u1 *md_codegen_findmethod(u1 *ra);
 
 #endif /* _CODEGEN_INC_H */