[Git][ghc/ghc][wip/T23163] ghc-prim: Generalize keepAlive#/touch# in state token type

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed May 10 00:40:21 UTC 2023



Ben Gamari pushed to branch wip/T23163 at Glasgow Haskell Compiler / GHC


Commits:
a6e07e03 by Ben Gamari at 2023-05-09T20:40:14-04:00
ghc-prim: Generalize keepAlive#/touch# in state token type

Closes #23163.

- - - - -


2 changed files:

- compiler/GHC/Builtin/primops.txt.pp
- libraries/ghc-prim/changelog.md


Changes:

=====================================
compiler/GHC/Builtin/primops.txt.pp
=====================================
@@ -3407,7 +3407,7 @@ primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
    out_of_line      = True
 
 primop TouchOp "touch#" GenPrimOp
-   v -> State# RealWorld -> State# RealWorld
+   v -> State# s -> State# s
    with
    code_size = { 0 }
    has_side_effects = True
@@ -3723,7 +3723,7 @@ section "Controlling object lifetime"
 -- and "p" is the same as "b" except representation-polymorphic.
 -- See Note [Levity and representation polymorphic primops]
 primop KeepAliveOp "keepAlive#" GenPrimOp
-   v -> State# RealWorld -> (State# RealWorld -> p) -> p
+   v -> State# s -> (State# s -> p) -> p
    { @'keepAlive#' x s k@ keeps the value @x@ alive during the execution
      of the computation @k at .
 


=====================================
libraries/ghc-prim/changelog.md
=====================================
@@ -14,6 +14,8 @@
     - `sameMutVar#`, `sameTVar#`, `sameMVar#`
     - `sameIOPort#`, `eqStableName#`.
 
+- `keepAlive#` and `touch#` are now polymorphic in their state token (#23163; [CLC#152](https://github.com/haskell/core-libraries-committee/issues/152))
+
 - Several new primops were added:
 
   - `copyMutableByteArrayNonOverlapping#`



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a6e07e0316e2dcfcc2f76b1c5fa0ff04a4ee0e6b
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/20230509/c653c02a/attachment-0001.html>


More information about the ghc-commits mailing list