1 /* src/vm/exceptions.h - exception related functions prototypes
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: exceptions.h 2490 2005-05-20 23:05:49Z twisti $
39 #include "vm/global.h"
40 #include "native/include/java_lang_String.h"
41 #include "native/include/java_lang_Throwable.h"
42 #include "vm/builtin.h"
43 #include "vm/references.h"
44 #include "vm/method.h"
47 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
49 #define exceptionptr builtin_get_exceptionptrptr()
50 #define dontfillinexceptionstacktrace builtin_get_dontfillinexceptionstacktrace()
51 #define threadrootmethod builtin_get_threadrootmethod()
53 #else /* defined(USE_THREADS) && defined(NATIVE_THREADS) */
55 #define exceptionptr (&_exceptionptr)
56 #define dontfillinexceptionstacktrace (&_dontfillinexceptionstacktrace)
57 #define threadrootmethod (&_threadrootmethod)
59 #endif /* defined(USE_THREADS) && defined(NATIVE_THREADS) */
61 #if !defined(USE_THREADS) || !defined(NATIVE_THREADS)
62 extern java_objectheader *_exceptionptr;
63 extern u1 _dontfillinexceptionstacktrace;
64 extern methodinfo* _threadrootmethod;
65 #endif /* !defined(USE_THREADS) || !defined(NATIVE_THREADS) */
68 /* global variables ***********************************************************/
71 /* function prototypes ********************************************************/
73 /* load and link exceptions used in the system */
75 bool exceptions_init(void);
78 /* exception throwing functions */
80 void throw_exception();
81 void throw_exception_exit();
83 void throw_main_exception();
84 void throw_main_exception_exit();
86 void throw_cacao_exception_exit(const char *exception, const char *message, ...);
89 /* initialize new exceptions */
91 java_objectheader *new_exception(const char *classname);
93 java_objectheader *new_exception_message(const char *classname,
96 java_objectheader *new_exception_throwable(const char *classname,
97 java_lang_Throwable *cause);
99 java_objectheader *new_exception_utfmessage(const char *classname,
102 java_objectheader *new_exception_javastring(const char *classname,
103 java_lang_String *message);
105 java_objectheader *new_exception_int(const char *classname, s4 i);
108 /* functions to generate compiler exceptions */
110 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...);
111 java_objectheader *new_internalerror(const char *message, ...);
112 java_objectheader *new_verifyerror(methodinfo *m, const char *message, ...);
113 java_objectheader *new_unsupportedclassversionerror(classinfo *c,
114 const char *message, ...);
116 java_objectheader *new_arithmeticexception();
117 java_objectheader *new_arrayindexoutofboundsexception(s4 index);
118 java_objectheader *new_arraystoreexception();
119 java_objectheader *new_classcastexception();
120 java_objectheader *new_negativearraysizeexception();
121 java_objectheader *new_nullpointerexception();
123 #endif /* _EXCEPTIONS_H */
127 * These are local overrides for various environment variables in Emacs.
128 * Please do not remove this and leave it at the end of the file, where
129 * Emacs will automagically detect them.
130 * ---------------------------------------------------------------------
133 * indent-tabs-mode: t