[Git][ghc/ghc][wip/strictness-barrier] Introduce `strictnessBarrier#` magic

Sebastian Graf (@sgraf812) gitlab at gitlab.haskell.org
Sun Feb 11 18:23:32 UTC 2024



Sebastian Graf pushed to branch wip/strictness-barrier at Glasgow Haskell Compiler / GHC


Commits:
fb693719 by Sebastian Graf at 2024-02-11T19:23:24+01:00
Introduce `strictnessBarrier#` magic

This commit introduces a new `strictnessBarrier#` magic Id;
see `Note [strictnessBarrier# magic]`.

This is a very useful and versatile primop, as it allows us to

  * Demote the out-of-line primop `raiseIO#` into an ordinary function,
    demystifying our notion of precise exception (`raiseIO#` is just
    `strictnessBarrier#` + `raise#`).
  * Define `Control.Exception.evaluate2`, which is `Control.Exception.evaluate`
    done right, as discussed in #22935.
  * Demote that `seq#` primop into a magic Id which is inlined in CorePrep,
    See `Note [seq# magic]`. This fixes #24124.
    In particular, doing so gets rid of much code and explanation in Tag
    Inference and StgToCmm.

I improved CorePrep a bit to better cope with the code left behind by inlining
`seq#`:

  * I implemented a new `Note [Flatten case-bind]` to get better code for
    otherwise nested case scrutinees.
  * I renamed the contructors of `ArgInfo` to use an `AI` prefix in order to
    resolve the clash between `type CpeApp = CoreExpr` and the data constructor
    of `ArgInfo`, as well as fixed typos in `Note [CorePrep invariants]`.
    Fixes #24252.
  * I documented that evaluation order is fixed after CorePrep in
    `Note [CorePrep invariants]`.

Fixes #24252 and #24124.

- - - - -


30 changed files:

- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Stg/InferTags.hs
- compiler/GHC/Stg/InferTags/Rewrite.hs
- compiler/GHC/StgToCmm/Expr.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/StgToJS/Utils.hs
- compiler/GHC/Types/Demand.hs
- compiler/GHC/Types/Id/Make.hs
- libraries/ghc-internal/src/Control/Exception.hs
- libraries/ghc-internal/src/Control/Exception/Base.hs
- libraries/ghc-internal/src/GHC/Base.hs
- libraries/ghc-internal/src/GHC/Exts.hs
- libraries/ghc-internal/src/GHC/IO.hs
- libraries/ghc-internal/src/GHC/IO.hs-boot
- libraries/ghc-prim/GHC/Magic.hs
- rts/Exception.cmm
- rts/PrimOps.cmm
- rts/RtsSymbols.c
- rts/include/stg/MiscClosures.h
- + testsuite/tests/core-to-stg/T24124.hs
- + testsuite/tests/core-to-stg/T24124.stderr
- testsuite/tests/core-to-stg/all.T


The diff was not included because it is too large.


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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fb6937192107c6f0f938d99503599bb90aef60fc
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/20240211/dc9abe72/attachment.html>


More information about the ghc-commits mailing list