summaryrefslogtreecommitdiff
path: root/rts/PrimOps.cmm
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-06-15 19:07:58 +0100
committerIan Lynagh <ian@well-typed.com>2013-06-15 19:07:58 +0100
commit75947bb63794cae5950f679c8df86441b736b3fa (patch)
treed99b4deb0596840c40fac73ef22344e676102d7e /rts/PrimOps.cmm
parent9a8c20d0d7956843cc7fbbd24f5592ea39c81be9 (diff)
downloadhaskell-75947bb63794cae5950f679c8df86441b736b3fa.tar.gz
Optimise lockClosure when n_capabilities == 1; fixes #693
Based on a patch from Yuras Shumovich.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r--rts/PrimOps.cmm28
1 files changed, 24 insertions, 4 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index c12c6d8638..a227e776a7 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -1193,7 +1193,12 @@ stg_takeMVarzh ( P_ mvar /* :: MVar a */ )
W_ val, info, tso, q;
#if defined(THREADED_RTS)
- ("ptr" info) = ccall lockClosure(mvar "ptr");
+ if (CInt[n_capabilities] == 1 :: CInt) {
+ info = GET_INFO(mvar);
+ }
+ else {
+ ("ptr" info) = ccall reallyLockClosure(mvar "ptr");
+ }
#else
info = GET_INFO(mvar);
#endif
@@ -1290,7 +1295,12 @@ stg_tryTakeMVarzh ( P_ mvar /* :: MVar a */ )
W_ val, info, tso, q;
#if defined(THREADED_RTS)
- ("ptr" info) = ccall lockClosure(mvar "ptr");
+ if (CInt[n_capabilities] == 1 :: CInt) {
+ info = GET_INFO(mvar);
+ }
+ else {
+ ("ptr" info) = ccall reallyLockClosure(mvar "ptr");
+ }
#else
info = GET_INFO(mvar);
#endif
@@ -1361,7 +1371,12 @@ stg_putMVarzh ( P_ mvar, /* :: MVar a */
W_ info, tso, q;
#if defined(THREADED_RTS)
- ("ptr" info) = ccall lockClosure(mvar "ptr");
+ if (CInt[n_capabilities] == 1 :: CInt) {
+ info = GET_INFO(mvar);
+ }
+ else {
+ ("ptr" info) = ccall reallyLockClosure(mvar "ptr");
+ }
#else
info = GET_INFO(mvar);
#endif
@@ -1454,7 +1469,12 @@ stg_tryPutMVarzh ( P_ mvar, /* :: MVar a */
W_ info, tso, q;
#if defined(THREADED_RTS)
- ("ptr" info) = ccall lockClosure(mvar "ptr");
+ if (CInt[n_capabilities] == 1 :: CInt) {
+ info = GET_INFO(mvar);
+ }
+ else {
+ ("ptr" info) = ccall reallyLockClosure(mvar "ptr");
+ }
#else
info = GET_INFO(mvar);
#endif