1 /* src/vm/jit/asmhelper.c - code patching helper functions
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: Christian Thalinger
31 $Id: helper.c 2266 2005-04-11 10:00:51Z twisti $
37 #include "vm/exceptions.h"
38 #include "vm/initialize.h"
39 #include "vm/method.h"
40 #include "vm/references.h"
41 #include "vm/resolve.h"
43 /* XXX class_resolveclassmethod */
44 #include "vm/loader.h"
47 /* helper_resolve_classinfo ****************************************************
49 This function returns the loaded and resolved class.
51 *******************************************************************************/
53 classinfo *helper_resolve_classinfo(constant_classref *cr)
57 /* resolve and load the class */
59 if (!resolve_classref(NULL, cr, resolveEager, true, &c))
62 /* return the classinfo pointer */
68 /* helper_resolve_classinfo_flags **********************************************
70 This function returns the flags of the passed class.
72 *******************************************************************************/
74 s4 helper_resolve_classinfo_flags(constant_classref *cr)
78 /* resolve and load the class */
80 if (!resolve_classref(NULL, cr, resolveEager, true, &c))
83 /* return the flags */
89 /* helper_resolve_classinfo_vftbl **********************************************
91 This function return the vftbl pointer of the passed class.
93 *******************************************************************************/
95 vftbl_t *helper_resolve_classinfo_vftbl(constant_classref *cr)
99 /* resolve the method */
101 if (!resolve_classref(NULL, cr, resolveEager, true, &c))
104 /* return the virtual function table pointer */
110 /* helper_resolve_classinfo_index **********************************************
112 This function returns the index of the passed class.
114 *******************************************************************************/
116 s4 helper_resolve_classinfo_index(constant_classref *cr)
120 /* resolve and load the class */
122 if (!resolve_classref(NULL, cr, resolveEager, true, &c))
125 /* return the class' index */
131 /* helper_resolve_methodinfo ***************************************************
133 This function returns the loaded and resolved methodinfo of the
136 *******************************************************************************/
138 methodinfo *helper_resolve_methodinfo(unresolved_method *um)
142 /* resolve the method */
144 if (!resolve_method(um, resolveEager, &m))
147 /* return the methodinfo pointer */
153 /* helper_resolve_methodinfo_vftblindex ****************************************
155 This function returns the virtual function table index (vftblindex)
156 of the passed method.
158 *******************************************************************************/
160 s4 helper_resolve_methodinfo_vftblindex(unresolved_method *um)
164 /* resolve the method */
166 if (!resolve_method(um, resolveEager, &m))
169 /* return the virtual function table index */
171 return m->vftblindex;
175 /* helper_resolve_methodinfo_stubroutine ***************************************
177 This function returns the stubroutine of the passed method.
179 *******************************************************************************/
181 u1 *helper_resolve_methodinfo_stubroutine(unresolved_method *um)
185 /* resolve the method */
187 if (!resolve_method(um, resolveEager, &m))
190 /* return the method pointer */
192 return m->stubroutine;
196 /* helper_resolve_fieldinfo_value_address **************************************
198 This function returns the value address of the passed field.
200 *******************************************************************************/
202 void *helper_resolve_fieldinfo_value_address(unresolved_field *uf)
206 /* resolve the field */
208 if (!resolve_field(uf, resolveEager, &fi))
211 /* check if class is initialized */
213 if (!fi->class->initialized)
214 if (!initialize_class(fi->class))
217 /* return the field value's address */
223 /* helper_resolve_fieldinfo_offset *********************************************
225 This function returns the offset value of the passed field.
227 *******************************************************************************/
229 s4 helper_resolve_fieldinfo_offset(unresolved_field *uf)
233 /* resolve the field */
235 if (!resolve_field(uf, resolveEager, &fi))
238 /* return the field value's offset */
245 * These are local overrides for various environment variables in Emacs.
246 * Please do not remove this and leave it at the end of the file, where
247 * Emacs will automagically detect them.
248 * ---------------------------------------------------------------------
251 * indent-tabs-mode: t
255 * vim:noexpandtab:sw=4:ts=4: