From 7c906d8a0c55c997afeec2649c4faa359e6647ee Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Mon, 1 Mar 1999 08:19:49 +0000 Subject: [PATCH] [project @ 1999-03-01 08:19:49 by sof] Added: writeStablePtrOffAddr :: Addr -> Int -> StablePtr a -> IO () readStablePtrOffAddr :: Addr -> Int -> IO (StablePtr a) writeForeignObjOffAddr :: Addr -> Int -> ForeignObj -> IO () --- ghc/lib/exts/Addr.lhs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ghc/lib/exts/Addr.lhs b/ghc/lib/exts/Addr.lhs index 57fd248e96e6..6d9149d60f01 100644 --- a/ghc/lib/exts/Addr.lhs +++ b/ghc/lib/exts/Addr.lhs @@ -25,6 +25,8 @@ module Addr import PreludeBuiltin #else import PrelAddr +import PrelForeign +import PrelStable import PrelBase import PrelIOBase ( IO(..) ) import Word ( indexWord8OffAddr, indexWord16OffAddr @@ -130,6 +132,9 @@ readWordOffAddr a i = _casm_ `` %r=(StgWord)(((StgWord*)%0)[(StgInt)%1]); '' a readAddrOffAddr a i = _casm_ `` %r=(StgAddr)(((StgAddr*)%0)[(StgInt)%1]); '' a i readFloatOffAddr a i = _casm_ `` %r=(StgFloat)(((StgFloat*)%0)[(StgInt)%1]); '' a i readDoubleOffAddr a i = _casm_ `` %r=(StgDouble)(((StgDouble*)%0)[(StgInt)%1]); '' a i + +readStablePtrOffAddr :: Addr -> Int -> IO (StablePtr a) +readStablePtrOffAddr a i = _casm_ `` %r=(StgStablePtr)(((StgStablePtr*)%0)[(StgInt)%1]); '' a i #endif \end{code} @@ -167,5 +172,16 @@ writeFloatOffAddr (A# a#) (I# i#) (F# e#) = IO $ \ s# -> writeDoubleOffAddr (A# a#) (I# i#) (D# e#) = IO $ \ s# -> case (writeDoubleOffAddr# a# i# e# s#) of s2# -> (# s2#, () #) + +#ifndef __PARALLEL_HASKELL__ +writeForeignObjOffAddr :: Addr -> Int -> ForeignObj -> IO () +writeForeignObjOffAddr (A# a#) (I# i#) (ForeignObj e#) = IO $ \ s# -> + case (writeForeignObjOffAddr# a# i# e# s#) of s2# -> (# s2#, () #) +#endif + +writeStablePtrOffAddr :: Addr -> Int -> StablePtr a -> IO () +writeStablePtrOffAddr (A# a#) (I# i#) (StablePtr e#) = IO $ \ s# -> + case (writeStablePtrOffAddr# a# i# e# s#) of s2# -> (# s2# , () #) + #endif \end{code} -- GitLab