diff options
author | Andrew Haley <aph@redhat.com> | 2003-06-13 12:20:45 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2003-06-13 12:20:45 +0000 |
commit | bec3e66d1a37c885eb41556e322e150b6241dfb0 (patch) | |
tree | f6a9be472e2ed22b97800e7de0cfd99ecb2818bd /libjava/prims.cc | |
parent | 12e816bf16cabc88455ac694e25ac2792a7aaa31 (diff) | |
download | gcc-bec3e66d1a37c885eb41556e322e150b6241dfb0.zip gcc-bec3e66d1a37c885eb41556e322e150b6241dfb0.tar.gz gcc-bec3e66d1a37c885eb41556e322e150b6241dfb0.tar.bz2 |
prims.cc (catch_segv): Create exception in handler.
2003-06-12 Andrew Haley <aph@redhat.com>
* prims.cc (catch_segv): Create exception in handler.
(catch_fpe): Likewise.
(_Jv_divI, _Jv_remI, _Jv_divJ, _Jv_remJ): Likewise.
(_Jv_ThrowSignal): Remove.
* include/x86_64-signal.h (INIT_SEGV): Delete reference to nullp.
* include/default-signal.h (INIT_SEGV, INIT_FPE): Delete reference
to nullp and arithexception.
* include/dwarf2-signal.h (INIT_SEGV, INIT_FPE): Likewise.
* include/i386-signal.h (INIT_SEGV, INIT_FPE): Likewise.
* include/s390-signal.h (INIT_SEGV, INIT_FPE): Likewise.
* include/sparc-signal.h (INIT_SEGV, INIT_FPE): Likewise.
* include/win32-signal.h (INIT_SEGV, INIT_FPE): Likewise.
From-SVN: r67892
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r-- | libjava/prims.cc | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc index 9ddd1d2..8d9cc6d 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -122,39 +122,27 @@ void (*_Jv_JVMPI_Notify_THREAD_END) (JVMPI_Event *event); #endif -extern "C" void _Jv_ThrowSignal (jthrowable) __attribute ((noreturn)); - -// Just like _Jv_Throw, but fill in the stack trace first. Although -// this is declared extern in order that its name not be mangled, it -// is not intended to be used outside this file. -void -_Jv_ThrowSignal (jthrowable throwable) -{ - throwable->fillInStackTrace (); - throw throwable; -} - #ifdef HANDLE_SEGV -static java::lang::NullPointerException *nullp; - SIGNAL_HANDLER (catch_segv) { + java::lang::NullPointerException *nullp + = new java::lang::NullPointerException; MAKE_THROW_FRAME (nullp); - _Jv_ThrowSignal (nullp); + throw nullp; } #endif -static java::lang::ArithmeticException *arithexception; - #ifdef HANDLE_FPE SIGNAL_HANDLER (catch_fpe) { + java::lang::ArithmeticException *arithexception + = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero")); #ifdef HANDLE_DIVIDE_OVERFLOW HANDLE_DIVIDE_OVERFLOW; #else MAKE_THROW_FRAME (arithexception); #endif - _Jv_ThrowSignal (arithexception); + throw arithexception; } #endif @@ -921,9 +909,6 @@ _Jv_CreateJavaVM (void* /*vm_args*/) INIT_SEGV; #ifdef HANDLE_FPE INIT_FPE; -#else - arithexception = new java::lang::ArithmeticException - (JvNewStringLatin1 ("/ by zero")); #endif no_memory = new java::lang::OutOfMemoryError; @@ -1093,7 +1078,11 @@ jint _Jv_divI (jint dividend, jint divisor) { if (__builtin_expect (divisor == 0, false)) - _Jv_ThrowSignal (arithexception); + { + java::lang::ArithmeticException *arithexception + = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero")); + throw arithexception; + } if (dividend == (jint) 0x80000000L && divisor == -1) return dividend; @@ -1105,11 +1094,15 @@ jint _Jv_remI (jint dividend, jint divisor) { if (__builtin_expect (divisor == 0, false)) - _Jv_ThrowSignal (arithexception); + { + java::lang::ArithmeticException *arithexception + = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero")); + throw arithexception; + } if (dividend == (jint) 0x80000000L && divisor == -1) return 0; - + return dividend % divisor; } @@ -1117,8 +1110,12 @@ jlong _Jv_divJ (jlong dividend, jlong divisor) { if (__builtin_expect (divisor == 0, false)) - _Jv_ThrowSignal (arithexception); - + { + java::lang::ArithmeticException *arithexception + = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero")); + throw arithexception; + } + if (dividend == (jlong) 0x8000000000000000LL && divisor == -1) return dividend; @@ -1129,8 +1126,12 @@ jlong _Jv_remJ (jlong dividend, jlong divisor) { if (__builtin_expect (divisor == 0, false)) - _Jv_ThrowSignal (arithexception); - + { + java::lang::ArithmeticException *arithexception + = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero")); + throw arithexception; + } + if (dividend == (jlong) 0x8000000000000000LL && divisor == -1) return 0; |