This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Jumbo patch: sjlj exceptions + bug fixes


I'm checking in this jumbo patch.  It adds sjlj exception support, and
it fixes a few bugs here and there.

1999-11-19  Tom Tromey  <tromey@cygnus.com>

	* Makefile.am (DIVIDESPEC): Removed.
	(EXCEPTIONSPEC): Removed.

1999-11-19  Andrew Haley  <aph@cygnus.com>

	* Makefile.am (JCFLAGS): Add -L$(here)
	(JC1FLAGS): Ditto.
	* Makefile.in: Rebuild.

1999-11-18  Tom Tromey  <tromey@cygnus.com>

	* java/lang/natDouble.cc: Include <config.h>.

	* include/config.h.in: Rebuilt.
	* acconfig.h (SJLJ_EXCEPTIONS): Undefine.
	* configure.host: Force -fsjlj-exceptions on non-sparc, non-x86
	targets.
	* configure: Rebuilt.
	* configure.in (EXCEPTIONSPEC): Allow -fsjlj-exceptions to be
	requested by configure.host.  Don't put `-D' option into
	libgcj.spec; instead, define SJLJ_EXCEPTIONS with AC_DEFINE.

	* configure: Rebuilt.
	* configure.in (EXCEPTIONSPEC): Changed `_' to `-' in
	sjlj-exceptions.

1999-11-18  Andrew Haley  <aph@cygnus.com>

	* Makefile.am: rename SJLJ_EXCEPTIONS to EXCEPTIONSPEC.
	(AM_CFLAGS): remove SJLJ_EXCEPTIONS.
	(JC1FLAGS): Ditto.
	* Makefile.in: Rebuild
	* acconfig.h: remove SJLJ_EXCEPTIONS
	* configure.in: rename SJLJ_EXCEPTIONS to EXCEPTIONSPEC.
	Do not AC_DEFINE SJLJ_EXCEPTIONS.
	* libgcj.spec.in: Add EXCEPTIONSPEC to jc1.
	* gcj/Makefile.in, include/Makefile.in: rebuild.
	* include/config.h.in: remove SJLJ_EXCEPTIONS.
		
1999-11-18  Andrew Haley  <aph@cygnus.com>

	* gij.cc (main): Rename label to prevent conflict.

	* exception.cc (_Jv_type_matcher): Don't check the table if we're
	using setjmp/longjmp exceptions: there isn't one.

1999-11-17  Andrew Haley  <aph@cygnus.com>

	* exception.cc (_Jv_type_matcher): Ignore null exception tables.
	(_Jv_Throw ): Add SJLJ_EXCEPTIONS.
	(__sjthrow): Add declaration.
	* Makefile.am (JCFLAGS): Add SJLJ_EXCEPTIONS
	(JC1FLAGS): Ditto
	(AM_CFLAGS): Ditto
	(AM_CXXFLAGS): Ditto
	* Makefile.in: Rebuild
	* acconfig.h: Add SJLJ_EXCEPTIONS
	* configure.in: Add SJLJ_EXCEPTIONS
	* configure: Rebuild.
	* gcj/Makefile.in: Rebuild.
	* gcj/cni.h: Add support for sjlj-exceptions.
	* gcj/javaprims.h: Add _Jv_Sjlj_Throw.
	* include/Makefile.in: Rebuild.
	* include/default-signal.h: Add support for sjlj-exceptions.

Tom

Index: Makefile.am
===================================================================
RCS file: /cvs/java/libgcj/libjava/Makefile.am,v
retrieving revision 1.37
diff -u -r1.37 Makefile.am
--- Makefile.am	1999/11/05 17:10:17	1.37
+++ Makefile.am	1999/11/19 18:30:00
@@ -69,23 +69,22 @@
 EH_COMMON_INCLUDE = @EH_COMMON_INCLUDE@
 
 WARNINGS = -W -Wall
-AM_CXXFLAGS = -fno-rtti -fvtable-thunks @LIBGCJ_CXXFLAGS@ $(WARNINGS)
+AM_CXXFLAGS = -fno-rtti -fvtable-thunks @LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ \
+	$(WARNINGS)
 if USING_GCC
 AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS)
 else
 AM_CFLAGS = @LIBGCJ_CFLAGS@
 endif
 
-JCFLAGS = -g
-JC1FLAGS = -g @LIBGCJ_JAVAFLAGS@
+JCFLAGS = -g -L$(here)
+JC1FLAGS = -g -L$(here) @LIBGCJ_JAVAFLAGS@
 
 LIBFFIINCS = -I$(top_srcdir)/../libffi/include -I../libffi/include
 
 INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
 	$(GCINCS) $(THREADINCS) \
 	$(EH_COMMON_INCLUDE) $(ZINCS) $(LIBFFIINCS)
-
-DIVIDESPEC = @DIVIDESPEC@
 
 
 ## ################################################################
Index: acconfig.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/acconfig.h,v
retrieving revision 1.11
diff -u -r1.11 acconfig.h
--- acconfig.h	1999/10/15 06:07:41	1.11
+++ acconfig.h	1999/11/19 18:30:08
@@ -116,3 +116,6 @@
 /* Define if system properties shouldn't be read from
    getenv("GCJ_PROPERTIES").  */
 #undef DISABLE_GETENV_PROPERTIES
+
+/* Define if using setjmp/longjmp exceptions.  */
+#undef SJLJ_EXCEPTIONS
Index: configure.host
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.host,v
retrieving revision 1.5
diff -u -r1.5 configure.host
--- configure.host	1999/10/15 06:07:41	1.5
+++ configure.host	1999/11/19 18:30:46
@@ -23,6 +23,7 @@
 libgcj_cflags=
 libgcj_cxxflags=
 libgcj_javaflags=
+libgcj_sjlj=
 
 case "${target_optspace}:${host}" in
   yes:*)
@@ -59,7 +60,10 @@
 	libgcj_flags="${libgcj_flags} -ffloat-store"
 	DIVIDESPEC=-fno-use-divide-subroutine
 	;;
+  sparc-*)
+        ;;
   *)
+        libgcj_sjlj=yes
 	;;
 esac
 
Index: configure.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.in,v
retrieving revision 1.40
diff -u -r1.40 configure.in
--- configure.in	1999/11/04 17:12:25	1.40
+++ configure.in	1999/11/19 18:30:53
@@ -57,13 +57,27 @@
      AC_DEFINE(DEBUG)
   fi)
 
-dnl See if the user has the enterpreter included.
+dnl See if the user has the interpreter included.
 AC_ARG_ENABLE(interpreter,
 [  --enable-interpreter    enable interpreter],
   if test "$enable_interpreter" = yes; then
      AC_DEFINE(INTERPRETER)
   fi)
 
+EXCEPTIONSPEC=
+dnl See if we should use setjmp/longjmp exceptions
+AC_ARG_ENABLE(sjlj-exceptions,
+[  --enable-sjlj-exceptions    use setjmp/longjmp exceptions],
+  if test "$enable_sjlj_exceptions" = yes; then
+     # This can be set in configure.host.
+     libgcj_sjlj=yes
+  fi)
+
+if test "$libgcj_sjlj" = yes; then
+   EXCEPTIONSPEC="-fsjlj-exceptions"
+   AC_DEFINE(SJLJ_EXCEPTIONS)
+fi
+
 dnl See if the user wants to disable java.net.  This is the mildly
 dnl ugly way that we admit that target-side configuration sucks.
 AC_ARG_ENABLE(java-net,
@@ -520,6 +534,7 @@
 AC_SUBST(ZDEPS)
 AC_SUBST(ZINCS)
 AC_SUBST(DIVIDESPEC)
+AC_SUBST(EXCEPTIONSPEC)
 
 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
 AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
@@ -621,17 +636,21 @@
 
 AC_CHECK_PROGS(PERL, perl, false)
 
-case "${host}" in
-  i?86-*-linux*)
-    SIGNAL_HANDLER=include/i386-signal.h
-	;;
-  sparc-sun-solaris*)
-    SIGNAL_HANDLER=include/sparc-signal.h
-	;;
-  *)
-    SIGNAL_HANDLER=include/default-signal.h
-	;;
-esac
+if test "$enable_sjlj_exceptions" = yes; then
+   SIGNAL_HANDLER=include/default-signal.h
+else
+   case "${host}" in
+    i?86-*-linux*)
+       SIGNAL_HANDLER=include/i386-signal.h
+       ;;
+    sparc-sun-solaris*)
+       SIGNAL_HANDLER=include/sparc-signal.h
+       ;;
+    *)
+       SIGNAL_HANDLER=include/default-signal.h
+       ;;
+   esac
+fi
 
 AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
 
Index: exception.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/exception.cc,v
retrieving revision 1.4
diff -u -r1.4 exception.cc
--- exception.cc	1999/09/10 22:03:05	1.4
+++ exception.cc	1999/11/19 18:30:53
@@ -33,10 +33,10 @@
 
 extern "C" java_eh_info **__get_eh_info (); 
 extern "C" void __throw () __attribute__ ((__noreturn__));
+extern "C" void __sjthrow () __attribute__ ((__noreturn__));
 extern "C" short __get_eh_table_version (void *table);
 extern "C" short __get_eh_table_language (void *table);
 
-
 extern "C" void * malloc (size_t);
 extern "C" void free (void *);
 
@@ -45,8 +45,12 @@
 _Jv_type_matcher (java_eh_info *info, void* match_info, 
 		  void *exception_table)
 {
-  if (__get_eh_table_language (exception_table) != EH_LANG_Java)
+#ifndef SJLJ_EXCEPTIONS
+  /* No exception table implies the old style mechanism, so don't check. */
+  if (exception_table != NULL
+      && __get_eh_table_language (exception_table) != EH_LANG_Java)
     return NULL;
+#endif
 
   /* we don't worry about version info yet, there is only one version! */
   
@@ -125,10 +129,6 @@
   *info_ptr = NULL;
 }
 
-/* Perform a throw, Java style. Throw will unwind through this call, so
-   there better not be any handlers or exception thrown here. */
-
-
 /* Initialize an __eh_info structure with this libraries matching info. */
 
 extern "C" void
@@ -136,6 +136,9 @@
 {
 }
 
+/* Perform a throw, Java style. Throw will unwind through this call,
+   so there better not be any handlers or exception thrown here. */
+
 extern "C" void
 _Jv_Throw (void *value)
 {
@@ -151,5 +154,12 @@
   ehinfo->eh_info.language = EH_LANG_Java;
   ehinfo->eh_info.version = 1;
   ehinfo->value = value;
-  __throw();
+
+/* We're happy with setjmp/longjmp exceptions or region-based
+   exception handlers: entry points are provided here for both.  */
+#ifdef SJLJ_EXCEPTIONS
+  __sjthrow ();
+#else
+  __throw ();
+#endif
 }
