Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.h 7261 2007-01-31 10:00:12Z twisti $
-
*/
#include "vm/global.h"
+#include "vm/jit/stacktrace.h"
+
#include "vmcore/references.h"
#include "vmcore/method.h"
/* hardware-exception defines **************************************************
- These defines define the load-offset which indicates the given
- exception.
-
- ATTENTION: These offsets need NOT to be aligned to 4 or 8-byte
- boundaries, since normal loads could have such offsets with a base
- of NULL which should result in a NullPointerException.
-
-*******************************************************************************/
-
-#define EXCEPTION_LOAD_DISP_NULLPOINTER 0
-#define EXCEPTION_LOAD_DISP_ARITHMETIC 1
-#define EXCEPTION_LOAD_DISP_ARRAYINDEXOUTOFBOUNDS 2
-#define EXCEPTION_LOAD_DISP_CLASSCAST 3
+ These defines define an internal number for the various hardware
+ exceptions.
-#define EXCEPTION_LOAD_DISP_PATCHER 5
+ ATTENTION: These values are also used as load-displacements on some
+ architectures. Thus, these values must NOT be aligned to 4 or
+ 8-byte boundaries, since normal loads could have such offsets with
+ a base of NULL which should result in a NullPointerException.
+ NOTE: In exceptions_init() we have a check whether the offset of
+ java_arrayheader.data[0] is greater than the largest displacement
+ defined below. Otherwise normal array loads/stores could trigger
+ an exception.
-/* function prototypes ********************************************************/
-
-/* load and link exceptions used in the system */
-bool exceptions_init(void);
-
+*******************************************************************************/
-/* exception throwing functions */
+#define EXCEPTION_HARDWARE_NULLPOINTER 0
+#define EXCEPTION_HARDWARE_ARITHMETIC 1
+#define EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS 2
+#define EXCEPTION_HARDWARE_ARRAYSTORE 3
-void throw_exception(void);
-void throw_exception_exit(void);
+#define EXCEPTION_HARDWARE_CLASSCAST 5
+#define EXCEPTION_HARDWARE_EXCEPTION 6
+#define EXCEPTION_HARDWARE_PATCHER 7
-void throw_main_exception(void);
-void throw_main_exception_exit(void);
+#define EXCEPTION_HARDWARE_COMPILER 9
-void throw_cacao_exception_exit(const char *exception,
- const char *message, ...);
+#define EXCEPTION_HARDWARE_LARGEST 9
-/* initialize new exceptions */
+/* function prototypes ********************************************************/
-java_objectheader *new_exception_utfmessage(const char *classname,
- utf *message);
+void exceptions_init(void);
-java_objectheader *new_exception_int(const char *classname, s4 i);
+java_handle_t *exceptions_get_exception(void);
+void exceptions_set_exception(java_handle_t *o);
+void exceptions_clear_exception(void);
+java_handle_t *exceptions_get_and_clear_exception(void);
/* functions to generate compiler exceptions */
-java_objectheader *exceptions_new_abstractmethoderror(void);
-java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
-java_objectheader *exceptions_new_arraystoreexception(void);
+java_handle_t *exceptions_new_abstractmethoderror(void);
+java_object_t *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
+java_handle_t *exceptions_new_arraystoreexception(void);
void exceptions_throw_abstractmethoderror(void);
void exceptions_throw_classcircularityerror(classinfo *c);
void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
void exceptions_throw_classnotfoundexception(utf *name);
void exceptions_throw_noclassdeffounderror(utf *name);
+void exceptions_throw_noclassdeffounderror_cause(java_handle_t *cause);
+void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name);
void exceptions_throw_linkageerror(const char *message, classinfo *c);
void exceptions_throw_nosuchfielderror(classinfo *c, utf *name);
void exceptions_throw_nosuchmethoderror(classinfo *c, utf *name, utf *desc);
-void exceptions_throw_exceptionininitializererror(java_objectheader *cause);
+void exceptions_throw_exceptionininitializererror(java_handle_t *cause);
void exceptions_throw_incompatibleclasschangeerror(classinfo *c,
const char *message);
void exceptions_throw_instantiationerror(classinfo *c);
void exceptions_throw_unsatisfiedlinkerror(utf *name);
void exceptions_throw_unsupportedclassversionerror(classinfo *c, u4 ma, u4 mi);
-java_objectheader *exceptions_new_arithmeticexception(void);
+java_handle_t *exceptions_new_arithmeticexception(void);
-java_objectheader *exceptions_new_arrayindexoutofboundsexception(s4 index);
+java_handle_t *exceptions_new_arrayindexoutofboundsexception(s4 index);
void exceptions_throw_arrayindexoutofboundsexception(void);
void exceptions_throw_arraystoreexception(void);
-java_objectheader *exceptions_new_classcastexception(java_objectheader *o);
+java_handle_t *exceptions_new_classcastexception(java_handle_t *o);
void exceptions_throw_clonenotsupportedexception(void);
-void exceptions_throw_illegalaccessexception(classinfo *c);
+void exceptions_throw_illegalaccessexception(utf *message);
void exceptions_throw_illegalargumentexception(void);
void exceptions_throw_illegalmonitorstateexception(void);
void exceptions_throw_interruptedexception(void);
void exceptions_throw_instantiationexception(classinfo *c);
-void exceptions_throw_invocationtargetexception(java_objectheader *cause);
+void exceptions_throw_invocationtargetexception(java_handle_t *cause);
void exceptions_throw_negativearraysizeexception(void);
-java_objectheader *exceptions_new_nullpointerexception(void);
+java_handle_t *exceptions_new_nullpointerexception(void);
void exceptions_throw_nullpointerexception(void);
+void exceptions_throw_privilegedactionexception(java_handle_t *cause);
void exceptions_throw_stringindexoutofboundsexception(void);
-void classnotfoundexception_to_noclassdeffounderror(void);
+void exceptions_classnotfoundexception_to_noclassdeffounderror(void);
-java_objectheader *exceptions_get_exception(void);
-void exceptions_set_exception(java_objectheader *o);
-void exceptions_clear_exception(void);
-java_objectheader *exceptions_get_and_clear_exception(void);
+java_handle_t *exceptions_fillinstacktrace(void);
-void exceptions_print_exception(java_objectheader *xptr);
+void exceptions_print_exception(java_handle_t *xptr);
void exceptions_print_current_exception(void);
+void exceptions_print_stacktrace(void);
#endif /* _EXCEPTIONS_H */