X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fprelude%2FForeignCall.lhs;h=015b28e2fe3403f74156aa9186006316bed18166;hb=30a08433b46de89511fcdf0149f0749739227efb;hp=27f5b4f605e6bd9c552d4b7a52f455d8ef033953;hpb=176fa33f17dd78355cc572e006d2ab26898e2c69;p=ghc-hetmet.git diff --git a/compiler/prelude/ForeignCall.lhs b/compiler/prelude/ForeignCall.lhs index 27f5b4f..015b28e 100644 --- a/compiler/prelude/ForeignCall.lhs +++ b/compiler/prelude/ForeignCall.lhs @@ -13,7 +13,7 @@ module ForeignCall ( ForeignCall(..), - Safety(..), playSafe, playThreadSafe, + Safety(..), playSafe, CExportSpec(..), CLabelString, isCLabelString, pprCLabelString, CCallSpec(..), @@ -57,11 +57,14 @@ instance Outputable ForeignCall where data Safety = PlaySafe -- Might invoke Haskell GC, or do a call back, or -- switch threads, etc. So make sure things are - -- tidy before the call - Bool -- => True, external function is also re-entrant. - -- [if supported, RTS arranges for the external call - -- to be executed by a separate OS thread, i.e., - -- _concurrently_ to the execution of other Haskell threads.] + -- tidy before the call. Additionally, in the threaded + -- RTS we arrange for the external call to be executed + -- by a separate OS thread, i.e., _concurrently_ to the + -- execution of other Haskell threads. + + Bool -- Indicates the deprecated "threadsafe" annotation + -- which is now an alias for "safe". This information + -- is never used except to emit a deprecation warning. | PlayRisky -- None of the above can happen; the call will return -- without interacting with the runtime system at all @@ -77,10 +80,6 @@ instance Outputable Safety where playSafe :: Safety -> Bool playSafe PlaySafe{} = True playSafe PlayRisky = False - -playThreadSafe :: Safety -> Bool -playThreadSafe (PlaySafe x) = x -playThreadSafe _ = False \end{code} @@ -135,7 +134,7 @@ platforms. See: http://www.programmersheaven.com/2/Calling-conventions \begin{code} -data CCallConv = CCallConv | StdCallConv | CmmCallConv +data CCallConv = CCallConv | StdCallConv | CmmCallConv | PrimCallConv deriving (Eq) {-! derive: Binary !-} @@ -143,6 +142,7 @@ instance Outputable CCallConv where ppr StdCallConv = ptext (sLit "stdcall") ppr CCallConv = ptext (sLit "ccall") ppr CmmCallConv = ptext (sLit "C--") + ppr PrimCallConv = ptext (sLit "prim") defaultCCallConv :: CCallConv defaultCCallConv = CCallConv @@ -333,11 +333,14 @@ instance Binary CCallConv where putByte bh 0 put_ bh StdCallConv = do putByte bh 1 + put_ bh PrimCallConv = do + putByte bh 2 get bh = do h <- getByte bh case h of 0 -> do return CCallConv - _ -> do return StdCallConv + 1 -> do return StdCallConv + _ -> do return PrimCallConv instance Binary DNCallSpec where put_ bh (DNCallSpec isStatic kind ass nm _ _) = do