Merged branch subtype-trunk into default.
[cacao.git] / src / vm / jit / dseg.h
index 133521b92f510fc389c6643884b2eedc71dd5d48..a18a6b135a89861e87836bd335081f4d7b5fe638 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/dseg.c - data segment handling stuff
 
-   Copyright (C) 1996-2005, 2006 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.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Reinhard Grafl
-            Andreas  Krall
-            Christian Thalinger
-            Joseph Wenninger
-
-   $Id: dseg.h 6046 2006-11-22 20:24:55Z twisti $
-
 */
 
 
 
 /* forward typedefs ***********************************************************/
 
-typedef struct dsegentry             dsegentry;
-typedef struct jumpref               jumpref;
-typedef struct dataref               dataref;
-typedef struct exceptionref          exceptionref;
-typedef struct patchref              patchref;
-typedef struct linenumberref         linenumberref;
-typedef struct linenumbertable_entry linenumbertable_entry;
-typedef struct dseg_exception_entry  dseg_exception_entry;
+typedef struct dsegentry dsegentry;
 
 
 #include "config.h"
-
 #include "vm/types.h"
 
-#include "toolbox/list.h"
-#include "vm/jit/jit.h"
-#include "vm/jit/codegen-common.h"
+#include "vm/references.h"
+
+#include "vm/jit/jit.hpp"
+#include "vm/jit/codegen-common.hpp"
 
 
 /* convenience macros *********************************************************/
@@ -78,91 +60,12 @@ struct dsegentry {
 };
 
 
-/* jumpref ********************************************************************/
-
-struct jumpref {
-       s4          tablepos;       /* patching position in data segment          */
-       basicblock *target;         /* target basic block                         */
-       jumpref    *next;           /* next element in jumpref list               */
-};
-
-
-/* dataref ********************************************************************/
-
-struct dataref {
-       s4       datapos;           /* patching position in generated code        */
-       dataref *next;              /* next element in dataref list               */
-};
-
-
-/* exceptionref ***************************************************************/
-
-struct exceptionref {
-       s4            branchpos;    /* patching position in code segment          */
-       s4            reg;          /* used for ArrayIndexOutOfBounds index reg   */
-       functionptr   function;     /* function pointer to generate exception     */
-       exceptionref *next;         /* next element in exceptionref list          */
-};
-
-
-/* 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 {
-       s4             tablepos;    /* patching position in data segment          */
-       s4             linenumber;  /* line number, used for inserting into the   */
-                                   /* table and for validity checking            */
-                                   /* -1......start of inlined body              */
-                                   /* -2......end of inlined body                */
-                                   /* <= -3...special entry with methodinfo *    */
-                                                               /* (see doc/inlining_stacktrace.txt)          */
-       ptrint         targetmpc;   /* machine code program counter of first      */
-                                   /* instruction for given line                 */
-                                                               /* NOTE: for linenumber <= -3 this is a the   */
-                                   /* (methodinfo *) of the inlined method       */
-       linenumberref *next;        /* next element in linenumberref list         */
-};
-
-
-/* linenumbertable_entry ******************************************************/
-
-/* Keep the type of line the same as the pointer type, otherwise we
-   run into alignment troubles (like on MIPS64). */
-
-struct linenumbertable_entry {
-       ptrint  line;               /* NOTE: see doc/inlining_stacktrace.txt for  */
-       u1     *pc;                 /*       special meanings of line and pc.     */
-};
-
-
-/* dseg_exception_entry ********************************************************
-
-   Datastructure which represents an exception entry in the exception
-   table residing in the data segment.
-
-*******************************************************************************/
-
-struct dseg_exception_entry {
-       classref_or_classinfo  catchtype;
-       u1                    *handlerpc;
-       u1                    *endpc;
-       u1                    *startpc;
-};
-
-
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void dseg_finish(jitdata *jd);
 
 s4 dseg_add_unique_s4(codegendata *cd, s4 value);
@@ -180,16 +83,7 @@ s4 dseg_add_address(codegendata *cd, void *value);
 void dseg_add_unique_target(codegendata *cd, basicblock *target);
 void dseg_add_target(codegendata *cd, basicblock *target);
 
-void dseg_addlinenumbertablesize(codegendata *cd);
-void dseg_addlinenumber(codegendata *cd, u2 linenumber);
-void dseg_addlinenumber_inline_start(codegendata *cd, instruction *iptr);
-void dseg_addlinenumber_inline_end(codegendata *cd, instruction *iptr);
-
-void dseg_createlinenumbertable(codegendata *cd);
-
-s4 dseg_get_linenumber_from_pc(methodinfo **pm, u1 *pv, u1 *pc);
-
-#if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
+#if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
 void dseg_adddata(codegendata *cd);
 void dseg_resolve_datareferences(jitdata *jd);
 #endif
@@ -198,6 +92,10 @@ void dseg_resolve_datareferences(jitdata *jd);
 void dseg_display(jitdata *jd);
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _DSEG_H */