1 /* src/vm/exceptions.h - exception related functions prototypes
3 Copyright (C) 1996-2005, 2006, 2007 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 $Id: exceptions.h 7773 2007-04-19 19:44:54Z twisti $
33 /* forward typedefs ***********************************************************/
38 #include "vm/global.h"
40 #include "vmcore/references.h"
41 #include "vmcore/method.h"
44 /* hardware-exception defines **************************************************
46 These defines define an internal number for the various hardware
49 ATTENTION: These values are also used as load-displacements on some
50 architectures. Thus, these values must NOT be aligned to 4 or
51 8-byte boundaries, since normal loads could have such offsets with
52 a base of NULL which should result in a NullPointerException.
54 NOTE: In signal_init() we have an assert checking that the offset
55 of java_objectheader.data[0] is greater than the largest
56 displacement defined below. Otherwise normal array loads/stores
57 could trigger an exception.
59 *******************************************************************************/
61 #define EXCEPTION_HARDWARE_NULLPOINTER 0
62 #define EXCEPTION_HARDWARE_ARITHMETIC 1
63 #define EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS 2
64 #define EXCEPTION_HARDWARE_CLASSCAST 3
66 #define EXCEPTION_HARDWARE_EXCEPTION 5
68 #define EXCEPTION_HARDWARE_PATCHER 6
71 /* function prototypes ********************************************************/
73 /* load and link exceptions used in the system */
74 bool exceptions_init(void);
76 /* initialize new exceptions */
78 java_objectheader *new_exception_utfmessage(const char *classname,
81 java_objectheader *new_exception_int(const char *classname, s4 i);
84 /* functions to generate compiler exceptions */
86 java_objectheader *exceptions_new_abstractmethoderror(void);
87 java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
88 java_objectheader *exceptions_new_arraystoreexception(void);
90 void exceptions_throw_abstractmethoderror(void);
91 void exceptions_throw_classcircularityerror(classinfo *c);
92 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
93 void exceptions_throw_classnotfoundexception(utf *name);
94 void exceptions_throw_noclassdeffounderror(utf *name);
95 void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name);
96 void exceptions_throw_linkageerror(const char *message, classinfo *c);
97 void exceptions_throw_nosuchfielderror(classinfo *c, utf *name);
98 void exceptions_throw_nosuchmethoderror(classinfo *c, utf *name, utf *desc);
99 void exceptions_throw_exceptionininitializererror(java_objectheader *cause);
100 void exceptions_throw_incompatibleclasschangeerror(classinfo *c,
101 const char *message);
102 void exceptions_throw_instantiationerror(classinfo *c);
103 void exceptions_throw_internalerror(const char *message, ...);
104 void exceptions_throw_outofmemoryerror(void);
105 void exceptions_throw_verifyerror(methodinfo *m, const char *message, ...);
106 void exceptions_throw_verifyerror_for_stack(methodinfo *m, int type);
107 void exceptions_throw_unsatisfiedlinkerror(utf *name);
108 void exceptions_throw_unsupportedclassversionerror(classinfo *c, u4 ma, u4 mi);
110 java_objectheader *exceptions_new_arithmeticexception(void);
112 java_objectheader *exceptions_new_arrayindexoutofboundsexception(s4 index);
113 void exceptions_throw_arrayindexoutofboundsexception(void);
114 void exceptions_throw_arraystoreexception(void);
116 java_objectheader *exceptions_new_classcastexception(java_objectheader *o);
118 void exceptions_throw_clonenotsupportedexception(void);
119 void exceptions_throw_illegalaccessexception(classinfo *c);
120 void exceptions_throw_illegalargumentexception(void);
121 void exceptions_throw_illegalmonitorstateexception(void);
122 void exceptions_throw_interruptedexception(void);
123 void exceptions_throw_instantiationexception(classinfo *c);
124 void exceptions_throw_invocationtargetexception(java_objectheader *cause);
125 void exceptions_throw_negativearraysizeexception(void);
127 java_objectheader *exceptions_new_nullpointerexception(void);
128 void exceptions_throw_nullpointerexception(void);
129 void exceptions_throw_stringindexoutofboundsexception(void);
131 java_objectheader *exceptions_fillinstacktrace(void);
133 void classnotfoundexception_to_noclassdeffounderror(void);
135 java_objectheader *exceptions_get_exception(void);
136 void exceptions_set_exception(java_objectheader *o);
137 void exceptions_clear_exception(void);
138 java_objectheader *exceptions_get_and_clear_exception(void);
140 java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val);
142 void exceptions_print_exception(java_objectheader *xptr);
143 void exceptions_print_current_exception(void);
144 void exceptions_print_stacktrace(void);
146 #endif /* _EXCEPTIONS_H */
150 * These are local overrides for various environment variables in Emacs.
151 * Please do not remove this and leave it at the end of the file, where
152 * Emacs will automagically detect them.
153 * ---------------------------------------------------------------------
156 * indent-tabs-mode: t
160 * vim:noexpandtab:sw=4:ts=4: