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

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Mar 23 16:48:25 UTC 2023



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


Commits:
280ac03b by Ben Gamari at 2023-03-23T12:48:16-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
=====================================
@@ -3298,7 +3298,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
@@ -3614,7 +3614,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 its state token (#23163)
+
 ## 0.10.0
 
 - Shipped with GHC 9.6.1



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/280ac03b3c6e573f98c66c4e4a5255cf34f10c18
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/20230323/4e2ec67b/attachment-0001.html>


More information about the ghc-commits mailing list