1 /* src/vm/exceptions.h - exception related functions prototypes
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: Christian Thalinger
29 Changes: Edwin Steiner
31 $Id: exceptions.h 5935 2006-11-08 20:27:37Z twisti $
39 /* forward typedefs ***********************************************************/
44 #include "vm/global.h"
45 #include "native/include/java_lang_String.h"
46 #include "native/include/java_lang_Throwable.h"
47 #include "vm/builtin.h"
48 #include "vm/references.h"
49 #include "vm/method.h"
52 #if defined(ENABLE_THREADS)
53 #define exceptionptr &(THREADOBJECT->_exceptionptr)
55 #define exceptionptr &_no_threads_exceptionptr
58 #if !defined(ENABLE_THREADS)
59 extern java_objectheader *_no_threads_exceptionptr;
63 /* function prototypes ********************************************************/
65 /* load and link exceptions used in the system */
66 bool exceptions_init(void);
69 /* exception throwing functions */
71 void throw_exception(void);
72 void throw_exception_exit(void);
74 void throw_main_exception(void);
75 void throw_main_exception_exit(void);
77 void throw_cacao_exception_exit(const char *exception,
78 const char *message, ...);
80 void exceptions_throw_outofmemory_exit(void);
83 /* initialize new exceptions */
85 java_objectheader *new_exception(const char *classname);
87 java_objectheader *new_exception_message(const char *classname,
90 java_objectheader *new_exception_throwable(const char *classname,
91 java_lang_Throwable *cause);
93 java_objectheader *new_exception_utfmessage(const char *classname,
96 java_objectheader *new_exception_javastring(const char *classname,
97 java_lang_String *message);
99 java_objectheader *new_exception_int(const char *classname, s4 i);
102 /* functions to generate compiler exceptions */
104 java_objectheader *exceptions_new_abstractmethoderror(void);
105 java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
106 void exceptions_throw_abstractmethoderror(void);
108 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...);
109 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
111 java_objectheader *new_classnotfoundexception(utf *name);
112 java_objectheader *new_noclassdeffounderror(utf *name);
113 java_objectheader *exceptions_new_linkageerror(const char *message,classinfo *c);
114 java_objectheader *exceptions_new_nosuchmethoderror(classinfo *c,
115 utf *name, utf *desc);
116 void exceptions_throw_nosuchmethoderror(classinfo *c, utf *name, utf *desc);
118 java_objectheader *new_internalerror(const char *message, ...);
120 java_objectheader *exceptions_new_verifyerror(methodinfo *m,
121 const char *message, ...);
122 void exceptions_throw_verifyerror(methodinfo *m, const char *message, ...);
123 void exceptions_throw_verifyerror_for_stack(methodinfo *m, int type);
125 java_objectheader *new_unsupportedclassversionerror(classinfo *c,
126 const char *message, ...);
128 java_objectheader *new_arithmeticexception(void);
130 java_objectheader *new_arrayindexoutofboundsexception(s4 index);
131 void exceptions_throw_arrayindexoutofboundsexception(void);
133 java_objectheader *exceptions_new_arraystoreexception(void);
134 void exceptions_throw_arraystoreexception(void);
136 java_objectheader *exceptions_new_classcastexception(java_objectheader *o);
138 java_objectheader *new_illegalargumentexception(void);
139 void exceptions_throw_illegalargumentexception(void);
141 java_objectheader *exceptions_new_illegalmonitorstateexception(void);
142 void exceptions_throw_illegalmonitorstateexception(void);
144 java_objectheader *new_negativearraysizeexception(void);
145 void exceptions_throw_negativearraysizeexception(void);
147 java_objectheader *exceptions_new_nullpointerexception(void);
148 void exceptions_throw_nullpointerexception(void);
150 java_objectheader *exceptions_new_stringindexoutofboundsexception(void);
151 void exceptions_throw_stringindexoutofboundsexception(void);
153 void classnotfoundexception_to_noclassdeffounderror(void);
155 java_objectheader *exceptions_get_and_clear_exception(void);
157 void exceptions_print_exception(java_objectheader *xptr);
159 #endif /* _EXCEPTIONS_H */
163 * These are local overrides for various environment variables in Emacs.
164 * Please do not remove this and leave it at the end of the file, where
165 * Emacs will automagically detect them.
166 * ---------------------------------------------------------------------
169 * indent-tabs-mode: t
173 * vim:noexpandtab:sw=4:ts=4: