From 1d0fb43f4e1d61a09a5d440ffa313376cc9feb35 Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Sun, 8 Nov 1998 17:12:53 +0000
Subject: [PATCH] [project @ 1998-11-08 17:12:53 by sof] Added
 {read,write}StablePtrOffAddr

---
 ghc/lib/exts/Addr.lhs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ghc/lib/exts/Addr.lhs b/ghc/lib/exts/Addr.lhs
index 848ddafaae4d..107b042f3678 100644
--- a/ghc/lib/exts/Addr.lhs
+++ b/ghc/lib/exts/Addr.lhs
@@ -38,7 +38,7 @@ import Int	( indexInt8OffAddr,  indexInt16OffAddr
 import PrelIOBase ( IO(..), IOResult(..) )
 
 #ifndef __PARALLEL_HASKELL__
-import PrelForeign ( ForeignObj(..) )
+import PrelForeign ( ForeignObj(..), StablePtr(..) )
 #endif
 
 \end{code}
@@ -98,6 +98,9 @@ readCharOffAddr a i = _casm_ `` %r=(StgChar)(((StgChar*)%0)[(StgInt)%1]); '' a i
 readIntOffAddr    :: Addr -> Int -> IO Int
 readIntOffAddr a i = _casm_ `` %r=(StgInt)(((StgInt*)%0)[(StgInt)%1]); '' a i
 
+readStablePtrOffAddr    :: Addr -> Int -> IO (StablePtr a)
+readStablePtrOffAddr a i = _casm_ `` %r=(StgStablePtr)(((StgStablePtr*)%0)[(StgInt)%1]); '' a i
+
 readWordOffAddr    :: Addr -> Int -> IO Word
 readWordOffAddr a i = _casm_ `` %r=(StgWord)(((StgWord*)%0)[(StgInt)%1]); '' a i
 
@@ -121,6 +124,10 @@ writeIntOffAddr    :: Addr -> Int -> Int    -> IO ()
 writeIntOffAddr (A# a#) (I# i#) (I# e#) = IO $ \ s# ->
       case (writeIntOffAddr#  a# i# e# s#) of s2# -> IOok s2# () 
 
+writeStablePtrOffAddr    :: Addr -> Int -> StablePtr a -> IO ()
+writeStablePtrOffAddr (A# a#) (I# i#) (StablePtr e#) = IO $ \ s# ->
+      case (writeStablePtrOffAddr#  a# i# e# s#) of s2# -> IOok s2# () 
+
 writeWordOffAddr    :: Addr -> Int -> Word  -> IO ()
 writeWordOffAddr (A# a#) (I# i#) (W# e#) = IO $ \ s# ->
       case (writeWordOffAddr#  a# i# e# s#) of s2# -> IOok s2# () 
-- 
GitLab