[rfc] remaining Class_1 problem on ia64

Richard Henderson rth@redhat.com
Wed May 25 20:17:00 GMT 2005


On Wed, May 25, 2005 at 12:58:12PM -0600, Tom Tromey wrote:
> Somewhere in sysdep seems logical to me.

I'm testing the following.



r~



Index: libjava/configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.ac,v
retrieving revision 1.30
diff -u -p -d -r1.30 configure.ac
--- libjava/configure.ac	18 May 2005 02:03:44 -0000	1.30
+++ libjava/configure.ac	25 May 2005 18:14:10 -0000
@@ -707,6 +707,7 @@ AM_CONDITIONAL(USING_NO_THREADS, test "$
 if test -d sysdep; then true; else mkdir sysdep; fi
 AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir/locks.h)
 AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
+AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
 
 HASH_SYNC_SPEC=
 # Hash synchronization is only useful with posix threads right now.
Index: libjava/configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.67
diff -u -p -d -r1.67 configure.host
--- libjava/configure.host	13 May 2005 00:21:01 -0000	1.67
+++ libjava/configure.host	25 May 2005 18:14:10 -0000
@@ -32,6 +32,7 @@
 #                       (i.e it is broken).
 #   fallback_backtrace_h  Header to use for fallback backtrace implementation
 #			  (only for targets that don't support DWARF2 unwind)
+#   descriptor_h	Header to use for looking past function descriptors
 
 libgcj_flags=
 libgcj_cflags=
@@ -268,6 +269,19 @@ case "${host}" in
   ;;
 esac
 
+case "${host}" in
+  ia64-* | hppa*-*)
+	descriptor_h=sysdep/descriptor-y.h
+	;;
+
+  rs6000-* | powerpc*-*)
+	descriptor_h=sysdep/powerpc/descriptor.h
+	;;
+
+  *)
+	descriptor_h=sysdep/descriptor-n.h
+	;;
+esac
 
 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
Index: libjava/stacktrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/stacktrace.cc,v
retrieving revision 1.7
diff -u -p -d -r1.7 stacktrace.cc
--- libjava/stacktrace.cc	15 May 2005 17:07:20 -0000	1.7
+++ libjava/stacktrace.cc	25 May 2005 18:14:10 -0000
@@ -29,6 +29,7 @@ details.  */
 #include <gnu/gcj/runtime/NameFinder.h>
 
 #include <sysdep/backtrace.h>
+#include <sysdep/descriptor.h>
 
 using namespace java::lang;
 using namespace java::lang::reflect;
@@ -62,12 +63,12 @@ _Jv_StackTrace::UpdateNCodeMap ()
       for (int i=0; i < klass->method_count; i++)
         {
 	  _Jv_Method *method = &klass->methods[i];
+	  void *ncode = method->ncode;
 	  // Add non-abstract methods to ncodeMap.
-	  if (method->ncode)
+	  if (ncode)
 	    {
-	      //printf("map->put 0x%x / %s.%s\n", method->ncode, klass->name->data,
-	      //  method->name->data);
-	      ncodeMap->put ((java::lang::Object *) method->ncode, klass);
+	      ncode = UNWRAP_FUNCTION_DESCRIPTOR (ncode);
+	      ncodeMap->put ((java::lang::Object *)ncode, klass);
 	    }
 	}
     }
Index: libjava/sysdep/descriptor-n.h
===================================================================
RCS file: libjava/sysdep/descriptor-n.h
diff -N libjava/sysdep/descriptor-n.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/sysdep/descriptor-n.h	25 May 2005 18:14:11 -0000
@@ -0,0 +1,3 @@
+// Given a function pointer, return the code address.
+
+#define UNWRAP_FUNCTION_DESCRIPTOR(X)  (X)
Index: libjava/sysdep/descriptor-y.h
===================================================================
RCS file: libjava/sysdep/descriptor-y.h
diff -N libjava/sysdep/descriptor-y.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/sysdep/descriptor-y.h	25 May 2005 18:14:11 -0000
@@ -0,0 +1,5 @@
+// Given a function pointer, return the code address.
+
+// The function descriptor is actually multiple words,
+// but we don't care about anything except the first.
+#define UNWRAP_FUNCTION_DESCRIPTOR(X)  (*(void **)(X))
Index: libjava/sysdep/powerpc/descriptor.h
===================================================================
RCS file: libjava/sysdep/powerpc/descriptor.h
diff -N libjava/sysdep/powerpc/descriptor.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/sysdep/powerpc/descriptor.h	25 May 2005 18:14:11 -0000
@@ -0,0 +1,9 @@
+// Given a function pointer, return the code address.
+
+#ifdef _CALL_AIX
+// The function descriptor is actually multiple words,
+// but we don't care about anything except the first.
+# define UNWRAP_FUNCTION_DESCRIPTOR(X)  (*(void **)(X))
+#else
+# define UNWRAP_FUNCTION_DESCRIPTOR(X)  (X)
+#endif



More information about the Java-patches mailing list