* Removed all Id tags.
[cacao.git] / src / vm / jit / codegen-common.h
index 6ade02195ee26d8349036a1d907f63017c91a4f5..a571b71034273864c0b03b85b5565d17bec3be54 100644 (file)
@@ -22,8 +22,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen-common.h 7692 2007-04-12 14:47:24Z twisti $
-
 */
 
 
 
 /* forward typedefs ***********************************************************/
 
-typedef struct codegen_critical_section_t codegen_critical_section_t;
-typedef struct codegendata                codegendata;
-typedef struct branchref                  branchref;
-typedef struct branch_label_ref_t         branch_label_ref_t;
-typedef struct jumpref                    jumpref;
-typedef struct dataref                    dataref;
-typedef struct exceptionref               exceptionref;
-typedef struct patchref                   patchref;
-typedef struct linenumberref              linenumberref;
+typedef struct codegendata            codegendata;
+typedef struct branchref              branchref;
+typedef struct branch_label_ref_t     branch_label_ref_t;
+typedef struct critical_section_ref_t critical_section_ref_t;
+typedef struct jumpref                jumpref;
+typedef struct dataref                dataref;
+typedef struct exceptionref           exceptionref;
+typedef struct patchref               patchref;
+typedef struct linenumberref          linenumberref;
 
 
 #include "config.h"
@@ -101,17 +99,6 @@ typedef struct linenumberref              linenumberref;
 #define BRANCH_OPT_NONE         0
 
 
-
-/************************* critical sections  *********************************/
-
-struct codegen_critical_section_t {
-       codegen_critical_section_t *next;
-       s4                  mcodebegin;
-       s4                  mcodeend;
-       s4                  mcoderestart;
-};
-
-
 /* codegendata ****************************************************************/
 
 struct codegendata {
@@ -145,9 +132,10 @@ struct codegendata {
        dataref        *datareferences; /* list of data segment references        */
 #endif
 
-/*     list           *patchrefs; */
+/*     list_t         *patchrefs; */
        patchref       *patchrefs;
-       list           *brancheslabel;
+       list_t         *brancheslabel;
+       list_t         *listcritical;   /* list of critical sections              */
 
        linenumberref  *linenumberreferences; /* list of line numbers and the     */
                                        /* program counters of their first        */
@@ -158,11 +146,6 @@ struct codegendata {
 
        methodinfo     *method;
 
-       codegen_critical_section_t *threadcrit; /* List of critical code regions          */
-       codegen_critical_section_t threadcritcurrent;
-       s4                 threadcritcount; /* Number of critical regions         */
-
-       s4              maxstack;
        s4              stackframesize;    /* stackframe size of this method      */
 
 #if defined(ENABLE_REPLACEMENT)
@@ -201,7 +184,17 @@ struct branch_label_ref_t {
        s4         condition;       /* conditional branch condition               */
        s4         reg;             /* register number to check                   */
        u4         options;         /* branch options                             */
-       listnode   linkage;
+       listnode_t linkage;
+};
+
+
+/* critical_section_ref_t *****************************************************/
+
+struct critical_section_ref_t {
+       s4         start;           /* relative offset to method entry-point      */
+       s4         end;
+       s4         restart;
+       listnode_t linkage;
 };
 
 
@@ -330,20 +323,33 @@ void removecompilerstub(u1 *stub);
 void removenativestub(u1 *stub);
 
 void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra);
-java_objectheader *codegen_finish_native_call(u1 *datasp);
+java_object_t *codegen_finish_native_call(u1 *datasp);
 
 s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum);
 s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum);
 
 #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);
+void codegen_critical_section_new(codegendata *cd);
+void codegen_critical_section_start(codegendata *cd);
+void codegen_critical_section_end(codegendata *cd);
+
+# define CODEGEN_CRITICAL_SECTION_NEW      codegen_critical_section_new(cd)
+# define CODEGEN_CRITICAL_SECTION_START    codegen_critical_section_start(cd)
+# define CODEGEN_CRITICAL_SECTION_END      codegen_critical_section_end(cd)
+#else
+# define CODEGEN_CRITICAL_SECTION_NEW      /* no-op */
+# define CODEGEN_CRITICAL_SECTION_START    /* no-op */
+# define CODEGEN_CRITICAL_SECTION_END      /* no-op */
 #endif
 
 /* machine dependent functions */
 u1 *md_codegen_get_pv_from_pc(u1 *ra);
 
+
+#if defined(ENABLE_SSA)
+void codegen_emit_phi_moves(jitdata *jd, basicblock *bptr);
+#endif
+
 #endif /* _CODEGEN_COMMON_H */