From 794bd55f5757b6da615c55cf0b11b04ef6015802 Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 25 May 2011 15:53:17 +0000 Subject: [PATCH] partial revert git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33115 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 22 ++++++++++++++-------- Source/NSObject.m | 26 ++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1cd748d9..c3a133b4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-05-25 Richard Frith-Macdonald + + * Source/NSObject.m: + Make last assembler attempt conditional ... I'm far from sure it's + correct. + 2011-05-25 11:15 David Chisnall * Headers/Foundation/NSZone.h, @@ -7,14 +13,14 @@ * Source/NSNotificationCenter.m, * Source/NSObject.m, * Source/NSZone.m: - More tweaks for garbage collection mode, including making - NSNotificationCenter use weak pointers (things are never removed if it - uses strong pointers because they remove themselves in the -dealloc - method, which is never called, and can't remove themselves in the - -finalize method because the -finalize method would not be called until - after they have been removed - this is consistent with Apple behaviour). - - Gorm now works correctly when built with GC enabled. + More tweaks for garbage collection mode, including making + NSNotificationCenter use weak pointers (things are never removed if it + uses strong pointers because they remove themselves in the -dealloc + method, which is never called, and can't remove themselves in the + -finalize method because the -finalize method would not be called + until after they have been removed - this is consistent with Apple + behaviour). + Gorm now works correctly when built with GC enabled. 2011-05-25 Richard Frith-Macdonald diff --git a/Source/NSObject.m b/Source/NSObject.m index 6124e5006..6e136f894 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -226,7 +226,8 @@ typedef int32_t volatile *gsatomic_t; #define GSATOMICREAD(X) (*(X)) -int +#ifdef ATOMICTEST +static __inline__ int GSAtomicIncrement(gsatomic_t X) { int32_t tmp = 1; @@ -238,7 +239,7 @@ GSAtomicIncrement(gsatomic_t X) return tmp; } -int +static __inline__ int GSAtomicDecrement(gsatomic_t X) { int32_t tmp = -1; @@ -249,6 +250,27 @@ GSAtomicDecrement(gsatomic_t X) :"memory" ); return tmp; } +#else + +static __inline__ int +GSAtomicIncrement(gsatomic_t X) +{ + __asm__ __volatile__ ( + "lock addl $1, %0" + :"=m" (*X)); + return *X; +} + +static __inline__ int +GSAtomicDecrement(gsatomic_t X) +{ + __asm__ __volatile__ ( + "lock subl $1, %0" + :"=m" (*X)); + return *X; +} + +#endif #elif defined(__PPC__) || defined(__POWERPC__)