Lazy ST vs concurrency

Ben Gamari ben at smart-cactus.org
Mon Jan 30 23:06:28 UTC 2017


David Feuer <david at well-typed.com> writes:

> On Monday, January 30, 2017 9:50:56 PM EST Simon Marlow wrote:
>
>> Unfortunately the mechanisms we have right now to fix it aren't ideal -
>> noDuplicate# is a bigger hammer than we need.
>
> Do you think you could explain this a bit more? What aspect of nuDuplicate# is 
> overkill? What does it guard against that can't happen here?
>
I suspect Simon is referring to the fact that noDuplicate# actually
needs to call back into the RTS to claim ownership over all thunks on
the stack before it can proceed.

>> All we really need is some
>> way to make a thunk atomic, it would require some special entry code to the
>> thunk which did atomic eager-blackholing.  Hmm, now that I think about it,
>> perhaps we could just have a flag, -fatomic-eager-blackholing.
>
Indeed this sounds quite reasonable.

> If it's possible to use a primop to do this "locally", I think it would be 
> very nice to get that as well as a global flag. If it affects code generation 
> in an inherently global fashion, then of course we'll just have to live with 
> that, and lots of NOINLINE.
>
I guess something like,

    eagerlyBlackhole :: a -> a

Which would be lowered to a bit of code which would do eagerly blackhole
the thunk before entering it?


Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170130/7e733b67/attachment.sig>


More information about the ghc-devs mailing list