Skip to content

Introduce `strictnessBarrier#` magic

Sebastian Graf requested to merge wip/strictness-barrier into master

This patch 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 (closed). 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 (closed).
  • I documented that evaluation order is fixed after CorePrep in Note [CorePrep invariants].

Fixes #24252 (closed) and #24124 (closed).


Currently there is an annoying bug relating to cached evaluation of shared work in GHCi. I'm completely puzzled; !11515 (closed) did not have it.

Merge request reports