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 8295 2007-08-11 17:57:24Z michi $
33 /* forward typedefs ***********************************************************/
38 #include "vm/global.h"
40 #include "vm/jit/stacktrace.h"
42 #include "vmcore/references.h"
43 #include "vmcore/method.h"
46 /* hardware-exception defines **************************************************
48 These defines define an internal number for the various hardware
51 ATTENTION: These values are also used as load-displacements on some
52 architectures. Thus, these values must NOT be aligned to 4 or
53 8-byte boundaries, since normal loads could have such offsets with
54 a base of NULL which should result in a NullPointerException.
56 NOTE: In exceptions_init() we have a check whether the offset of
57 java_arrayheader.data[0] is greater than the largest displacement
58 defined below. Otherwise normal array loads/stores could trigger
61 *******************************************************************************/
63 #define EXCEPTION_HARDWARE_NULLPOINTER 0
64 #define EXCEPTION_HARDWARE_ARITHMETIC 1
65 #define EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS 2
66 #define EXCEPTION_HARDWARE_CLASSCAST 3
68 #define EXCEPTION_HARDWARE_EXCEPTION 5
69 #define EXCEPTION_HARDWARE_PATCHER 6
70 #define EXCEPTION_HARDWARE_COMPILER 7
72 #define EXCEPTION_HARDWARE_LARGEST 7
75 /* function prototypes ********************************************************/
77 bool exceptions_init(void);
79 java_handle_t *exceptions_get_exception(void);
80 void exceptions_set_exception(java_handle_t *o);
81 void exceptions_clear_exception(void);
82 java_handle_t *exceptions_get_and_clear_exception(void);
84 java_handle_t *new_exception_utfmessage(const char *classname,
88 /* functions to generate compiler exceptions */
90 java_handle_t *exceptions_new_abstractmethoderror(void);
91 java_handle_t *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
92 java_handle_t *exceptions_new_arraystoreexception(void);
94 void exceptions_throw_abstractmethoderror(void);
95 void exceptions_throw_classcircularityerror(classinfo *c);
96 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
97 void exceptions_throw_classnotfoundexception(utf *name);
98 void exceptions_throw_noclassdeffounderror(utf *name);
99 void exceptions_throw_noclassdeffounderror_cause(java_handle_t *cause);
100 void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name);
101 void exceptions_throw_linkageerror(const char *message, classinfo *c);
102 void exceptions_throw_nosuchfielderror(classinfo *c, utf *name);
103 void exceptions_throw_nosuchmethoderror(classinfo *c, utf *name, utf *desc);
104 void exceptions_throw_exceptionininitializererror(java_handle_t *cause);
105 void exceptions_throw_incompatibleclasschangeerror(classinfo *c,
106 const char *message);
107 void exceptions_throw_instantiationerror(classinfo *c);
108 void exceptions_throw_internalerror(const char *message, ...);
109 void exceptions_throw_outofmemoryerror(void);
110 void exceptions_throw_verifyerror(methodinfo *m, const char *message, ...);
111 void exceptions_throw_verifyerror_for_stack(methodinfo *m, int type);
112 void exceptions_throw_unsatisfiedlinkerror(utf *name);
113 void exceptions_throw_unsupportedclassversionerror(classinfo *c, u4 ma, u4 mi);
115 java_handle_t *exceptions_new_arithmeticexception(void);
117 java_handle_t *exceptions_new_arrayindexoutofboundsexception(s4 index);
118 void exceptions_throw_arrayindexoutofboundsexception(void);
119 void exceptions_throw_arraystoreexception(void);
121 java_handle_t *exceptions_new_classcastexception(java_handle_t *o);
123 void exceptions_throw_clonenotsupportedexception(void);
124 void exceptions_throw_illegalaccessexception(utf *message);
125 void exceptions_throw_illegalargumentexception(void);
126 void exceptions_throw_illegalmonitorstateexception(void);
127 void exceptions_throw_interruptedexception(void);
128 void exceptions_throw_instantiationexception(classinfo *c);
129 void exceptions_throw_invocationtargetexception(java_handle_t *cause);
130 void exceptions_throw_negativearraysizeexception(void);
132 java_handle_t *exceptions_new_nullpointerexception(void);
133 void exceptions_throw_nullpointerexception(void);
134 void exceptions_throw_privilegedactionexception(java_handle_t *cause);
135 void exceptions_throw_stringindexoutofboundsexception(void);
137 void exceptions_classnotfoundexception_to_noclassdeffounderror(void);
139 java_handle_t *exceptions_fillinstacktrace(void);
141 void exceptions_print_exception(java_handle_t *xptr);
142 void exceptions_print_current_exception(void);
143 void exceptions_print_stacktrace(void);
145 #endif /* _EXCEPTIONS_H */
149 * These are local overrides for various environment variables in Emacs.
150 * Please do not remove this and leave it at the end of the file, where
151 * Emacs will automagically detect them.
152 * ---------------------------------------------------------------------
155 * indent-tabs-mode: t
159 * vim:noexpandtab:sw=4:ts=4: