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]
Other format: [Raw text]

[rfc] remaining Class_1 problem on ia64


So the remaining problem is that &function is a descriptor on
ia64 (and others).  I've verified that I get good results with
the following hack.

My question is how would yall like this done proper-like?  A
new header file?  Stuff this define into sysdep/backtrace.h?


r~


Index: stacktrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/stacktrace.cc,v
retrieving revision 1.7
diff -u -p -d -r1.7 stacktrace.cc
--- stacktrace.cc	15 May 2005 17:07:20 -0000	1.7
+++ stacktrace.cc	24 May 2005 21:17:54 -0000
@@ -30,6 +30,15 @@ details.  */
 
 #include <sysdep/backtrace.h>
 
+// ??? Not the right place to put this.
+#ifdef __ia64__
+// The function descriptor is actually 2 words, but we don't care about
+// anything except the first.
+#define UNWRAP_FUNCTION_DESCRIPTOR(X)  ((X) = *(void **)(X))
+#else
+#define UNWRAP_FUNCTION_DESCRIPTOR(X)
+#endif
+
 using namespace java::lang;
 using namespace java::lang::reflect;
 using namespace java::util;
@@ -62,12 +71,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);
+	      UNWRAP_FUNCTION_DESCRIPTOR (ncode);
+	      ncodeMap->put ((java::lang::Object *)ncode, klass);
 	    }
 	}
     }


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