[commit: ghc] ghc-lwc2: Fixes for atomicSwitch argument (7b98109)

Ian Lynagh igloo at earth.li
Thu Feb 28 15:19:47 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : ghc-lwc2

http://hackage.haskell.org/trac/ghc/changeset/7b9810997af5527ddb22c400b2045b4788375ba4

>---------------------------------------------------------------

commit 7b9810997af5527ddb22c400b2045b4788375ba4
Author: KC Sivaramakrishnan <chandras at cs.purdue.edu>
Date:   Sat Feb 23 12:38:36 2013 -0500

    Fixes for atomicSwitch argument

>---------------------------------------------------------------

 libraries/base/LwConc/Substrate.hs | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libraries/base/LwConc/Substrate.hs b/libraries/base/LwConc/Substrate.hs
index 76b0ef7..58bdaa7 100644
--- a/libraries/base/LwConc/Substrate.hs
+++ b/libraries/base/LwConc/Substrate.hs
@@ -303,13 +303,13 @@ data SContSwitchReason = Yielded |
                          Completed
 
 getIntFromStatus x = case x of
-                          SContRunning -> 0#
-                          SContSwitched Yielded -> 1#
-                          SContSwitched (BlockedInHaskell _) -> 2#
-                          SContSwitched BlockedInRTS -> 3#
-                          SContSwitched Completed -> 4#
-                          SContKilled -> 5#
-                          otherwise -> 6#
+                          SContRunning -> 0
+                          SContSwitched Yielded -> 1
+                          SContSwitched (BlockedInHaskell _) -> 2
+                          SContSwitched BlockedInRTS -> 3
+                          SContSwitched Completed -> 4
+                          SContKilled -> 5
+                          otherwise -> 6
 
 {-# INLINE getSContStatus #-}
 getSContStatus :: SCont -> PTM SContStatus
@@ -352,7 +352,7 @@ switchTo targetSCont = do
   -- Get Int# version of current thread's status to pass to atomicSwitch#
   currentSCont <- getSCont
   status <- getSContStatus currentSCont
-  let intStatus = getIntFromStatus status
+  let (I# intStatus) = getIntFromStatus status
   let SCont targetSCont# = targetSCont
   PTM $ \s ->
     case (atomicSwitch# targetSCont# intStatus s) of s1 -> (# s1, () #)





More information about the ghc-commits mailing list