GNU header update.
[cacao.git] / src / vm / jit / codegen.inc.h
index 55986c58f9c15d56999f959d64f576ec969695a1..b11c552e081705902ff9b3629ff833aa395bf237 100644 (file)
@@ -1,9 +1,9 @@
 /* jit/codegen.inc.h - code generation header
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
+   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+   Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: codegen.inc.h 1565 2004-11-23 15:56:37Z twisti $
+   $Id: codegen.inc.h 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
@@ -47,9 +47,10 @@ typedef struct threadcritnodetemp threadcritnodetemp;
 
 
 #include "types.h"
-#include "global.h"
-#include "jit/inline.h"
-#include "jit/reg.h"
+#include "vm/global.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/reg.h"
+#include "vm/jit/inline/inline.h"
 
 
 #define MCODEINITSIZE (1<<15)       /* 32 Kbyte code area initialization size */
@@ -66,58 +67,61 @@ typedef struct threadcritnodetemp threadcritnodetemp;
 
 struct threadcritnodetemp {
        threadcritnodetemp *next;
-       s4 mcodebegin;
-       s4 mcodeend;
-       s4 mcoderestart;
+       s4                  mcodebegin;
+       s4                  mcodeend;
+       s4                  mcoderestart;
 };
 
 
 struct codegendata {
-       u1 *mcodebase;                  /* base pointer of code area              */
-       s4 *mcodeend;                   /* pointer to end of code area            */
-       s4  mcodesize;                  /* complete size of code area (bytes)     */
+       u1             *mcodebase;      /* base pointer of code area              */
+       s4             *mcodeend;       /* pointer to end of code area            */
+       s4              mcodesize;      /* complete size of code area (bytes)     */
 
-       u1 *mcodeptr;                   /* code generation pointer                */
+#if defined(__I386__) || defined(__X86_64__)
+       u1             *mcodeptr;       /* code generation pointer                */
+#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)         */
+       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)         */
                                     /* data area grows from top to bottom     */
 
-       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 *xdivrefs;            /* list of divide by zero branches        */
-       branchref *xexceptionrefs;      /* list of exception branches             */
-       clinitref *clinitrefs;
-
-       linenumberref *linenumberreferences; /* list of line numbers and the      */
+       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      *xdivrefs;       /* list of divide by zero branches        */
+       branchref      *xexceptionrefs; /* list of exception branches             */
+       clinitref      *clinitrefs;
+
+       linenumberref  *linenumberreferences; /* list of line numbers and the     */
                                        /* program counters of their first        */
                                        /* instruction                            */
-       s4 linenumbertablesizepos;
-       s4 linenumbertablestartpos;
-       s4 linenumbertab;
+       s4              linenumbertablesizepos;
+       s4              linenumbertablestartpos;
+       s4              linenumbertab;
 
-       methodinfo *method;
-        s4  exceptiontablelength;/* exceptiontable length                  */
-        exceptiontable *exceptiontable; /* the exceptiontable                     */
+       methodinfo     *method;
+       s4              exceptiontablelength; /* exceptiontable length            */
+       exceptiontable *exceptiontable; /* the exceptiontable                     */
 
        threadcritnodetemp *threadcrit; /* List of critical code regions          */
        threadcritnodetemp threadcritcurrent;
-       s4 threadcritcount;             /* Number of critical regions             */
-        int maxstack;
-        int maxlocals;
+       s4                 threadcritcount; /* Number of critical regions         */
+
+       s4              maxstack;
+       s4              maxlocals;
 };
 
 
 /***************** forward references in branch instructions ******************/
 
 struct branchref {
-       s4 branchpos;               /* patching position in code segment          */
-       s4 reg;                     /* used for ArrayIndexOutOfBounds index reg   */
+       s4         branchpos;       /* patching position in code segment          */
+       s4         reg;             /* used for ArrayIndexOutOfBounds index reg   */
        branchref *next;            /* next element in branchref list             */
 };
 
@@ -125,14 +129,14 @@ struct branchref {
 /******************** forward references in tables  ***************************/
 
 struct jumpref {
-       s4 tablepos;                /* patching position in data segment          */
-       struct basicblock *target;  /* target basic block                         */
-       jumpref *next;              /* next element in jumpref list               */
+       s4          tablepos;       /* patching position in data segment          */
+       basicblock *target;         /* target basic block                         */
+       jumpref    *next;           /* next element in jumpref list               */
 };
 
 
 struct dataref {
-       u1 *pos;                    /* patching position in generated code        */
+       u1      *pos;               /* patching position in generated code        */
        dataref *next;              /* next element in dataref list               */
 };
 
@@ -140,20 +144,15 @@ struct dataref {
 struct clinitref {
        s4         branchpos;
        classinfo *class;
-       u4         mcode;
-#if defined(__I386__) || defined(__X86_64__)
-       u1         xmcode;
-       u1        *mcodeptr;        /* codegendata dummy pointer to generate code */
-#endif
        clinitref *next;
 };
 
 
 struct linenumberref {
-       s4 tablepos;                /* patching position in data segment          */
-       int targetmpc;              /* machine code program counter of first      */
+       s4             tablepos;    /* patching position in data segment          */
+       s4             targetmpc;   /* machine code program counter of first      */
                                    /* instruction for given line                 */
-       u2 linenumber;              /* line number, used for inserting into the   */
+       u2             linenumber;  /* line number, used for inserting into the   */
                                    /* table and for validty checking             */
        linenumberref *next;        /* next element in linenumberref list         */
 };
@@ -169,7 +168,7 @@ struct _methodtree_element {
 #endif
 
 
-/* function prototypes */
+/* function prototypes ********************************************************/
 
 void codegen_init();
 void codegen_setup(methodinfo *m, codegendata *cd, t_inlining_globals *e);
@@ -178,10 +177,17 @@ void codegen_free(methodinfo *m, codegendata *cd);
 void codegen_close();
 void codegen_insertmethod(functionptr startpc, functionptr endpc);
 
+#if defined(__I386__) || defined(__X86_64__)
+functionptr codegen_findmethod(functionptr pc);
+#elif defined(__ALPHA__)
+void *codegen_findmethod(void *returnAdress);
+#endif
+
 #if defined(__I386__) || defined(__X86_64__)
 void codegen_addreference(codegendata *cd, struct basicblock *target, void *branchptr);
 #endif
 
+
 void dseg_display(methodinfo *m, codegendata *cd);
 
 void init_exceptions();