dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] libjit ChangeLog configure.in jit/Makefile.am j...


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] libjit ChangeLog configure.in jit/Makefile.am j...
Date: Mon, 14 Aug 2006 19:21:19 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Changes by:     Aleksey Demakov <avd>   06/08/14 19:21:19

Modified files:
        .              : ChangeLog configure.in 
        jit            : Makefile.am jit-init.c jit-internal.h 
Added files:
        jit            : jit-signal.c 

Log message:
        add --enable-signals option and some support for signals

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.247&r2=1.248
http://cvs.savannah.gnu.org/viewcvs/libjit/configure.in?cvsroot=dotgnu-pnet&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/Makefile.am?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-init.c?cvsroot=dotgnu-pnet&r1=1.1.1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-internal.h?cvsroot=dotgnu-pnet&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-signal.c?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.247
retrieving revision 1.248
diff -u -b -r1.247 -r1.248
--- ChangeLog   12 Aug 2006 01:36:59 -0000      1.247
+++ ChangeLog   14 Aug 2006 19:21:19 -0000      1.248
@@ -1,3 +1,11 @@
+2006-08-15  Kirill Kononenko  <address@hidden>
+
+       * configure.in: add --enable-signals option;
+       * jit/Makefile.am: add jit/jit-signal.c;
+       * jit/jit-signal.c, jit/jit-internal.h: add _jit_signal_init();
+       * jit/jit-init.c: call _jit_signal_init() if JIT_USE_SIGNALS is
+       defined.
+
 2006-08-11  Thomas Cort  <address@hidden>
 
        * jit/jit-rules-alpha.c jit/jit-rules-alpha.ins Properly handle

Index: configure.in
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/configure.in,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- configure.in        4 Jul 2006 17:28:07 -0000       1.21
+++ configure.in        14 Aug 2006 19:21:19 -0000      1.22
@@ -75,6 +75,18 @@
        AC_DEFINE(USE_NEW_REG_ALLOC, 1, [Define if you want to use new register 
allocator])
 fi
 
+dnl The "--enable-signals" option forces the use of the OS signals for 
exception handling.
+AC_ARG_ENABLE(signals,
+[  --enable-signals        Enable OS signal handling],
+[case "${enableval}" in
+  yes) use_signals=true ;;
+  no)  use_signals=false ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-signals) ;;
+esac],[use_signals=false])
+if test x$use_signals = xtrue; then
+       AC_DEFINE(JIT_USE_SIGNALS, 1, [Define if you want to use the OS signals 
for exception handling])
+fi
+
 dnl The "--enable-long-double" option forces the use of long double for
 dnl jit_nfloat.
 AC_ARG_ENABLE(long-double,

Index: jit/Makefile.am
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- jit/Makefile.am     12 Jul 2006 03:06:49 -0000      1.16
+++ jit/Makefile.am     14 Aug 2006 19:21:19 -0000      1.17
@@ -52,6 +52,7 @@
                jit-rules-arm.c \
                jit-rules-x86.h \
                jit-rules-x86.c \
+               jit-signal.c \
                jit-string.c \
                jit-symbol.c \
                jit-thread.c \

Index: jit/jit-init.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-init.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -b -r1.1.1.1 -r1.2
--- jit/jit-init.c      30 Apr 2004 23:30:12 -0000      1.1.1.1
+++ jit/jit-init.c      14 Aug 2006 19:21:19 -0000      1.2
@@ -40,6 +40,11 @@
        /* Make sure that the thread subsystem is initialized */
        _jit_thread_init();
 
+#ifdef JIT_USE_SIGNALS
+       /* Initialize the signal handlers */
+       _jit_signal_init();
+#endif
+
        /* Initialize the backend */
        _jit_init_backend();
 }

Index: jit/jit-internal.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-internal.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- jit/jit-internal.h  14 Apr 2006 14:44:29 -0000      1.23
+++ jit/jit-internal.h  14 Aug 2006 19:21:19 -0000      1.24
@@ -651,6 +651,15 @@
  */
 #define        JIT_CALL_NATIVE         (1 << 14)
 
+#ifdef JIT_USE_SIGNALS
+
+/*
+ * Initialize the signal handlers.
+ */
+void _jit_signal_init(void);
+
+#endif
+
 #ifdef __cplusplus
 };
 #endif

Index: jit/jit-signal.c
===================================================================
RCS file: jit/jit-signal.c
diff -N jit/jit-signal.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ jit/jit-signal.c    14 Aug 2006 19:21:19 -0000      1.1
@@ -0,0 +1,94 @@
+/*
+ * jit-signal.c - Internal management routines to use Operating System
+ *               signals for libjit exceptions handling.
+ *
+ * Copyright (C) 2006  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <config.h> 
+
+#ifdef JIT_USE_SIGNALS
+
+#include "jit-internal.h"
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ * Use SIGSEGV for builtin libjit exception.
+ */
+static void sigsegv_handler(int signum, siginfo_t *info, void *uap)
+{
+       jit_exception_builtin(JIT_RESULT_NULL_REFERENCE);
+}
+
+/*
+ * Use SIGFPE for builtin libjit exception.
+ */
+static void sigfpe_handler(int signum, siginfo_t *info, void *uap)
+{
+       switch(info->si_code)
+       {
+       case FPE_INTDIV:
+               jit_exception_builtin(JIT_RESULT_DIVISION_BY_ZERO);
+               break;
+       case FPE_INTOVF:
+               jit_exception_builtin(JIT_RESULT_OVERFLOW);
+               break;
+       case FPE_FLTDIV:
+               jit_exception_builtin(JIT_RESULT_DIVISION_BY_ZERO);
+               break;
+       case FPE_FLTOVF:
+               jit_exception_builtin(JIT_RESULT_OVERFLOW);
+               break;
+       case FPE_FLTUND:
+               jit_exception_builtin(JIT_RESULT_ARITHMETIC);
+               break;
+       case FPE_FLTSUB:
+               jit_exception_builtin(JIT_RESULT_ARITHMETIC);
+               break;
+       default:
+               jit_exception_builtin(JIT_RESULT_ARITHMETIC);
+               break;
+       }
+}
+
+/*
+ * Initialize signal handlers.
+ */
+void _jit_signal_init(void)
+{
+       struct sigaction sa_fpe, sa_segv;
+
+       sa_fpe.sa_sigaction = sigfpe_handler;
+       sigemptyset(&sa_fpe.sa_mask);
+       sa_fpe.sa_flags = SA_SIGINFO;
+       if (sigaction(SIGFPE, &sa_fpe, 0)) {
+               perror("Sigaction SIGFPE");
+               exit(1);
+       }
+
+       sa_segv.sa_sigaction = sigsegv_handler;
+       sigemptyset(&sa_segv.sa_mask);
+       sa_segv.sa_flags = SA_SIGINFO;
+       if (sigaction(SIGSEGV, &sa_segv, 0)) {
+               perror("Sigaction SIGSEGV");
+               exit(1);
+       }
+}
+
+#endif /* JIT_USE_SIGNALS */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]