35b7aa519b3aa6a5c22549e000112e0ad2ad5090
[cacao.git] / src / vm / jit / inline / sets.h
1 /* jit/sets.h -
2
3    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4    Institut f. Computersprachen, TU Wien
5    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
6    S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
7    J. Wenninger
8
9    This file is part of CACAO.
10
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License as
13    published by the Free Software Foundation; either version 2, or (at
14    your option) any later version.
15
16    This program is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24    02111-1307, USA.
25
26    Contact: cacao@complang.tuwien.ac.at
27
28    Authors: Carolyn Oates
29
30    $Id: sets.h 1621 2004-11-30 13:06:55Z twisti $
31
32 */
33
34
35 #ifndef _SET_H
36 #define _SET_H
37
38 typedef struct methSet      methSet;
39 typedef struct methSetNode  methSetNode;
40 typedef struct fldSet       fldSet;
41 typedef struct fldSetNode   fldSetNode;
42 typedef struct classSet     classSet;
43 typedef struct classSetNode classSetNode;
44
45
46 #include "types.h"
47 #include "vm/global.h"
48
49
50 /*------------ Method /Class Used Markers -------------------------------*/                 
51
52 /* Class flags =
53    USED all methods and fields are available; 
54    PARTUSED = specific methods (static, <init>, <clinit>, inherited def used, special) used, 
55               but not instanciated
56    NOTUSED = nothing used in class - not needed 
57 */
58
59 /* Method Flags =
60    USED = method definition is used
61    PARTUSED = method definition will be used if class instanciated
62    NOTUSED  = method defintion never used
63 */
64
65 #define USED      2
66 #define PARTUSED  1
67 #define MARKED    1
68 #define NOTUSED   0
69
70 #define MONO      0
71 #define MONO1     1 /* potential poly that is really mono */
72 #define POLY      2
73
74
75 /*------------------------------------------------------------*/
76 /*-- flds used by a method set fns */
77 /*------------------------------------------------------------*/
78 struct fldSet {
79         fldSetNode *head;
80         fldSetNode *tail;
81         fldSetNode *pos;
82         s4 length;
83 };
84
85
86 struct fldSetNode {
87         fieldinfo *fldRef;
88         fldSetNode *nextfldRef;
89         bool writePUT;
90         bool readGET;
91         classSetNode *lastptrPUT; 
92         classSetNode *lastptrGET; 
93         s2 index;
94 };
95
96
97 fldSetNode *inFldSet (fldSetNode *, fieldinfo *);
98 fldSetNode *addFldRef(fldSetNode *, fieldinfo *);
99 fldSet *add2FldSet(fldSet *, fieldinfo *, bool, bool);
100 fldSet *createFldSet();
101 int printFldSet(fldSetNode *);
102 int printFieldSet(fldSet *);
103
104
105 /*------------------------------------------------------------*/
106 /*-- methodinfo call set fns */
107 /*------------------------------------------------------------*/
108 struct methSet {
109         methSetNode *head;
110         methSetNode *tail;
111         methSetNode *pos;
112         s4 length;
113 };
114
115
116 struct methSetNode {
117         methodinfo   *methRef;
118         methSetNode  *nextmethRef;
119         classSetNode *lastptrIntoClassSet2;
120         s2            index;
121         s4            monoPoly;
122 };
123
124
125 int inMethSet (methSetNode *, methodinfo *);
126 methSetNode *addMethRef(methSetNode *, methodinfo *);
127 methSet *add2MethSet(methSet    *, methodinfo *);
128 methSet *createMethSet();
129 int printMethSet   (methSetNode *);
130 int printMethodSet (methSet *);
131
132
133 /*------------------------------------------------------------*/
134 /*-- classinfo XTA set fns  */
135 /*------------------------------------------------------------*/
136
137 struct classSet {
138         classSetNode *head;
139         classSetNode *tail;
140         classSetNode *pos;
141         s4 length;
142 };
143
144
145 struct classSetNode {
146         classinfo *classType;
147         classSetNode *nextClass;
148         s2 index;
149 };
150
151
152 int inSet(classSetNode *, classinfo *);
153 classSetNode *addElement(classSetNode *,  classinfo *);
154 classSet *add2ClassSet(classSet *,  classinfo *);
155 classSet *createClassSet();
156 int inRange(classSetNode *, classinfo *);
157 classSetNode *addClassCone(classSetNode *,  classinfo *);
158 classSetNode *intersectSubtypesWithSet(classinfo *, classSetNode *); 
159 int sizeOfSet(classSetNode *s);
160 int setSize(classSetNode *);
161 int printSet(classSetNode *);
162 int printClassSet(classSet *);
163
164 #endif /* _SETS_H */
165
166
167 /*
168  * These are local overrides for various environment variables in Emacs.
169  * Please do not remove this and leave it at the end of the file, where
170  * Emacs will automagically detect them.
171  * ---------------------------------------------------------------------
172  * Local variables:
173  * mode: c
174  * indent-tabs-mode: t
175  * c-basic-offset: 4
176  * tab-width: 4
177  * End:
178  */