[Git][ghc/ghc][wip/no-fptr] Sized

Ben Gamari gitlab at gitlab.haskell.org
Mon Nov 30 17:22:03 UTC 2020



Ben Gamari pushed to branch wip/no-fptr at Glasgow Haskell Compiler / GHC


Commits:
29bb4fd6 by Ben Gamari at 2020-11-30T12:21:50-05:00
Sized

- - - - -


1 changed file:

- libraries/base/GHC/ForeignPtr/Ops.hs


Changes:

=====================================
libraries/base/GHC/ForeignPtr/Ops.hs
=====================================
@@ -62,17 +62,17 @@ withFP fp f =
 peekWord8ForeignPtr :: ForeignPtr ty -> Int -> IO Word8
 peekWord8ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
     case readWord8OffAddr# addr d s0 of
-      (# s1, r #) -> (# s1, W8# r #)
+      (# s1, r #) -> (# s1, W8# (narrowWord8# r) #)
 
 peekWord16ForeignPtr :: ForeignPtr ty -> Int -> IO Word16
 peekWord16ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
     case readWord16OffAddr# addr d s0 of
-      (# s1, r #) -> (# s1, W16# r #)
+      (# s1, r #) -> (# s1, W16# (narrowWord16# r) #)
 
 peekWord32ForeignPtr :: ForeignPtr ty -> Int -> IO Word32
 peekWord32ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
     case readWord32OffAddr# addr d s0 of
-      (# s1, r #) -> (# s1, W32# r #)
+      (# s1, r #) -> (# s1, W32# (narrowWord32# r) #)
 
 peekWord64ForeignPtr :: ForeignPtr ty -> Int -> IO Word64
 peekWord64ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
@@ -87,17 +87,17 @@ peekWordForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
 peekInt8ForeignPtr :: ForeignPtr ty -> Int -> IO Int8
 peekInt8ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
     case readInt8OffAddr# addr d s0 of
-      (# s1, r #) -> (# s1, I8# r #)
+      (# s1, r #) -> (# s1, I8# (narrowInt8# r) #)
 
 peekInt16ForeignPtr :: ForeignPtr ty -> Int -> IO Int16
 peekInt16ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
     case readInt16OffAddr# addr d s0 of
-      (# s1, r #) -> (# s1, I16# r #)
+      (# s1, r #) -> (# s1, I16# (narrowInt16# r) #)
 
 peekInt32ForeignPtr :: ForeignPtr ty -> Int -> IO Int32
 peekInt32ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
     case readInt32OffAddr# addr d s0 of
-      (# s1, r #) -> (# s1, I32# r #)
+      (# s1, r #) -> (# s1, I32# (narrowInt32# r) #)
 
 peekInt64ForeignPtr :: ForeignPtr ty -> Int -> IO Int64
 peekInt64ForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
@@ -116,17 +116,17 @@ peekCharForeignPtr fp (I# d) = withFP fp $ \addr s0 ->
 
 pokeWord8ForeignPtr :: ForeignPtr ty -> Int -> Word8 -> IO ()
 pokeWord8ForeignPtr fp (I# d) (W8# n) = withFP fp $ \addr s0 ->
-    case writeWord8OffAddr# addr d n s0 of
+    case writeWord8OffAddr# addr d (extendWord8# n) s0 of
       s1 -> (# s1, () #)
 
 pokeWord16ForeignPtr :: ForeignPtr ty -> Int -> Word16 -> IO ()
 pokeWord16ForeignPtr fp (I# d) (W16# n) = withFP fp $ \addr s0 ->
-    case writeWord16OffAddr# addr d n s0 of
+    case writeWord16OffAddr# addr d (extendWord16# n) s0 of
       s1 -> (# s1, () #)
 
 pokeWord32ForeignPtr :: ForeignPtr ty -> Int -> Word32 -> IO ()
 pokeWord32ForeignPtr fp (I# d) (W32# n) = withFP fp $ \addr s0 ->
-    case writeWord32OffAddr# addr d n s0 of
+    case writeWord32OffAddr# addr d (extendWord32# n) s0 of
       s1 -> (# s1, () #)
 
 pokeWord64ForeignPtr :: ForeignPtr ty -> Int -> Word64 -> IO ()
@@ -141,17 +141,17 @@ pokeWordForeignPtr fp (I# d) (W# n) = withFP fp $ \addr s0 ->
 
 pokeInt8ForeignPtr :: ForeignPtr ty -> Int -> Int8 -> IO ()
 pokeInt8ForeignPtr fp (I# d) (I8# n) = withFP fp $ \addr s0 ->
-    case writeInt8OffAddr# addr d n s0 of
+    case writeInt8OffAddr# addr d (extendInt8# n) s0 of
       s1 -> (# s1, () #)
 
 pokeInt16ForeignPtr :: ForeignPtr ty -> Int -> Int16 -> IO ()
 pokeInt16ForeignPtr fp (I# d) (I16# n) = withFP fp $ \addr s0 ->
-    case writeInt16OffAddr# addr d n s0 of
+    case writeInt16OffAddr# addr d (extendInt16# n) s0 of
       s1 -> (# s1, () #)
 
 pokeInt32ForeignPtr :: ForeignPtr ty -> Int -> Int32 -> IO ()
 pokeInt32ForeignPtr fp (I# d) (I32# n) = withFP fp $ \addr s0 ->
-    case writeInt32OffAddr# addr d n s0 of
+    case writeInt32OffAddr# addr d (extendInt32# n) s0 of
       s1 -> (# s1, () #)
 
 pokeInt64ForeignPtr :: ForeignPtr ty -> Int -> Int64 -> IO ()



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/29bb4fd63ea808ab848afa08fab95f9cdac0df85

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/29bb4fd63ea808ab848afa08fab95f9cdac0df85
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201130/2cb519ef/attachment-0001.html>


More information about the ghc-commits mailing list