attempt multithreading bugfix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33107 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-05-25 09:20:42 +00:00
parent 6068e9484c
commit a439972605
2 changed files with 23 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2011-05-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSObject.m:
Attempt fix for atomic assembler on x86 (bug #33392)
2011-05-24 David Chisnall <theraven@gna.org>
* Source/NSBundle.m
@ -6,12 +11,12 @@
* Source/NSZone.m
* Source/NSObject.m
* Source/NSAutoreleasePool.m
First pass at supporting fully Apple-compatible GC in -base. Code sitting
First pass at supporting fully Apple-compatible GC in -base.
Code sitting
on top of -base should not require modifying (in theory, at least, and
unless it does the sort of evil tricks that LanguageKit does for
performance).
2011-05-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAutoreleasePool.m:

View file

@ -226,22 +226,28 @@ typedef int32_t volatile *gsatomic_t;
#define GSATOMICREAD(X) (*(X))
static __inline__ int
int
GSAtomicIncrement(gsatomic_t X)
{
__asm__ __volatile__ (
"lock addl $1, %0"
:"=m" (*X));
return *X;
int32_t tmp = 1;
__asm__ __volatile__ (
"lock xaddl %0, %1"
:"=r" (tmp), "=m" (*X)
:"r" (tmp), "m" (*X)
:"memory" );
return tmp;
}
static __inline__ int
int
GSAtomicDecrement(gsatomic_t X)
{
__asm__ __volatile__ (
"lock subl $1, %0"
:"=m" (*X));
return *X;
int32_t tmp = -1;
__asm__ __volatile__ (
"lock xaddl %0, %1"
:"=r" (tmp), "=m" (*X)
:"r" (tmp), "m" (*X)
:"memory" );
return tmp;
}
#elif defined(__PPC__) || defined(__POWERPC__)