1 /* src/vm/jit/dseg.c - data segment handling stuff
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Reinhard Grafl
30 Changes: Christian Thalinger
33 $Id: dseg.h 5186 2006-07-28 13:24:43Z twisti $
41 /* forward typedefs ***********************************************************/
43 typedef struct dsegentry dsegentry;
44 typedef struct jumpref jumpref;
45 typedef struct dataref dataref;
46 typedef struct exceptionref exceptionref;
47 typedef struct patchref patchref;
48 typedef struct linenumberref linenumberref;
55 #include "vm/jit/jit.h"
56 #include "vm/jit/codegen-common.h"
59 /* XXX don't-break-trunk macros ***********************************************/
61 #define dseg_adds4(cd,value) dseg_add_unique_s4((cd), (value))
62 #define dseg_adds8(cd,value) dseg_add_unique_s8((cd), (value))
63 #define dseg_addfloat(cd,value) dseg_add_unique_float((cd), (value))
64 #define dseg_adddouble(cd,value) dseg_add_unique_double((cd), (value))
65 #define dseg_addaddress(cd,value) dseg_add_unique_address((cd), (void *) (ptrint) (value))
66 #define dseg_addtarget(cd,value) dseg_add_target((cd), (value))
69 /* convenience macros *********************************************************/
71 #define dseg_add_functionptr(cd,value) \
72 dseg_add_address((cd), (void *) (ptrint) (value))
75 /* dataentry ******************************************************************/
77 #define DSEG_FLAG_UNIQUE 0x0001
78 #define DSEG_FLAG_READONLY 0x0002
89 /* jumpref ********************************************************************/
92 s4 tablepos; /* patching position in data segment */
93 basicblock *target; /* target basic block */
94 jumpref *next; /* next element in jumpref list */
98 /* dataref ********************************************************************/
101 s4 datapos; /* patching position in generated code */
102 dataref *next; /* next element in dataref list */
106 /* exceptionref ***************************************************************/
108 struct exceptionref {
109 s4 branchpos; /* patching position in code segment */
110 s4 reg; /* used for ArrayIndexOutOfBounds index reg */
111 functionptr function; /* function pointer to generate exception */
112 exceptionref *next; /* next element in exceptionref list */
116 /* patchref *******************************************************************/
127 /* linenumberref **************************************************************/
129 struct linenumberref {
130 s4 tablepos; /* patching position in data segment */
131 s4 linenumber; /* line number, used for inserting into the */
132 /* table and for validity checking */
133 /* -1......start of inlined body */
134 /* -2......end of inlined body */
135 /* <= -3...special entry with methodinfo * */
136 /* (see doc/inlining_stacktrace.txt) */
137 ptrint targetmpc; /* machine code program counter of first */
138 /* instruction for given line */
139 /* NOTE: for linenumber <= -3 this is a the */
140 /* (methodinfo *) of the inlined method */
141 linenumberref *next; /* next element in linenumberref list */
145 /* function prototypes ********************************************************/
147 void dseg_finish(jitdata *jd);
149 s4 dseg_add_unique_s4(codegendata *cd, s4 value);
150 s4 dseg_add_unique_s8(codegendata *cd, s8 value);
151 s4 dseg_add_unique_float(codegendata *cd, float value);
152 s4 dseg_add_unique_double(codegendata *cd, double value);
153 s4 dseg_add_unique_address(codegendata *cd, void *value);
155 s4 dseg_add_s4(codegendata *cd, s4 value);
156 s4 dseg_add_s8(codegendata *cd, s8 value);
157 s4 dseg_add_float(codegendata *cd, float value);
158 s4 dseg_add_double(codegendata *cd, double value);
159 s4 dseg_add_address(codegendata *cd, void *value);
161 void dseg_add_unique_target(codegendata *cd, basicblock *target);
162 void dseg_add_target(codegendata *cd, basicblock *target);
164 void dseg_addlinenumbertablesize(codegendata *cd);
165 void dseg_addlinenumber(codegendata *cd, u2 linenumber);
166 void dseg_addlinenumber_inline_start(codegendata *cd, instruction *iptr);
167 void dseg_addlinenumber_inline_end(codegendata *cd, instruction *iptr);
169 void dseg_createlinenumbertable(codegendata *cd);
171 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
172 void dseg_adddata(codegendata *cd);
173 void dseg_resolve_datareferences(jitdata *jd);
177 void dseg_display(jitdata *jd);
184 * These are local overrides for various environment variables in Emacs.
185 * Please do not remove this and leave it at the end of the file, where
186 * Emacs will automagically detect them.
187 * ---------------------------------------------------------------------
190 * indent-tabs-mode: t
194 * vim:noexpandtab:sw=4:ts=4: