1 /* vm/resolve.h - resolving classes/interfaces/fields/methods
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Edwin Steiner
31 $Id: resolve.h 3811 2005-11-28 16:23:40Z edwin $
39 /* forward declarations *******************************************************/
41 typedef struct unresolved_class unresolved_class;
42 typedef struct unresolved_field unresolved_field;
43 typedef struct unresolved_method unresolved_method;
44 typedef struct unresolved_subtype_set unresolved_subtype_set;
49 #include "vm/global.h"
50 #include "vm/references.h"
51 #include "vm/jit/jit.h"
54 /* constants ******************************************************************/
56 #define RESOLVE_STATIC 0x0001 /* ref to static fields/methods */
57 #define RESOLVE_PUTFIELD 0x0002 /* field ref inside a PUT{FIELD,STATIC}... */
58 #define RESOLVE_SPECIAL 0x0004 /* method ref inside INVOKESPECIAL */
61 /* enums **********************************************************************/
71 resolveIllegalAccessError
75 /* structs ********************************************************************/
77 struct unresolved_subtype_set {
78 classref_or_classinfo *subtyperefs; /* NULL terminated list */
81 struct unresolved_class {
82 constant_classref *classref;
83 methodinfo *referermethod;
84 unresolved_subtype_set subtypeconstraints;
87 /* XXX unify heads of unresolved_field and unresolved_method? */
89 struct unresolved_field {
90 constant_FMIref *fieldref;
91 methodinfo *referermethod;
94 unresolved_subtype_set instancetypes;
95 unresolved_subtype_set valueconstraints;
98 struct unresolved_method {
99 constant_FMIref *methodref;
100 methodinfo *referermethod;
103 unresolved_subtype_set instancetypes;
104 unresolved_subtype_set *paramconstraints;
107 #define SUBTYPESET_IS_EMPTY(stset) \
108 ((stset).subtyperefs == NULL)
110 #define UNRESOLVED_SUBTYPE_SET_EMTPY(stset) \
111 do { (stset).subtyperefs = NULL; } while(0)
113 /* function prototypes ********************************************************/
115 bool resolve_class_from_name(classinfo* referer,methodinfo *refmethod,
122 bool resolve_classref(methodinfo *refmethod,
123 constant_classref *ref,
129 bool resolve_classref_or_classinfo(methodinfo *refmethod,
130 classref_or_classinfo cls,
136 bool resolve_class_from_typedesc(typedesc *d,bool checkaccess,bool link,classinfo **result);
138 #ifdef ENABLE_VERIFIER
139 bool resolve_class(unresolved_class *ref,
144 classinfo * resolve_class_eager(unresolved_class *ref);
145 #endif /* ENABLE_VERIFIER */
147 bool resolve_field(unresolved_field *ref,
151 bool resolve_method(unresolved_method *ref,
153 methodinfo **result);
155 classinfo * resolve_classref_eager(constant_classref *ref);
156 classinfo * resolve_classref_eager_nonabstract(constant_classref *ref);
157 fieldinfo * resolve_field_eager(unresolved_field *ref);
158 methodinfo * resolve_method_eager(unresolved_method *ref);
160 #ifdef ENABLE_VERIFIER
161 unresolved_class * create_unresolved_class(methodinfo *refmethod,
162 constant_classref *classref,
163 typeinfo *valuetype);
166 unresolved_field * create_unresolved_field(classinfo *referer,methodinfo *refmethod,
169 unresolved_method * create_unresolved_method(classinfo *referer,methodinfo *refmethod,
172 void unresolved_class_free(unresolved_class *ref);
173 void unresolved_field_free(unresolved_field *ref);
174 void unresolved_method_free(unresolved_method *ref);
176 #ifdef ENABLE_VERIFIER
177 bool constrain_unresolved_field(unresolved_field *ref,
178 classinfo *referer,methodinfo *refmethod,
180 stackelement *stack);
182 bool constrain_unresolved_method(unresolved_method *ref,
183 classinfo *referer,methodinfo *refmethod,
185 stackelement *stack);
187 bool resolve_and_check_subtype_set(classinfo *referer,methodinfo *refmethod,
188 unresolved_subtype_set *ref,
189 classref_or_classinfo type,
197 void unresolved_class_debug_dump(unresolved_class *ref,FILE *file);
198 void unresolved_field_debug_dump(unresolved_field *ref,FILE *file);
199 void unresolved_method_debug_dump(unresolved_method *ref,FILE *file);
200 void unresolved_subtype_set_debug_dump(unresolved_subtype_set *stset,FILE *file);
203 #endif /* _RESOLVE_H */
206 * These are local overrides for various environment variables in Emacs.
207 * Please do not remove this and leave it at the end of the file, where
208 * Emacs will automagically detect them.
209 * ---------------------------------------------------------------------
212 * indent-tabs-mode: t
216 * vim:noexpandtab:sw=4:ts=4: