summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-05-12 11:11:58 +0000
committersimonmar <unknown>2005-05-12 11:11:58 +0000
commit5de5996013180243efbe6e4145b1d23eaebb8741 (patch)
treef9e08c26acbf7f36bf70501fd7a2c4ba5029c09b /ghc/compiler/codeGen
parent600d395c879c78480955ae8c157e1e750e17a823 (diff)
downloadhaskell-5de5996013180243efbe6e4145b1d23eaebb8741.tar.gz
[project @ 2005-05-12 11:11:58 by simonmar]
SMP: we need to assign the result of resumeThread to BaseReg, because we might now have a new Capability. (this was an interesting bug to find...)
Diffstat (limited to 'ghc/compiler/codeGen')
-rw-r--r--ghc/compiler/codeGen/CgForeignCall.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/ghc/compiler/codeGen/CgForeignCall.hs b/ghc/compiler/codeGen/CgForeignCall.hs
index 9897651116..417c3c5c0e 100644
--- a/ghc/compiler/codeGen/CgForeignCall.hs
+++ b/ghc/compiler/codeGen/CgForeignCall.hs
@@ -32,7 +32,7 @@ import MachOp
import SMRep
import ForeignCall
import Constants
-import StaticFlags ( opt_SccProfilingOn )
+import StaticFlags ( opt_SccProfilingOn, opt_SMP )
import Outputable
import Monad ( when )
@@ -78,13 +78,20 @@ emitForeignCall results (CCall (CCallSpec target cconv safety)) args live
vols <- getVolatileRegs live
id <- newTemp wordRep
emitSaveThreadState
- stmtC (CmmCall (CmmForeignCall suspendThread CCallConv) [(id,NoHint)]
+ stmtC (CmmCall (CmmForeignCall suspendThread CCallConv)
+ [(id,NoHint)]
[ (CmmReg (CmmGlobal BaseReg), PtrHint) ]
(Just vols)
)
stmtC (the_call vols)
- stmtC (CmmCall (CmmForeignCall resumeThread CCallConv) []
- [ (CmmReg id, NoHint) ] (Just vols)
+ stmtC (CmmCall (CmmForeignCall resumeThread CCallConv)
+ (if opt_SMP then [(CmmGlobal BaseReg, PtrHint)] else [])
+ -- Assign the result to BaseReg: we might now have
+ -- a different Capability! Small optimisation:
+ -- only do this in SMP mode, where there are >1
+ -- Capabilities.
+ [ (CmmReg id, NoHint) ]
+ (Just vols)
)
emitLoadThreadState