* Merged in twisti-branch.
[cacao.git] / src / vm / exceptions.h
index 0c8a21cfc376e16b7582e1f7cfa44c554db46822..1c48b98e15c7ad2f802c07f7870f95b6a6929c13 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: exceptions.h 7246 2007-01-29 18:49:05Z twisti $
+   $Id: exceptions.h 7596 2007-03-28 21:05:53Z twisti $
 
 */
 
 
 /* hardware-exception defines **************************************************
 
-   These defines define the load-offset which indicates the given
-   exception.
+   These defines define an internal number for the various hardware
+   exceptions.
 
-   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.
+   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.
 
 *******************************************************************************/
 
-#define EXCEPTION_LOAD_DISP_NULLPOINTER              0
-#define EXCEPTION_LOAD_DISP_ARITHMETIC               1
-#define EXCEPTION_LOAD_DISP_ARRAYINDEXOUTOFBOUNDS    2
-#define EXCEPTION_LOAD_DISP_CLASSCAST                3
+#define EXCEPTION_HARDWARE_NULLPOINTER              0
+#define EXCEPTION_HARDWARE_ARITHMETIC               1
+#define EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS    2
+#define EXCEPTION_HARDWARE_CLASSCAST                3
 
-#define EXCEPTION_LOAD_DISP_PATCHER                  5
+#define EXCEPTION_HARDWARE_EXCEPTION                5
 
+#define EXCEPTION_HARDWARE_PATCHER                  6
 
-/* function prototypes ********************************************************/
 
-/* load and link exceptions used in the system */
-bool exceptions_init(void);
+/* exception pointer **********************************************************/
 
+#if defined(ENABLE_THREADS)
+#define exceptionptr    &(THREADOBJECT->_exceptionptr)
+#else
+#define exceptionptr    &_no_threads_exceptionptr
+#endif
 
-/* exception throwing functions */
+#if !defined(ENABLE_THREADS)
+extern java_objectheader *_no_threads_exceptionptr;
+#endif
 
-void throw_exception(void);
-void throw_exception_exit(void);
 
-void throw_main_exception(void);
-void throw_main_exception_exit(void);
-
-void throw_cacao_exception_exit(const char *exception,
-                                                               const char *message, ...);
+/* function prototypes ********************************************************/
 
+/* load and link exceptions used in the system */
+bool exceptions_init(void);
 
 /* initialize new exceptions */
 
@@ -97,6 +100,7 @@ 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_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);
@@ -108,7 +112,6 @@ void exceptions_throw_internalerror(const char *message, ...);
 void exceptions_throw_outofmemoryerror(void);
 void exceptions_throw_verifyerror(methodinfo *m, const char *message, ...);
 void exceptions_throw_verifyerror_for_stack(methodinfo *m, int type);
-void exceptions_throw_virtualmachineerror(void);
 void exceptions_throw_unsatisfiedlinkerror(utf *name);
 void exceptions_throw_unsupportedclassversionerror(classinfo *c, u4 ma, u4 mi);
 
@@ -133,6 +136,8 @@ java_objectheader *exceptions_new_nullpointerexception(void);
 void exceptions_throw_nullpointerexception(void);
 void exceptions_throw_stringindexoutofboundsexception(void);
 
+java_objectheader *exceptions_fillinstacktrace(void);
+
 void classnotfoundexception_to_noclassdeffounderror(void);
 
 java_objectheader *exceptions_get_exception(void);
@@ -140,8 +145,11 @@ void               exceptions_set_exception(java_objectheader *o);
 void               exceptions_clear_exception(void);
 java_objectheader *exceptions_get_and_clear_exception(void);
 
+java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val);
+
 void exceptions_print_exception(java_objectheader *xptr);
 void exceptions_print_current_exception(void);
+void exceptions_print_stacktrace(void);
 
 #endif /* _EXCEPTIONS_H */