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

fix locking for ppc64 on Darwin


This patch
- makes sure that locks are properly treated as 64-bit on Darwin ppc64
- fixes a bug that probably no-one has ever encountered on linux
  powerpc64 relating to the type of the return value.

Tested by bootstrapping on powerpc-darwin8 with 64-bit multilibs
enabled, and running the java testsuite in 32-bit mode (2 failures,
good!) and in 64-bit mode (lots of failures, two-thirds of which are
due to not having a 64-bit libiconv).  At least one program works in
64-bit mode, gcj-dbtool.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/libjava-ppc64locks.patch==================
2005-09-28  Geoffrey Keating  <geoffk@apple.com>

	* sysdep/powerpc/locks.h: Use 64-bit versions of primitives when
	__LP64__ is defined rather than __powerpc64__.
	(compare_and_swap): 'ret' is an obj_addr_t not just an int.
	(compare_and_swap_release): Likewise.

Index: sysdep/powerpc/locks.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/sysdep/powerpc/locks.h,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 locks.h
--- sysdep/powerpc/locks.h	7 Jul 2004 18:24:00 -0000	1.4
+++ sysdep/powerpc/locks.h	28 Sep 2005 19:27:30 -0000
@@ -11,7 +11,7 @@ details.  */
 #ifndef __SYSDEP_LOCKS_H__
 #define __SYSDEP_LOCKS_H__
 
-#ifdef __powerpc64__
+#ifdef __LP64__
 #define _LARX "ldarx "
 #define _STCX "stdcx. "
 #else
@@ -30,7 +30,7 @@ inline static bool
 compare_and_swap (volatile obj_addr_t *addr, obj_addr_t old,
 		  obj_addr_t new_val) 
 {
-  int ret;
+  obj_addr_t ret;
 
   __asm__ __volatile__ (
 	   "0:    " _LARX "%0,0,%1 \n"
@@ -62,7 +62,7 @@ inline static bool
 compare_and_swap_release (volatile obj_addr_t *addr, obj_addr_t old,
 			  obj_addr_t new_val)
 {
-  int ret;
+  obj_addr_t ret;
 
   __asm__ __volatile__ ("sync" : : : "memory");
 
============================================================


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