aboutsummaryrefslogtreecommitdiff
path: root/libjava/prims.cc
diff options
context:
space:
mode:
authorAndrew Haley <aph@cygnus.com>1999-04-13 09:18:09 +0000
committerAndrew Haley <aph@gcc.gnu.org>1999-04-13 09:18:09 +0000
commita4e44caa6d2a951af67aefb76ee22f7735bf293b (patch)
treecf855e7be72eac99926b727b8a0fd3ad8e4cccde /libjava/prims.cc
parent0e8285f1200b2feb78876c3edfe53637cf2577da (diff)
downloadgcc-a4e44caa6d2a951af67aefb76ee22f7735bf293b.zip
gcc-a4e44caa6d2a951af67aefb76ee22f7735bf293b.tar.gz
gcc-a4e44caa6d2a951af67aefb76ee22f7735bf293b.tar.bz2
i386-signal.h, [...]: New files.
1999-04-13 Andrew Haley <aph@cygnus.com> * include/i386-signal.h, include/default-signal.h: New files. * prims.cc (catch_segv): Call MAKE_THROW_FRAME in exception handler. (catch_fpe): New function. * configure.in: Make link to appropriate include/java-signal.h. * configure: Rebuilt. * Makefile.am: include/java-signal.h added to dependency list. * Makefile.in: Rebuilt. From-SVN: r26400
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r--libjava/prims.cc56
1 files changed, 40 insertions, 16 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 265e281..70dc89c 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -14,14 +14,12 @@ details. */
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#ifdef HANDLE_SEGV
-#include <signal.h>
-#endif
#pragma implementation "java-array.h"
#include <cni.h>
#include <jvm.h>
+#include <java-signal.h>
#include <java/lang/Class.h>
#include <java/lang/Runtime.h>
@@ -30,6 +28,7 @@ details. */
#include <java/lang/ThreadGroup.h>
#include <java/lang/FirstThread.h>
#include <java/lang/ArrayIndexOutOfBoundsException.h>
+#include <java/lang/ArithmeticException.h>
#include <java/lang/ClassFormatError.h>
#include <java/lang/ClassCastException.h>
#include <java/lang/NegativeArraySizeException.h>
@@ -40,6 +39,7 @@ details. */
#include <java/lang/reflect/Modifier.h>
#include <java/io/PrintStream.h>
+
#define ObjectClass _CL_Q34java4lang6Object
extern java::lang::Class ObjectClass;
@@ -426,19 +426,31 @@ _Jv_NewMultiArray (jclass array_type, jint dimensions, ...)
-#ifdef HANDLE_SEGV
-
+#ifdef HANDLE_SEGV
static java::lang::NullPointerException *nullp;
static void
-catch_segv (int)
+catch_segv (int dummy)
{
+ MAKE_THROW_FRAME(dummy);
// Don't run `new' in a signal handler, so we always throw the same
- // null pointer exception.
+ // exception.
_Jv_Throw (nullp);
}
+#endif
-#endif /* HANDLE_SEGV */
+#ifdef HANDLE_FPE
+static java::lang::ArithmeticException *arithexception;
+
+static void
+catch_fpe (int dummy)
+{
+ MAKE_THROW_FRAME(dummy);
+ // Don't run `new' in a signal handler, so we always throw the same
+ // exception.
+ _Jv_Throw (arithexception);
+}
+#endif
class _Jv_PrimClass : public java::lang::Class
{
@@ -560,14 +572,26 @@ static java::lang::Thread *main_thread;
void
JvRunMain (jclass klass, int argc, const char **argv)
{
-#ifdef HANDLE_SEGV
- nullp = new java::lang::NullPointerException ();
-
- struct sigaction act;
- act.sa_handler = catch_segv;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction (SIGSEGV, &act, NULL);
+#ifdef HANDLE_SEGV
+ {
+ nullp = new java::lang::NullPointerException ();
+ struct sigaction act;
+ act.sa_handler = catch_segv;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGSEGV, &act, NULL);
+ }
+#endif
+
+#ifdef HANDLE_FPE
+ {
+ arithexception = new java::lang::ArithmeticException ();
+ struct sigaction act;
+ act.sa_handler = catch_fpe;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGFPE, &act, NULL);
+ }
#endif
no_memory = new java::lang::OutOfMemoryError;