X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fexceptions.h;h=cc9ff6bef110cfa22b2a7585c9049623edb02c5d;hb=da49fa899f1ba447e4ee376a87729e43fde8754c;hp=d9939c3541c38258f27bd1a37f777ee06932f698;hpb=3b946148ba3cbfa903b81a3ab5c5510b6e325a23;p=cacao.git diff --git a/src/vm/exceptions.h b/src/vm/exceptions.h index d9939c354..cc9ff6bef 100644 --- a/src/vm/exceptions.h +++ b/src/vm/exceptions.h @@ -1,4 +1,4 @@ -/* vm/exceptions.h - exception related functions prototypes +/* src/vm/exceptions.h - exception related functions prototypes Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner, @@ -26,7 +26,9 @@ Authors: Christian Thalinger - $Id: exceptions.h 2110 2005-03-29 21:25:51Z twisti $ + Changes: Edwin Steiner + + $Id: exceptions.h 3653 2005-11-11 11:16:42Z twisti $ */ @@ -34,81 +36,30 @@ #ifndef _EXCEPTIONS_H #define _EXCEPTIONS_H - #include "config.h" +#include "vm/types.h" #include "vm/global.h" #include "native/include/java_lang_String.h" #include "native/include/java_lang_Throwable.h" #include "vm/builtin.h" -#include "vm/class.h" +#include "vm/references.h" +#include "vm/method.h" #if defined(USE_THREADS) && defined(NATIVE_THREADS) - -#define exceptionptr builtin_get_exceptionptrptr() -#define threadrootmethod builtin_get_threadrootmethod() - -#else /* defined(USE_THREADS) && defined(NATIVE_THREADS) */ - -#define exceptionptr (&_exceptionptr) -#define threadrootmethod (&_threadrootmethod) - -#endif /* defined(USE_THREADS) && defined(NATIVE_THREADS) */ +#define exceptionptr builtin_get_exceptionptrptr() +#else +#define exceptionptr &_no_threads_exceptionptr +#endif #if !defined(USE_THREADS) || !defined(NATIVE_THREADS) -extern java_objectheader *_exceptionptr; -extern methodinfo* _threadrootmethod; -#endif /* !defined(USE_THREADS) || !defined(NATIVE_THREADS) */ +extern java_objectheader *_no_threads_exceptionptr; +#endif /* global variables ***********************************************************/ -/* exception/error super class */ - -extern const char *string_java_lang_Throwable; - - -/* specify some exception strings for code generation */ - -extern const char *string_java_lang_ArithmeticException; -extern const char *string_java_lang_ArithmeticException_message; -extern const char *string_java_lang_ArrayIndexOutOfBoundsException; -extern const char *string_java_lang_ArrayStoreException; -extern const char *string_java_lang_ClassCastException; -extern const char *string_java_lang_ClassNotFoundException; -extern const char *string_java_lang_CloneNotSupportedException; -extern const char *string_java_lang_Exception; -extern const char *string_java_lang_IllegalAccessException; -extern const char *string_java_lang_IllegalArgumentException; -extern const char *string_java_lang_IllegalMonitorStateException; -extern const char *string_java_lang_IndexOutOfBoundsException; -extern const char *string_java_lang_InstantiationException; -extern const char *string_java_lang_InterruptedException; -extern const char *string_java_lang_NegativeArraySizeException; -extern const char *string_java_lang_NoSuchFieldException; -extern const char *string_java_lang_NoSuchMethodException; -extern const char *string_java_lang_NullPointerException; - - -/* specify some error strings for code generation */ - -extern const char *string_java_lang_AbstractMethodError; -extern const char *string_java_lang_ClassCircularityError; -extern const char *string_java_lang_ClassFormatError; -extern const char *string_java_lang_Error; -extern const char *string_java_lang_ExceptionInInitializerError; -extern const char *string_java_lang_IncompatibleClassChangeError; -extern const char *string_java_lang_InternalError; -extern const char *string_java_lang_LinkageError; -extern const char *string_java_lang_NoClassDefFoundError; -extern const char *string_java_lang_NoSuchFieldError; -extern const char *string_java_lang_NoSuchMethodError; -extern const char *string_java_lang_OutOfMemoryError; -extern const char *string_java_lang_UnsupportedClassVersionError; -extern const char *string_java_lang_VerifyError; -extern const char *string_java_lang_VirtualMachineError; - /* function prototypes ********************************************************/ @@ -119,13 +70,16 @@ bool exceptions_init(void); /* exception throwing functions */ -void throw_exception(); -void throw_exception_exit(); +void throw_exception(void); +void throw_exception_exit(void); + +void throw_main_exception(void); +void throw_main_exception_exit(void); -void throw_main_exception(); -void throw_main_exception_exit(); +void throw_cacao_exception_exit(const char *exception, + const char *message, ...); -void throw_cacao_exception_exit(const char *exception, const char *message, ...); +void exceptions_throw_outofmemory_exit(void); /* initialize new exceptions */ @@ -150,16 +104,27 @@ java_objectheader *new_exception_int(const char *classname, s4 i); /* functions to generate compiler exceptions */ java_objectheader *new_classformaterror(classinfo *c, const char *message, ...); -java_objectheader *new_verifyerror(methodinfo *m, const char *message); +java_objectheader *new_classnotfoundexception(utf *name); +java_objectheader *new_noclassdeffounderror(utf *name); +java_objectheader *exceptions_new_nosuchmethoderror(classinfo *c, + utf *name, utf *desc); +java_objectheader *new_internalerror(const char *message, ...); +java_objectheader *new_verifyerror(methodinfo *m, const char *message, ...); java_objectheader *new_unsupportedclassversionerror(classinfo *c, const char *message, ...); -java_objectheader *new_arithmeticexception(); +java_objectheader *new_arithmeticexception(void); java_objectheader *new_arrayindexoutofboundsexception(s4 index); -java_objectheader *new_arraystoreexception(); -java_objectheader *new_classcastexception(); -java_objectheader *new_negativearraysizeexception(); -java_objectheader *new_nullpointerexception(); +java_objectheader *new_arraystoreexception(void); +java_objectheader *new_classcastexception(void); +java_objectheader *new_illegalargumentexception(void); +java_objectheader *new_illegalmonitorstateexception(void); +java_objectheader *new_negativearraysizeexception(void); +java_objectheader *new_nullpointerexception(void); + +void classnotfoundexception_to_noclassdeffounderror(void); + +void exceptions_print_exception(java_objectheader *xptr); #endif /* _EXCEPTIONS_H */