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 3007 2005-07-12 20:58:01Z twisti $
39 #include "vm/exceptions.h"
40 #include "vm/initialize.h"
41 #include "vm/linker.h"
42 #include "vm/method.h"
43 #include "vm/references.h"
44 #include "vm/resolve.h"
45 #include "vm/stringlocal.h"
46 #include "vm/jit/asmpart.h"
48 /* XXX class_resolveclassmethod */
49 #include "vm/loader.h"
52 /* helper_resolve_classinfo ****************************************************
54 This function returns the loaded and resolved class.
56 *******************************************************************************/
58 classinfo *helper_resolve_classinfo(constant_classref *cr)
62 /* resolve and load the class */
64 if (!resolve_classref(NULL, cr, resolveEager, true, true, &c))
67 /* return the classinfo pointer */
73 /* helper_resolve_methodinfo ***************************************************
75 This function returns the loaded and resolved methodinfo of the
78 *******************************************************************************/
80 methodinfo *helper_resolve_methodinfo(unresolved_method *um)
84 /* resolve the method */
86 if (!resolve_method(um, resolveEager, &m)) {
87 java_objectheader *xptr;
88 java_objectheader *cause;
92 cause = *exceptionptr;
94 /* convert ClassNotFoundException's to NoClassDefFoundError's */
96 if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
97 /* clear exception, because we are calling jit code again */
101 /* create new error */
104 new_exception_javastring(string_java_lang_NoClassDefFoundError,
105 ((java_lang_Throwable *) cause)->detailMessage);
107 /* we had an exception while creating the error */
112 /* set new exception */
114 *exceptionptr = xptr;
120 /* return the methodinfo pointer */
126 /* helper_resolve_fieldinfo ****************************************************
128 This function returns the fieldinfo pointer of the passed field.
130 *******************************************************************************/
132 void *helper_resolve_fieldinfo(unresolved_field *uf)
136 /* resolve the field */
138 if (!resolve_field(uf, resolveEager, &fi)) {
139 java_objectheader *xptr;
140 java_objectheader *cause;
144 cause = *exceptionptr;
146 /* convert ClassNotFoundException's to NoClassDefFoundError's */
148 if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
149 /* clear exception, because we are calling jit code again */
151 *exceptionptr = NULL;
153 /* create new error */
156 new_exception_javastring(string_java_lang_NoClassDefFoundError,
157 ((java_lang_Throwable *) cause)->detailMessage);
159 /* we had an exception while creating the error */
164 /* set new exception */
166 *exceptionptr = xptr;
172 /* return the fieldinfo pointer */
179 * These are local overrides for various environment variables in Emacs.
180 * Please do not remove this and leave it at the end of the file, where
181 * Emacs will automagically detect them.
182 * ---------------------------------------------------------------------
185 * indent-tabs-mode: t
189 * vim:noexpandtab:sw=4:ts=4: