This is the mail archive of the java-patches@gcc.gnu.org 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]

Patch: support non-libffi enabled platforms



Some platforms still don't have libffi support.  This patch introduces
"graceful" degredation in functionality....

2001-02-10  Anthony Green  <green@redhat.com>

	* configure.host: Define with_libffi.
	* configure.in: Define USING_LIBFFI accordingly.
	* configure: Rebuilt.
	* include/config.h.in: Add USING_LIBFFI.
	* java/lang/reflect/natMethod.cc: Obey USING_LIBFFI.

Index: libjava/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.73
diff -u -r1.73 configure.in
--- configure.in	2001/02/05 05:46:15	1.73
+++ configure.in	2001/02/11 07:05:58
@@ -155,6 +155,13 @@
       ;;
 esac
 
+case "$with_libffi" in
+    yes)
+        AC_DEFINE(USING_LIBFFI)
+	;;
+    *)  ;;
+esac
+
 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED))
 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED))
 AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
Index: libjava/configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.15
diff -u -r1.15 configure.host
--- configure.host	2001/02/05 05:49:44	1.15
+++ configure.host	2001/02/11 07:05:59
@@ -46,6 +46,7 @@
 echo "$target"
 
 DIVIDESPEC=-fuse-divide-subroutine
+with_libffi=no
 
 case "${host}" in
   mips-tx39-*|mipstx39-unknown-*)
@@ -56,6 +57,7 @@
 	PROCESS=Ecos
  	enable_java_net_default=no
  	enable_getenv_properties_default=no
+	with_libffi=yes;
 	;;
   i686-*|i586-*|i486-*|i386-*)
 	libgcj_flags="${libgcj_flags} -ffloat-store"
@@ -63,18 +65,25 @@
 	libgcj_cxxflags="-D__NO_MATH_INLINES"
 	libgcj_cflags="-D__NO_MATH_INLINES"
 	DIVIDESPEC=-fno-use-divide-subroutine
+	with_libffi=yes;
 	;;
   alpha*-*)
 	libgcj_flags="${libgcj_flags} -mieee"
 	libgcj_interpreter=yes
 	libgcj_sjlj=yes
+	with_libffi=yes;
 	;;
   sparc-*)
+	with_libffi=yes;
         ;;
   ia64-*)
         libgcj_flags="${libgcj_flags} -funwind-tables"
 	libgcj_sjlj=yes
 	libgcj_interpreter=yes
+	with_libffi=yes;
+	;;
+  powerpc-*)
+	with_libffi=yes;
 	;;
   *)
         libgcj_sjlj=yes
Index: libjava/include/config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/config.h.in,v
retrieving revision 1.27
diff -u -r1.27 config.h.in
--- config.h.in	2001/01/12 19:16:05	1.27
+++ config.h.in	2001/02/11 07:05:59
@@ -371,3 +374,8 @@
 /* Define if struct hostent_data is defined in netdb.h */
 #undef HAVE_STRUCT_HOSTENT_DATA
 
+/* Define if using libffi */
+#undef USING_LIBFFI
Index: libjava/java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.20
diff -u -r1.20 natMethod.cc
--- natMethod.cc	2001/01/08 23:28:56	1.20
+++ natMethod.cc	2001/02/11 07:06:00
@@ -44,7 +44,9 @@
 
 #include <stdlib.h>
 
+#ifdef USING_LIBFFI
 #include <ffi.h>
+#endif
 
 // FIXME: remove these.
 #define BooleanClass java::lang::Boolean::class$
@@ -107,6 +109,7 @@
   return fromx <= tox;
 }
 
+#ifdef USING_LIBFFI
 static inline ffi_type *
 get_ffi_type (jclass klass)
 {
@@ -148,6 +151,7 @@
 
   return r;
 }
+#endif
 
 jobject
 java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
@@ -312,6 +316,9 @@
 		    jvalue *args,
 		    jvalue *result)
 {
+#ifndef USING_LIBFFI  
+  JvFail ("method invocation required libffi");
+#else
   JvAssert (! is_constructor || ! obj);
   JvAssert (! is_constructor || return_type);
 
@@ -428,6 +435,7 @@
     result->l = obj;
 
   return ex;
+#endif
 }
 
 // This is another version of _Jv_CallAnyMethodA, but this one does


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