Saving...
[cacao.git] / jit / 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 665 2003-11-21 18:36:43Z jowenn $
31
32 */
33
34
35 #ifndef _SET_H
36 #define _SET_H
37
38 #include "types.h"
39
40 typedef struct methSet      methSet;
41 typedef struct methSetNode  methSetNode;
42 typedef struct fldSet       fldSet;
43 typedef struct fldSetNode   fldSetNode;
44 typedef struct classSet     classSet;
45 typedef struct classSetNode classSetNode;
46
47
48 #include "global.h"
49
50
51 /*------------ Method /Class Used Markers -------------------------------*/                 
52
53 /* Class flags =
54    USED all methods and fields are available; 
55    PARTUSED = specific methods (static, <init>, <clinit>, inherited def used, special) used, 
56               but not instanciated
57    NOTUSED = nothing used in class - not needed 
58 */
59
60 /* Method Flags =
61    USED = method definition is used
62    PARTUSED = method definition will be used if class instanciated
63    NOTUSED  = method defintion never used
64 */
65
66 #define USED      2
67 #define PARTUSED  1
68 #define MARKED    1
69 #define NOTUSED   0
70
71 #define MONO      0
72 #define MONO1     1 /* potential poly that is really mono */
73 #define POLY      2
74
75
76 /*------------------------------------------------------------*/
77 /*-- flds used by a method set fns */
78 /*------------------------------------------------------------*/
79 struct fldSet {
80         fldSetNode *head;
81         fldSetNode *tail;
82         fldSetNode *pos;
83         s4 length;
84 };
85
86
87 struct fldSetNode {
88         fieldinfo *fldRef;
89         fldSetNode *nextfldRef;
90         bool writePUT;
91         bool readGET;
92         classSetNode *lastptrPUT; 
93         classSetNode *lastptrGET; 
94         s2 index;
95 };
96
97
98 fldSetNode *inFldSet (fldSetNode *, fieldinfo *);
99 fldSetNode *addFldRef(fldSetNode *, fieldinfo *);
100 fldSet *add2FldSet(fldSet *, fieldinfo *, bool, bool);
101 fldSet *createFldSet();
102 int printFldSet(fldSetNode *);
103 int printFieldSet(fldSet *);
104
105
106 /*------------------------------------------------------------*/
107 /*-- methodinfo call set fns */
108 /*------------------------------------------------------------*/
109 struct methSet {
110         methSetNode *head;
111         methSetNode *tail;
112         methSetNode *pos;
113         s4 length;
114 };
115
116
117 struct methSetNode {
118         methodinfo   *methRef;
119         methSetNode  *nextmethRef;
120         classSetNode *lastptrIntoClassSet2;
121         s2            index;
122         s4            monoPoly;
123 };
124
125
126 int inMethSet (methSetNode *, methodinfo *);
127 methSetNode *addMethRef(methSetNode *, methodinfo *);
128 methSet *add2MethSet(methSet    *, methodinfo *);
129 methSet *createMethSet();
130 int printMethSet   (methSetNode *);
131 int printMethodSet (methSet *);
132
133
134 /*------------------------------------------------------------*/
135 /*-- classinfo XTA set fns  */
136 /*------------------------------------------------------------*/
137
138 struct classSet {
139         classSetNode *head;
140         classSetNode *tail;
141         classSetNode *pos;
142         s4 length;
143 };
144
145
146 struct classSetNode {
147         classinfo *classType;
148         classSetNode *nextClass;
149         s2 index;
150 };
151
152
153 int inSet(classSetNode *, classinfo *);
154 classSetNode *addElement(classSetNode *,  classinfo *);
155 classSet *add2ClassSet(classSet *,  classinfo *);
156 classSet *createClassSet();
157 int inRange(classSetNode *, classinfo *);
158 classSetNode *addClassCone(classSetNode *,  classinfo *);
159 classSetNode *intersectSubtypesWithSet(classinfo *, classSetNode *); 
160 int sizeOfSet(classSetNode *s);
161 int setSize(classSetNode *);
162 int printSet(classSetNode *);
163 int printClassSet(classSet *);
164
165 #endif /* _SETS_H */
166
167
168 /*
169  * These are local overrides for various environment variables in Emacs.
170  * Please do not remove this and leave it at the end of the file, where
171  * Emacs will automagically detect them.
172  * ---------------------------------------------------------------------
173  * Local variables:
174  * mode: c
175  * indent-tabs-mode: t
176  * c-basic-offset: 4
177  * tab-width: 4
178  * End:
179  */