1 /* src/vm/resolve.h - resolving classes/interfaces/fields/methods
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
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., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Edwin Steiner
31 $Id: resolve.h 6083 2006-11-29 17:00:02Z twisti $
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;
51 #include "vm/global.h"
52 #include "vm/references.h"
53 #include "vm/jit/jit.h"
54 #include "vm/jit/reg.h"
55 #include "vm/jit/verify/typeinfo.h"
58 /* constants ******************************************************************/
60 #define RESOLVE_STATIC 0x0001 /* ref to static fields/methods */
61 #define RESOLVE_PUTFIELD 0x0002 /* field ref inside a PUT{FIELD,STATIC}... */
62 #define RESOLVE_SPECIAL 0x0004 /* method ref inside INVOKESPECIAL */
65 /* enums **********************************************************************/
74 resolveIllegalAccessError
78 resolveFailed = false, /* this must be a false value */
79 resolveDeferred = true, /* this must be a true value */
83 /* structs ********************************************************************/
85 struct unresolved_subtype_set {
86 classref_or_classinfo *subtyperefs; /* NULL terminated list */
89 struct unresolved_class {
90 constant_classref *classref;
91 methodinfo *referermethod;
92 unresolved_subtype_set subtypeconstraints;
95 /* XXX unify heads of unresolved_field and unresolved_method? */
97 struct unresolved_field {
98 constant_FMIref *fieldref;
99 methodinfo *referermethod;
102 unresolved_subtype_set instancetypes;
103 unresolved_subtype_set valueconstraints;
106 struct unresolved_method {
107 constant_FMIref *methodref;
108 methodinfo *referermethod;
111 unresolved_subtype_set instancetypes;
112 unresolved_subtype_set *paramconstraints;
115 #define SUBTYPESET_IS_EMPTY(stset) \
116 ((stset).subtyperefs == NULL)
118 #define UNRESOLVED_SUBTYPE_SET_EMTPY(stset) \
119 do { (stset).subtyperefs = NULL; } while(0)
121 /* function prototypes ********************************************************/
123 bool resolve_class_from_name(classinfo* referer,methodinfo *refmethod,
130 bool resolve_classref(methodinfo *refmethod,
131 constant_classref *ref,
137 bool resolve_classref_or_classinfo(methodinfo *refmethod,
138 classref_or_classinfo cls,
144 bool resolve_class_from_typedesc(typedesc *d,bool checkaccess,bool link,classinfo **result);
146 #ifdef ENABLE_VERIFIER
147 bool resolve_class(unresolved_class *ref,
152 classinfo * resolve_class_eager(unresolved_class *ref);
153 #endif /* ENABLE_VERIFIER */
155 bool resolve_field(unresolved_field *ref,
159 bool resolve_method(unresolved_method *ref,
161 methodinfo **result);
163 classinfo * resolve_classref_eager(constant_classref *ref);
164 classinfo * resolve_classref_eager_nonabstract(constant_classref *ref);
165 fieldinfo * resolve_field_eager(unresolved_field *ref);
166 methodinfo * resolve_method_eager(unresolved_method *ref);
168 #ifdef ENABLE_VERIFIER
169 unresolved_class * create_unresolved_class(methodinfo *refmethod,
170 constant_classref *classref,
171 typeinfo *valuetype);
174 unresolved_field *resolve_create_unresolved_field(classinfo *referer,
175 methodinfo *refmethod,
178 unresolved_method * resolve_create_unresolved_method(classinfo *referer,
179 methodinfo *refmethod,
180 constant_FMIref *methodref,
184 void unresolved_class_free(unresolved_class *ref);
185 void unresolved_field_free(unresolved_field *ref);
186 void unresolved_method_free(unresolved_method *ref);
188 resolve_result_t resolve_method_lazy(methodinfo *refmethod,
189 constant_FMIref *methodref,
192 resolve_result_t resolve_field_lazy(methodinfo *refmethod,
193 constant_FMIref *fieldref);
195 #if defined(ENABLE_VERIFIER)
196 resolve_result_t resolve_field_verifier_checks(methodinfo *refmethod,
197 constant_FMIref *fieldref,
198 classinfo *container,
200 typeinfo *instanceti,
205 bool resolve_constrain_unresolved_field(unresolved_field *ref,
207 methodinfo *refmethod,
208 typeinfo *instanceti,
211 resolve_result_t resolve_method_verifier_checks(methodinfo *refmethod,
212 constant_FMIref *methodref,
216 resolve_result_t resolve_method_instance_type_checks(methodinfo *refmethod,
218 typeinfo *instanceti,
221 resolve_result_t resolve_method_param_type_checks(jitdata *jd,
222 methodinfo *refmethod,
227 resolve_result_t resolve_method_param_type_checks_stackbased(
228 methodinfo *refmethod,
231 typedescriptor *stack);
233 bool resolve_method_loading_constraints(classinfo *referer,
236 bool resolve_constrain_unresolved_method_instance(unresolved_method *ref,
237 methodinfo *refmethod,
238 typeinfo *instanceti,
241 bool resolve_constrain_unresolved_method_params(jitdata *jd,
242 unresolved_method *ref,
243 methodinfo *refmethod,
246 bool resolve_constrain_unresolved_method_params_stackbased(
247 unresolved_method *ref,
248 methodinfo *refmethod,
249 typedescriptor *stack);
251 #endif /* defined(ENABLE_VERIFIER) */
254 void unresolved_class_debug_dump(unresolved_class *ref,FILE *file);
255 void unresolved_field_debug_dump(unresolved_field *ref,FILE *file);
256 void unresolved_method_debug_dump(unresolved_method *ref,FILE *file);
257 void unresolved_subtype_set_debug_dump(unresolved_subtype_set *stset,FILE *file);
260 #endif /* _RESOLVE_H */
263 * These are local overrides for various environment variables in Emacs.
264 * Please do not remove this and leave it at the end of the file, where
265 * Emacs will automagically detect them.
266 * ---------------------------------------------------------------------
269 * indent-tabs-mode: t
273 * vim:noexpandtab:sw=4:ts=4: