* Removed all Id tags.
[cacao.git] / src / vm / jit / dseg.h
1 /* src/vm/jit/dseg.c - data segment handling stuff
2
3    Copyright (C) 1996-2005, 2006, 2007 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
7
8    This file is part of CACAO.
9
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.
14
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.
19
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
23    02110-1301, USA.
24
25 */
26
27
28 #ifndef _DSEG_H
29 #define _DSEG_H
30
31 /* forward typedefs ***********************************************************/
32
33 typedef struct dsegentry             dsegentry;
34 typedef struct linenumbertable_entry linenumbertable_entry;
35 typedef struct dseg_exception_entry  dseg_exception_entry;
36
37
38 #include "config.h"
39 #include "vm/types.h"
40
41 #include "toolbox/list.h"
42
43 #include "vm/jit/jit.h"
44 #include "vm/jit/codegen-common.h"
45
46 #include "vmcore/references.h"
47
48
49 /* convenience macros *********************************************************/
50
51 #define dseg_add_functionptr(cd,value) \
52     dseg_add_address((cd), (void *) (ptrint) (value))
53
54
55 /* dataentry ******************************************************************/
56
57 #define DSEG_FLAG_UNIQUE      0x0001
58 #define DSEG_FLAG_READONLY    0x0002
59
60 struct dsegentry {
61         u2         type;
62         u2         flags;
63         s4         disp;
64         imm_union  val;
65         dsegentry *next;
66 };
67
68
69 /* linenumbertable_entry ******************************************************/
70
71 /* Keep the type of line the same as the pointer type, otherwise we
72    run into alignment troubles (like on MIPS64). */
73
74 struct linenumbertable_entry {
75         ptrint  line;               /* NOTE: see doc/inlining_stacktrace.txt for  */
76         u1     *pc;                 /*       special meanings of line and pc.     */
77 };
78
79
80 /* dseg_exception_entry ********************************************************
81
82    Datastructure which represents an exception entry in the exception
83    table residing in the data segment.
84
85 *******************************************************************************/
86
87 struct dseg_exception_entry {
88         classref_or_classinfo  catchtype;
89         u1                    *handlerpc;
90         u1                    *endpc;
91         u1                    *startpc;
92 };
93
94
95 /* function prototypes ********************************************************/
96
97 void dseg_finish(jitdata *jd);
98
99 s4 dseg_add_unique_s4(codegendata *cd, s4 value);
100 s4 dseg_add_unique_s8(codegendata *cd, s8 value);
101 s4 dseg_add_unique_float(codegendata *cd, float value);
102 s4 dseg_add_unique_double(codegendata *cd, double value);
103 s4 dseg_add_unique_address(codegendata *cd, void *value);
104
105 s4 dseg_add_s4(codegendata *cd, s4 value);
106 s4 dseg_add_s8(codegendata *cd, s8 value);
107 s4 dseg_add_float(codegendata *cd, float value);
108 s4 dseg_add_double(codegendata *cd, double value);
109 s4 dseg_add_address(codegendata *cd, void *value);
110
111 void dseg_add_unique_target(codegendata *cd, basicblock *target);
112 void dseg_add_target(codegendata *cd, basicblock *target);
113
114 void dseg_addlinenumbertablesize(codegendata *cd);
115 void dseg_addlinenumber(codegendata *cd, u2 linenumber);
116 void dseg_addlinenumber_inline_start(codegendata *cd, instruction *iptr);
117 void dseg_addlinenumber_inline_end(codegendata *cd, instruction *iptr);
118
119 void dseg_createlinenumbertable(codegendata *cd);
120
121 s4 dseg_get_linenumber_from_pc(methodinfo **pm, u1 *pv, u1 *pc);
122
123 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
124 void dseg_adddata(codegendata *cd);
125 void dseg_resolve_datareferences(jitdata *jd);
126 #endif
127
128 #if !defined(NDEBUG)
129 void dseg_display(jitdata *jd);
130 #endif
131
132 #endif /* _DSEG_H */
133
134
135 /*
136  * These are local overrides for various environment variables in Emacs.
137  * Please do not remove this and leave it at the end of the file, where
138  * Emacs will automagically detect them.
139  * ---------------------------------------------------------------------
140  * Local variables:
141  * mode: c
142  * indent-tabs-mode: t
143  * c-basic-offset: 4
144  * tab-width: 4
145  * End:
146  * vim:noexpandtab:sw=4:ts=4:
147  */