touch# primitive
Ben Lippmeier
benl at ouroborus.net
Tue Sep 18 20:54:25 UTC 2018
> On 19 Sep 2018, at 1:07 am, Daniel Cartwright <chessai1996 at gmail.com> wrote:
>
> in GHC.Prim, there is a primitive 'touch#'. It seems that it is used to keep pointers alive, and takes something of any runtime representation, and a State# RealWorld, but there's really no documentation on it, so my idea of what it does is just a guess. Can anyone explain what exactly it does?
It’s used to place a dependency on a computed value, to prevent the GHC simplifier from moving the binding that computes it around. This is sometimes helpful when writing array fusion systems.
I mentioned it briefly in
http://benl.ouroborus.net/papers/2011-stencil/stencil-haskell2011.pdf <http://benl.ouroborus.net/papers/2011-stencil/stencil-haskell2011.pdf>
Cheers,
Ben.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180919/7727818f/attachment.html>
More information about the ghc-devs
mailing list