diff options
-rw-r--r-- | compiler/GHC/Builtin/primops.txt.pp | 10 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Prim.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/StgToJS/Prim.hs | 1 | ||||
-rw-r--r-- | libraries/ghc-prim/changelog.md | 7 |
4 files changed, 21 insertions, 1 deletions
diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp index d51f3616f2..1777ce4255 100644 --- a/compiler/GHC/Builtin/primops.txt.pp +++ b/compiler/GHC/Builtin/primops.txt.pp @@ -1780,7 +1780,15 @@ primop ResizeMutableByteArrayOp_Char "resizeMutableByteArray#" GenPrimOp primop UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp MutableByteArray# s -> State# s -> (# State# s, ByteArray# #) - {Make a mutable byte array immutable, without copying.} + {Make a mutable byte array immutable, without copying. + + @since 0.11.0} + with + has_side_effects = True + +primop UnsafeThawByteArrayOp "unsafeThawByteArray#" GenPrimOp + MutableByteArray# s -> State# s -> (# State# s, ByteArray# #) + {Make an immutable byte array mutable, without copying.} with has_side_effects = True diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs index e17a937a9e..948e76af87 100644 --- a/compiler/GHC/StgToCmm/Prim.hs +++ b/compiler/GHC/StgToCmm/Prim.hs @@ -375,6 +375,10 @@ emitPrimOp cfg primop = UnsafeFreezeByteArrayOp -> \[arg] -> opIntoRegs $ \[res] -> emitAssign (CmmLocal res) arg +-- #define unsafeThawByteArrayzh(r,a) r=(a) + UnsafeThawByteArrayOp -> \[arg] -> opIntoRegs $ \[res] -> + emitAssign (CmmLocal res) arg + -- Reading/writing pointer arrays ReadArrayOp -> \[obj, ix] -> opIntoRegs $ \[res] -> diff --git a/compiler/GHC/StgToJS/Prim.hs b/compiler/GHC/StgToJS/Prim.hs index 6085b110cf..939b7152fa 100644 --- a/compiler/GHC/StgToJS/Prim.hs +++ b/compiler/GHC/StgToJS/Prim.hs @@ -606,6 +606,7 @@ genPrim prof bound ty op = case op of ShrinkMutableByteArrayOp_Char -> \[] [a,n] -> PrimInline $ appS "h$shrinkMutableByteArray" [a,n] ResizeMutableByteArrayOp_Char -> \[r] [a,n] -> PrimInline $ r |= app "h$resizeMutableByteArray" [a,n] UnsafeFreezeByteArrayOp -> \[a] [b] -> PrimInline $ a |= b + UnsafeThawByteArrayOp -> \[a] [b] -> PrimInline $ a |= b SizeofByteArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "len" SizeofMutableByteArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "len" GetSizeofMutableByteArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "len" diff --git a/libraries/ghc-prim/changelog.md b/libraries/ghc-prim/changelog.md index 0e909da691..72e69531e8 100644 --- a/libraries/ghc-prim/changelog.md +++ b/libraries/ghc-prim/changelog.md @@ -1,3 +1,10 @@ +## 0.11.0 + +- Shipped with GHC 9.8.1 + +- The `unsafeThawByteArray#` primop was added, serving as a inverse to the existing + `unsafeFreezeByteArray#` primop (see #22710). + ## 0.10.0 - Shipped with GHC 9.6.1 |