Index: gij.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/gij.cc,v
retrieving revision 1.5
diff -u -r1.5 gij.cc
--- gij.cc	1999/10/22 19:43:39	1.5
+++ gij.cc	1999/11/19 18:30:53
@@ -89,7 +89,7 @@
 	{
 	  if (i >= argc - 1)
 	    {
-	    no_argument:
+	    no_arg:
 	      fprintf (stderr, "gij: option requires an argument -- `%s'\n",
 		       argv[i]);
 	      fprintf (stderr, "Try `gij --help' for more information.\n");
@@ -102,7 +102,7 @@
       else if (! strcmp (arg, "-mx"))
 	{
 	  if (i >= argc - 1)
-	    goto no_argument;
+	    goto no_arg;
 	  _Jv_SetMaximumHeapSize (argv[++i]);
 	}
       else
Index: libgcj.spec.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/libgcj.spec.in,v
retrieving revision 1.6
diff -u -r1.6 libgcj.spec.in
--- libgcj.spec.in	1999/09/22 20:44:41	1.6
+++ libgcj.spec.in	1999/11/19 18:30:53
@@ -6,4 +6,5 @@
 %rename lib liborig
 *lib: -lgcj -lm @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(liborig)
 
-*jc1:  @DIVIDESPEC@
+*jc1:  @DIVIDESPEC@ @EXCEPTIONSPEC@
+
Index: gcj/Makefile.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- Makefile.in	1999/09/10 22:03:06	1.1
+++ Makefile.in	1999/11/19 18:30:58
@@ -74,6 +74,7 @@
 DIVIDESPEC = @DIVIDESPEC@
 DLLTOOL = @DLLTOOL@
 EH_COMMON_INCLUDE = @EH_COMMON_INCLUDE@
+EXCEPTIONSPEC = @EXCEPTIONSPEC@
 EXEEXT = @EXEEXT@
 GCDEPS = @GCDEPS@
 GCINCS = @GCINCS@
@@ -89,6 +90,7 @@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 NM = @NM@
+OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 PERL = @PERL@
 RANLIB = @RANLIB@
@@ -98,7 +100,6 @@
 THREADLIBS = @THREADLIBS@
 THREADOBJS = @THREADOBJS@
 THREADSPEC = @THREADSPEC@
-USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
 VERSION = @VERSION@
 ZDEPS = @ZDEPS@
 ZINCS = @ZINCS@
Index: gcj/cni.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/cni.h,v
retrieving revision 1.1
diff -u -r1.1 cni.h
--- cni.h	1999/09/10 22:03:06	1.1
+++ cni.h	1999/11/19 18:30:58
@@ -109,6 +109,10 @@
     { _Jv_MonitorExit (obj); }
 };
 
+#ifdef SJLJ_EXCEPTIONS
+#define _Jv_Throw _Jv_Sjlj_Throw
+#endif
+
 // Throw some exception.
 extern void JvThrow (jobject obj) __attribute__ ((__noreturn__));
 extern inline void
Index: gcj/javaprims.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/javaprims.h,v
retrieving revision 1.1
diff -u -r1.1 javaprims.h
--- javaprims.h	1999/09/10 22:03:06	1.1
+++ javaprims.h	1999/11/19 18:30:58
@@ -269,6 +269,7 @@
 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
 
 extern "C" void _Jv_Throw (void *) __attribute__ ((__noreturn__));
+extern "C" void _Jv_Sjlj_Throw (void *) __attribute__ ((__noreturn__));
 extern "C" void* _Jv_Malloc (jsize);
 extern "C" void _Jv_Free (void*);
 
Index: include/default-signal.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/default-signal.h,v
retrieving revision 1.2
diff -u -r1.2 default-signal.h
--- default-signal.h	1999/04/20 06:27:09	1.2
+++ default-signal.h	1999/11/19 18:31:03
@@ -11,11 +11,44 @@
 #ifndef JAVA_SIGNAL_H
 #define JAVA_SIGNAL_H 1
 
+#ifdef SJLJ_EXCEPTIONS
+
+#define HANDLE_SEGV
+#define HANDLE_FPE
+
+#include <signal.h>
+
+#define SIGNAL_HANDLER(_name)			\
+static void _name (int _dummy)
+
+#define INIT_SEGV						\
+do								\
+  {								\
+    nullp = new java::lang::NullPointerException ();		\
+    signal (SIGSEGV, catch_segv);				\
+  }								\
+while (0)							
+								
+#define INIT_FPE						\
+do								\
+  {								\
+    arithexception = new java::lang::ArithmeticException 	\
+      (JvNewStringLatin1 ("/ by zero"));			\
+    signal (SIGFPE, catch_fpe);					\
+  }								\
+while (0)
+
+#define MAKE_THROW_FRAME  do {} while (0)
+
+#else /* SJLJ_EXCEPTIONS */
+
 #undef HANDLE_SEGV
 #undef HANDLE_FPE
 
 #define INIT_SEGV   do {} while (0)
 #define INIT_FPE   do {} while (0)
+
+#endif /* SJLJ_EXCEPTIONS */
 
 #endif /* JAVA_SIGNAL_H */
   
Index: java/lang/natDouble.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natDouble.cc,v
retrieving revision 1.3
diff -u -r1.3 natDouble.cc
--- natDouble.cc	1999/09/10 22:03:08	1.3
+++ natDouble.cc	1999/11/19 18:31:06
@@ -8,6 +8,8 @@
 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
 details.  */
 
+#include <config.h>
+
 /* AIX requires this to be the first thing in the file.  */
 #ifndef __GNUC__
 # if HAVE_ALLOCA_H

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]