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 4699 2006-03-28 14:52:32Z twisti $
41 /* forward typedefs ***********************************************************/
43 typedef struct jumpref jumpref;
44 typedef struct dataref dataref;
45 typedef struct exceptionref exceptionref;
46 typedef struct patchref patchref;
47 typedef struct linenumberref linenumberref;
54 #include "vm/jit/jit.h"
55 #include "vm/jit/codegen-common.h"
58 /* global macros **************************************************************/
60 #if SIZEOF_VOID_P == 8
61 # define dseg_addaddress(cd,value) dseg_adds8((cd), (s8) (value))
63 # define dseg_addaddress(cd,value) dseg_adds4((cd), (s4) (value))
67 /* jumpref ********************************************************************/
70 s4 tablepos; /* patching position in data segment */
71 basicblock *target; /* target basic block */
72 jumpref *next; /* next element in jumpref list */
76 /* dataref ********************************************************************/
79 s4 datapos; /* patching position in generated code */
80 dataref *next; /* next element in dataref list */
84 /* exceptionref ***************************************************************/
87 s4 branchpos; /* patching position in code segment */
88 s4 reg; /* used for ArrayIndexOutOfBounds index reg */
89 functionptr function; /* function pointer to generate exception */
90 exceptionref *next; /* next element in exceptionref list */
94 /* patchref *******************************************************************/
105 /* linenumberref **************************************************************/
107 struct linenumberref {
108 s4 tablepos; /* patching position in data segment */
109 s4 linenumber; /* line number, used for inserting into the */
110 /* table and for validity checking */
111 /* -1......start of inlined body */
112 /* -2......end of inlined body */
113 /* <= -3...special entry with methodinfo * */
114 /* (see doc/inlining_stacktrace.txt) */
115 ptrint targetmpc; /* machine code program counter of first */
116 /* instruction for given line */
117 /* NOTE: for linenumber <= -3 this is a the */
118 /* (methodinfo *) of the inlined method */
119 linenumberref *next; /* next element in linenumberref list */
123 /* function prototypes ********************************************************/
125 void dseg_increase(codegendata *cd);
127 s4 dseg_adds4_increase(codegendata *cd, s4 value);
128 s4 dseg_adds4(codegendata *cd, s4 value);
130 s4 dseg_adds8_increase(codegendata *cd, s8 value);
131 s4 dseg_adds8(codegendata *cd, s8 value);
133 s4 dseg_addfloat_increase(codegendata *cd, float value);
134 s4 dseg_addfloat(codegendata *cd, float value);
136 s4 dseg_adddouble_increase(codegendata *cd, double value);
137 s4 dseg_adddouble(codegendata *cd, double value);
139 void dseg_addtarget(codegendata *cd, basicblock *target);
141 void dseg_addlinenumbertablesize(codegendata *cd);
142 void dseg_addlinenumber(codegendata *cd, u2 linenumber, u1 *ptr);
143 void dseg_addlinenumber_inline_start(codegendata *cd, instruction *iptr, u1 *ptr);
144 void dseg_addlinenumber_inline_end(codegendata *cd, instruction *iptr);
146 void dseg_createlinenumbertable(codegendata *cd);
148 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
149 void dseg_adddata(codegendata *cd, u1 *ptr);
150 void dseg_resolve_datareferences(jitdata *jd);
154 void dseg_display(jitdata *jd);
161 * These are local overrides for various environment variables in Emacs.
162 * Please do not remove this and leave it at the end of the file, where
163 * Emacs will automagically detect them.
164 * ---------------------------------------------------------------------
167 * indent-tabs-mode: t
171 * vim:noexpandtab:sw=4:ts=4: