
On Wed, Jun 25, 2014 at 2:54 PM, Mihaly Barasz
Well, I don't know enough about how GC is specified in GHC, but _in practice_ calls to GC could happen only on entry to the exampleFn closure. Not between the address computation and the foreign call. (I simply looked at the generated code, I don't know if there is any guarantee for that.)
There can be additional heap checks at the start of any basic block in the generated assembly for the function. Right, in practice there's probably not an issue.
Thanks, I'll look into that. Are there any pointers/examples?
There's some code out there on the web that uses the extension. Here's an example: https://github.com/tibbe/hashable/blob/master/Data/Hashable/Class.hs#L470
I don't know why, but the constructor for Vector is not exported, only for the MVector. But, this use of unsafeThaw is completely benign. (Actually, it fully disappears in the generated code. :))
Probably because it's a ByteArray#, not an Array#. For the latter unsafe thawing results in the object being put on the GC mutable list (in practice that means that the info table ptr changes).