* Merged in twisti-branch.
[cacao.git] / src / vm / exceptions.h
index 557a339899707181c3e8432c16ed78d9b290d780..1c48b98e15c7ad2f802c07f7870f95b6a6929c13 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: exceptions.h 7587 2007-03-28 13:29:09Z 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
+
+
+/* exception pointer **********************************************************/
+
+#if defined(ENABLE_THREADS)
+#define exceptionptr    &(THREADOBJECT->_exceptionptr)
+#else
+#define exceptionptr    &_no_threads_exceptionptr
+#endif
+
+#if !defined(ENABLE_THREADS)
+extern java_objectheader *_no_threads_exceptionptr;
+#endif
 
 
 /* function prototypes ********************************************************/
@@ -84,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);
@@ -119,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);
@@ -126,6 +145,8 @@ 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);