projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Provide the pkgroot value in ghc-pkg dump & describe when necessary
[ghc-hetmet.git]
/
rts
/
PrimOps.cmm
diff --git
a/rts/PrimOps.cmm
b/rts/PrimOps.cmm
index
7a7942a
..
e17c6fb
100644
(file)
--- a/
rts/PrimOps.cmm
+++ b/
rts/PrimOps.cmm
@@
-212,6
+212,7
@@
stg_unsafeThawArrayzh
}
}
}
}
+
/* -----------------------------------------------------------------------------
MutVar primitives
-------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
MutVar primitives
-------------------------------------------------------------------------- */
@@
-230,6
+231,25
@@
stg_newMutVarzh
RET_P(mv);
}
RET_P(mv);
}
+stg_casMutVarzh
+ /* MutVar# s a -> a -> a -> State# s -> (# State#, Int#, a #) */
+{
+ W_ mv, old, new, h;
+
+ mv = R1;
+ old = R2;
+ new = R3;
+
+ (h) = foreign "C" cas(mv + SIZEOF_StgHeader + OFFSET_StgMutVar_var,
+ old, new) [];
+ if (h != old) {
+ RET_NP(1,h);
+ } else {
+ RET_NP(0,h);
+ }
+}
+
+
stg_atomicModifyMutVarzh
{
W_ mv, f, z, x, y, r, h;
stg_atomicModifyMutVarzh
{
W_ mv, f, z, x, y, r, h;
@@
-631,7
+651,7
@@
stg_threadStatuszh
W_ tso;
W_ why_blocked;
W_ what_next;
W_ tso;
W_ why_blocked;
W_ what_next;
- W_ ret;
+ W_ ret, cap, locked;
tso = R1;
tso = R1;
@@
-651,7
+671,16
@@
stg_threadStatuszh
ret = why_blocked;
}
}
ret = why_blocked;
}
}
- RET_N(ret);
+
+ cap = TO_W_(Capability_no(StgTSO_cap(tso)));
+
+ if ((TO_W_(StgTSO_flags(tso)) & TSO_LOCKED) != 0) {
+ locked = 1;
+ } else {
+ locked = 0;
+ }
+
+ RET_NNN(ret,cap,locked);
}
/* -----------------------------------------------------------------------------
}
/* -----------------------------------------------------------------------------