how to write a ghc primop that acts on an unevaluated argument?

Carter Schonwald carter.schonwald at
Sun Nov 23 19:04:13 UTC 2014

Hey All,
as part of trying to get some fixups for how prefetch works into 7.10,
i'm adding a "prefetchValue" primop that prefetchs the memory location of a
lifted heap value


several operations of the following form

primop PrefetchValueOp1 "prefetchValue1#" GenPrimOp
   a -> State# s -> State# s
   with strictness  = { \ _arity -> mkClosedStrictSig [botDmd, topDmd]
topRes }

I'd like some feedback on the strictness information design by someone
who's familiar with how that piece of GHC. the idea being that
prefetchValue is lazy in its polymorphic argument (it doesn't force it, it
just does a prefetch on the heap location, which may or may not be

is the code in question. And i *believe* i'm testing for being lazy in that
argument correctly.


many thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list