summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmMonad.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-08-02 15:20:44 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-08-06 09:47:32 +0100
commit6228e318eabcba88c289d48287abc224fa57901d (patch)
tree240f63628f849643da0d3d8dafceeb052f8cb38c /compiler/codeGen/StgCmmMonad.hs
parent290ec750343a340d5f2cef8bf844f3822c9629e0 (diff)
downloadhaskell-6228e318eabcba88c289d48287abc224fa57901d.tar.gz
Use "ReturnedTo" when generating safe foreign calls
Diffstat (limited to 'compiler/codeGen/StgCmmMonad.hs')
-rw-r--r--compiler/codeGen/StgCmmMonad.hs21
1 files changed, 4 insertions, 17 deletions
diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs
index eb6b9a988f..3d34cb9bdd 100644
--- a/compiler/codeGen/StgCmmMonad.hs
+++ b/compiler/codeGen/StgCmmMonad.hs
@@ -30,7 +30,7 @@ module StgCmmMonad (
getCodeR, getCode, getHeapUsage,
mkCmmIfThenElse, mkCmmIfThen, mkCmmIfGoto,
- mkCall, mkCmmCall, mkSafeCall,
+ mkCall, mkCmmCall,
forkClosureBody, forkStatics, forkAlts, forkProc, codeOnly,
@@ -95,6 +95,9 @@ infixr 9 `thenFC`
newtype FCode a = FCode (CgInfoDownwards -> CgState -> (a, CgState))
+instance Functor FCode where
+ fmap f (FCode g) = FCode $ \i s -> let (a,s') = g i s in (f a, s')
+
instance Monad FCode where
(>>=) = thenFC
return = returnFC
@@ -792,22 +795,6 @@ mkCmmCall f results actuals updfr_off
= mkCall f (NativeDirectCall, NativeReturn) results actuals updfr_off (0,[])
-mkSafeCall :: ForeignTarget -> [CmmFormal] -> [CmmActual]
- -> UpdFrameOffset -> Bool
- -> FCode CmmAGraph
-mkSafeCall t fs as upd i = do
- k <- newLabelC
- let (_off, copyout) = copyInOflow NativeReturn (Young k) fs
- -- see Note [safe foreign call convention]
- return
- ( mkStore (CmmStackSlot (Young k) (widthInBytes wordWidth))
- (CmmLit (CmmBlock k))
- <*> mkLast (CmmForeignCall { tgt=t, res=fs, args=as, succ=k
- , updfr=upd, intrbl=i })
- <*> mkLabel k
- <*> copyout
- )
-
-- ----------------------------------------------------------------------------
-- CgStmts