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]

Re: [PowerPC64] Fix FAIL: ExtraClassLoader execution - gij test


On Tue, Nov 29, 2005 at 10:16:30PM -0500, Andrew Pinski wrote:
> > 
> > > 
> > > Fixes two libjava testsuite failures on powerpc64-linux.  Bootstrapped
> > > and regression tested powerpc64-linux and powerpc-linux.  OK for 4.1 and
> > > 4.2?
> > > 
> > > 	* stacktrace.cc (UnwindTraceFn): For powerpc64, compare the function
> > > 	code entry not the function descriptor against _Unwind_GetRegionStart.
> > 
> > Isn't there a macro to do this?
> 
> Yes there is, in fact it is already used in stacktrace.cc.
> 
> UNWRAP_FUNCTION_DESCRIPTOR is the macro which you should use here.

Revised patch.  OK 4.1 and 4.2?

	* stacktrace.cc (UnwindTraceFn): Use UNWRAP_FUNCTION_DESCRIPTOR
	to compare _Jv_InterpMethod::run against current func.

Index: libjava/stacktrace.cc
===================================================================
--- libjava/stacktrace.cc	(revision 107640)
+++ libjava/stacktrace.cc	(working copy)
@@ -108,16 +108,17 @@ _Jv_StackTrace::UnwindTraceFn (struct _U
       state->frames = (_Jv_StackFrame *) newFrames;
       state->length = newLength;
     }
-  
-  _Unwind_Ptr func_addr = _Unwind_GetRegionStart (context);
-  
+
+  void *func_addr = (void *) _Unwind_GetRegionStart (context);
+
   // If we see the interpreter's main function, "pop" an entry off the 
   // interpreter stack and use that instead, so that the trace goes through 
   // the java code and not the interpreter itself. This assumes a 1:1 
   // correspondance between call frames in the interpreted stack and occurances
   // of _Jv_InterpMethod::run() on the native stack.
 #ifdef INTERPRETER
-  if ((void (*)(void)) func_addr == (void (*)(void)) &_Jv_InterpMethod::run)
+  void *interp_run = (void *) &_Jv_InterpMethod::run;
+  if (func_addr == UNWRAP_FUNCTION_DESCRIPTOR (interp_run))
     {
       state->frames[pos].type = frame_interpreter;
       state->frames[pos].interp.meth = state->interp_frame->self;
@@ -129,7 +130,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _U
     {
       state->frames[pos].type = frame_native;
       state->frames[pos].ip = (void *) _Unwind_GetIP (context);
-      state->frames[pos].start_ip = (void *) func_addr;
+      state->frames[pos].start_ip = func_addr;
     }
 
   //printf ("unwind ip: %p\n", _Unwind_GetIP (context));

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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