* Moved all files from vmcore/ to vm/.
[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, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _DSEG_H
27 #define _DSEG_H
28
29 /* forward typedefs ***********************************************************/
30
31 typedef struct dsegentry dsegentry;
32
33
34 #include "config.h"
35 #include "vm/types.h"
36
37 #include "toolbox/list.h"
38
39 #include "vm/references.h"
40
41 #include "vm/jit/jit.h"
42 #include "vm/jit/codegen-common.h"
43
44
45 /* convenience macros *********************************************************/
46
47 #define dseg_add_functionptr(cd,value) \
48     dseg_add_address((cd), (void *) (ptrint) (value))
49
50
51 /* dataentry ******************************************************************/
52
53 #define DSEG_FLAG_UNIQUE      0x0001
54 #define DSEG_FLAG_READONLY    0x0002
55
56 struct dsegentry {
57         u2         type;
58         u2         flags;
59         s4         disp;
60         imm_union  val;
61         dsegentry *next;
62 };
63
64
65 /* function prototypes ********************************************************/
66
67 void dseg_finish(jitdata *jd);
68
69 s4 dseg_add_unique_s4(codegendata *cd, s4 value);
70 s4 dseg_add_unique_s8(codegendata *cd, s8 value);
71 s4 dseg_add_unique_float(codegendata *cd, float value);
72 s4 dseg_add_unique_double(codegendata *cd, double value);
73 s4 dseg_add_unique_address(codegendata *cd, void *value);
74
75 s4 dseg_add_s4(codegendata *cd, s4 value);
76 s4 dseg_add_s8(codegendata *cd, s8 value);
77 s4 dseg_add_float(codegendata *cd, float value);
78 s4 dseg_add_double(codegendata *cd, double value);
79 s4 dseg_add_address(codegendata *cd, void *value);
80
81 void dseg_add_unique_target(codegendata *cd, basicblock *target);
82 void dseg_add_target(codegendata *cd, basicblock *target);
83
84 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
85 void dseg_adddata(codegendata *cd);
86 void dseg_resolve_datareferences(jitdata *jd);
87 #endif
88
89 #if !defined(NDEBUG)
90 void dseg_display(jitdata *jd);
91 #endif
92
93 #endif /* _DSEG_H */
94
95
96 /*
97  * These are local overrides for various environment variables in Emacs.
98  * Please do not remove this and leave it at the end of the file, where
99  * Emacs will automagically detect them.
100  * ---------------------------------------------------------------------
101  * Local variables:
102  * mode: c
103  * indent-tabs-mode: t
104  * c-basic-offset: 4
105  * tab-width: 4
106  * End:
107  * vim:noexpandtab:sw=4:ts=4:
108  */