projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
86db518
)
enable the x86-specific versions of atomic_inc()/atomic_dec()
author
Simon Marlow
<marlowsd@gmail.com>
Wed, 29 Jul 2009 07:53:07 +0000
(07:53 +0000)
committer
Simon Marlow
<marlowsd@gmail.com>
Wed, 29 Jul 2009 07:53:07 +0000
(07:53 +0000)
includes/SMP.h
patch
|
blob
|
history
diff --git
a/includes/SMP.h
b/includes/SMP.h
index
7592abb
..
b753842
100644
(file)
--- a/
includes/SMP.h
+++ b/
includes/SMP.h
@@
-185,14
+185,14
@@
cas(StgVolatilePtr p, StgWord o, StgWord n)
EXTERN_INLINE StgWord
atomic_inc(StgVolatilePtr p)
{
EXTERN_INLINE StgWord
atomic_inc(StgVolatilePtr p)
{
-#if 0 // defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
StgWord r;
r = 1;
__asm__ __volatile__ (
"lock\nxadd %0,%1":
"+r" (r), "+m" (*p):
);
StgWord r;
r = 1;
__asm__ __volatile__ (
"lock\nxadd %0,%1":
"+r" (r), "+m" (*p):
);
- return r;
+ return r+1;
#else
StgWord old, new;
do {
#else
StgWord old, new;
do {
@@
-206,14
+206,14
@@
atomic_inc(StgVolatilePtr p)
EXTERN_INLINE StgWord
atomic_dec(StgVolatilePtr p)
{
EXTERN_INLINE StgWord
atomic_dec(StgVolatilePtr p)
{
-#if 0 //defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
StgWord r;
r = (StgWord)-1;
__asm__ __volatile__ (
"lock\nxadd %0,%1":
"+r" (r), "+m" (*p):
);
StgWord r;
r = (StgWord)-1;
__asm__ __volatile__ (
"lock\nxadd %0,%1":
"+r" (r), "+m" (*p):
);
- return r;
+ return r-1;
#else
StgWord old, new;
do {
#else
StgWord old, new;
do {