* Updated header: Added 2006. Changed address of FSF. Changed email
[cacao.git] / src / vm / jit / inline / sets.h
1 /* vm/jit/sets.h -
2
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
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    Contact: cacao@cacaojvm.org
26
27    Authors: Carolyn Oates
28
29    $Id: sets.h 4357 2006-01-22 23:33:38Z twisti $
30
31 */
32
33
34 #ifndef _SET_H
35 #define _SET_H
36
37 typedef struct methSet      methSet;
38 typedef struct methSetNode  methSetNode;
39 typedef struct fldSet       fldSet;
40 typedef struct fldSetNode   fldSetNode;
41 typedef struct classSet     classSet;
42 typedef struct classSetNode classSetNode;
43
44
45 #include "vm/global.h"
46 #include "vm/method.h"
47 #include "vm/field.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 SYSCALL   -1 /* XTA initialization ??? should it be used for RTA for main ??? */
71 #define MONO      0
72 #define MONO1     1 /* potential poly that is really mono */
73 #define POLY      2
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   (void);
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  (void);
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 (void);
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 /**classSetNode         *copyClassSet   (classSetNode *);  **/
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  */