* src/cacaoh/dummy.c (resolve_handle_pending_exception): New function.
[cacao.git] / src / vm / exceptions.h
1 /* src/vm/exceptions.h - exception related functions prototypes
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _EXCEPTIONS_H
27 #define _EXCEPTIONS_H
28
29 /* forward typedefs ***********************************************************/
30
31 #include "config.h"
32 #include "vm/types.h"
33
34 #include "vm/global.h"
35
36 #include "vm/jit/stacktrace.h"
37
38 #include "vmcore/references.h"
39 #include "vmcore/method.h"
40
41
42 /* hardware-exception defines **************************************************
43
44    These defines define an internal number for the various hardware
45    exceptions.
46
47    ATTENTION: These values are also used as load-displacements on some
48    architectures. Thus, these values must NOT be aligned to 4 or
49    8-byte boundaries, since normal loads could have such offsets with
50    a base of NULL which should result in a NullPointerException.
51
52    NOTE: In exceptions_init() we have a check whether the offset of
53    java_arrayheader.data[0] is greater than the largest displacement
54    defined below.  Otherwise normal array loads/stores could trigger
55    an exception.
56
57 *******************************************************************************/
58
59 #define EXCEPTION_HARDWARE_NULLPOINTER              0
60 #define EXCEPTION_HARDWARE_ARITHMETIC               1
61 #define EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS    2
62 #define EXCEPTION_HARDWARE_ARRAYSTORE               3
63
64 #define EXCEPTION_HARDWARE_CLASSCAST                5
65 #define EXCEPTION_HARDWARE_EXCEPTION                6
66 #define EXCEPTION_HARDWARE_PATCHER                  7
67
68 #define EXCEPTION_HARDWARE_COMPILER                 9
69
70 #define EXCEPTION_HARDWARE_LARGEST                  9
71
72
73 /* function prototypes ********************************************************/
74
75 void           exceptions_init(void);
76
77 java_handle_t *exceptions_get_exception(void);
78 void           exceptions_set_exception(java_handle_t *o);
79 void           exceptions_clear_exception(void);
80 java_handle_t *exceptions_get_and_clear_exception(void);
81
82
83 /* functions to generate compiler exceptions */
84
85 java_handle_t *exceptions_new_abstractmethoderror(void);
86 java_object_t *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
87 java_handle_t *exceptions_new_arraystoreexception(void);
88
89 void exceptions_throw_abstractmethoderror(void);
90 void exceptions_throw_classcircularityerror(classinfo *c);
91 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
92 void exceptions_throw_classnotfoundexception(utf *name);
93 void exceptions_throw_noclassdeffounderror(utf *name);
94 void exceptions_throw_noclassdeffounderror_cause(java_handle_t *cause);
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_handle_t *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);
109
110 java_handle_t *exceptions_new_arithmeticexception(void);
111
112 java_handle_t *exceptions_new_arrayindexoutofboundsexception(s4 index);
113 void exceptions_throw_arrayindexoutofboundsexception(void);
114 void exceptions_throw_arraystoreexception(void);
115
116 java_handle_t *exceptions_new_classcastexception(java_handle_t *o);
117
118 void exceptions_throw_clonenotsupportedexception(void);
119 void exceptions_throw_illegalaccessexception(utf *message);
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_handle_t *cause);
125 void exceptions_throw_negativearraysizeexception(void);
126
127 java_handle_t *exceptions_new_nullpointerexception(void);
128 void exceptions_throw_nullpointerexception(void);
129 void exceptions_throw_privilegedactionexception(java_handle_t *cause);
130 void exceptions_throw_stringindexoutofboundsexception(void);
131
132 java_handle_t *exceptions_fillinstacktrace(void);
133
134 void exceptions_print_exception(java_handle_t *xptr);
135 void exceptions_print_current_exception(void);
136 void exceptions_print_stacktrace(void);
137
138 #endif /* _EXCEPTIONS_H */
139
140
141 /*
142  * These are local overrides for various environment variables in Emacs.
143  * Please do not remove this and leave it at the end of the file, where
144  * Emacs will automagically detect them.
145  * ---------------------------------------------------------------------
146  * Local variables:
147  * mode: c
148  * indent-tabs-mode: t
149  * c-basic-offset: 4
150  * tab-width: 4
151  * End:
152  * vim:noexpandtab:sw=4:ts=4:
153  */