* src/vm/jit/jit.c: Moved to .cpp.
[cacao.git] / src / vm / jit / codegen-common.h
index 450bf1c404e2e326f050953151a5b00612c5cc32..3b27daa3b1aa866de58a5743e685d770dca2ad16 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/codegen-common.h - architecture independent code generator stuff
 
-   Copyright (C) 1996-2005, 2006, 2007 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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -22,8 +20,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen-common.h 7783 2007-04-20 13:28:27Z 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 jumpref                jumpref;
+typedef struct dataref                dataref;
+typedef struct exceptionref           exceptionref;
+typedef struct linenumberref          linenumberref;
 
 
 #include "config.h"
 #include "vm/types.h"
 
+#include "vm/builtin.h"
+#include "vm/descriptor.h"
 #include "vm/global.h"
+#include "vm/method.h"
+#include "vm/references.h"
 
 #include "vm/jit/dseg.h"
-#include "vm/jit/jit.h"
+#include "vm/jit/jit.hpp"
 #include "vm/jit/reg.h"
 #include "vm/jit/code.h"
 #include "vm/jit/replace.h"
 
-#include "vmcore/descriptor.h"
-#include "vmcore/method.h"
-#include "vmcore/references.h"
-
 
 #define MCODEINITSIZE (1<<15)       /* 32 Kbyte code area initialization size */
 #define DSEGINITSIZE  (1<<12)       /*  4 Kbyte data area initialization size */
@@ -101,17 +95,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,23 +128,11 @@ struct codegendata {
        dataref        *datareferences; /* list of data segment references        */
 #endif
 
-/*     list_t         *patchrefs; */
-       patchref       *patchrefs;
        list_t         *brancheslabel;
-
-       linenumberref  *linenumberreferences; /* list of line numbers and the     */
-                                       /* program counters of their first        */
-                                       /* instruction                            */
-       s4              linenumbertablesizepos;
-       s4              linenumbertablestartpos;
-       s4              linenumbertab;
+       list_t         *linenumbers;    /* list of line numbers                   */
 
        methodinfo     *method;
 
-       codegen_critical_section_t *threadcrit; /* List of critical code regions          */
-       codegen_critical_section_t threadcritcurrent;
-       s4                 threadcritcount; /* Number of critical regions         */
-
        s4              stackframesize;    /* stackframe size of this method      */
 
 #if defined(ENABLE_REPLACEMENT)
@@ -221,18 +192,6 @@ struct dataref {
 };
 
 
-/* patchref *******************************************************************/
-
-struct patchref {
-       s4           branchpos;     /* relative offset to method entrypoint       */
-       s4           disp;          /* displacement of ref in the data segment    */
-       functionptr  patcher;       /* patcher function to call                   */
-       voidptr      ref;           /* reference passed                           */
-/*     listnode     linkage; */
-       patchref    *next;
-};
-
-
 /* linenumberref **************************************************************/
 
 struct linenumberref {
@@ -251,18 +210,12 @@ struct linenumberref {
 };
 
 
-/* methodtree_element *********************************************************/
-
-typedef struct methodtree_element methodtree_element;
-
-struct methodtree_element {
-       u1 *startpc;
-       u1 *endpc;
-};
-
-
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void codegen_init(void);
 void codegen_setup(jitdata *jd);
 
@@ -286,16 +239,6 @@ void codegen_resolve_branchrefs(codegendata *cd, basicblock *bptr);
 
 void codegen_branch_label_add(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options);
 
-
-void codegen_add_patch_ref(codegendata *cd, functionptr patcher, voidptr ref,
-                                                  s4 disp);
-/* XXX REMOVE ME: don't-break-trunk macro */
-#define codegen_addpatchref codegen_add_patch_ref
-
-void codegen_insertmethod(u1 *startpc, u1 *endpc);
-u1 *codegen_get_pv_from_pc(u1 *pc);
-u1 *codegen_get_pv_from_pc_nocheck(u1 *pc);
-
 #if defined(ENABLE_REPLACEMENT)
 #if !defined(NDEBUG)
 void codegen_set_replacement_point_notrap(codegendata *cd, s4 type);
@@ -308,40 +251,23 @@ void codegen_set_replacement_point(codegendata *cd);
 
 void codegen_finish(jitdata *jd);
 
-#if defined(ENABLE_DISASSEMBLER)
-void codegen_disassemble_nativestub(methodinfo *m, u1 *start, u1 *end);
-#endif
-
-/* stub functions */
-
-u1       *codegen_generate_stub_compiler(methodinfo *m);
-codeinfo *codegen_generate_stub_native(methodinfo *m, functionptr f);
-
-void      codegen_emit_stub_compiler(jitdata *jd);
-void      codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f);
-
-#if defined(ENABLE_INTRP)
-u1 *intrp_createcompilerstub(methodinfo *m);
-u1 *intrp_createnativestub(functionptr f, jitdata *jd, methoddesc *md);
-#endif
-
-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_handle_t *codegen_start_native_call(u1 *currentsp, u1 *pv);
+java_object_t *codegen_finish_native_call(u1 *currentsp, u1 *pv);
 
 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);
+#if defined(ENABLE_SSA)
+void codegen_emit_phi_moves(jitdata *jd, basicblock *bptr);
 #endif
 
-/* machine dependent functions */
-u1 *md_codegen_get_pv_from_pc(u1 *ra);
+// REMOVEME
+void codegen_emit_stub_compiler(jitdata *jd);
+void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int skipparams);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _CODEGEN_COMMON_H */