Stable name equality

David Feuer david.feuer at gmail.com
Tue Aug 21 08:24:45 UTC 2018


On Tue, Aug 21, 2018, 3:39 AM Simon Peyton Jones <simonpj at microsoft.com>
wrote:

>
> Actually I'm confused.  Currently we have
>
> data StableName a = StableName (StableName# a)
>
> I believe (but there is no documentation to state) that the (StableName#
> a)
>  * Has kind (TYPE UnliftedRep)
>  * Is the index of the entry in the Stable Name Table
>
> But if it's the index, why isn't it an IntRep?  UnliftedRep is for
> pointers?
>

That's explained in the paper. A StableName# is a pointer to a stable name
object in the heap that *contains* an index into the stable name table.
Basically, the garbage collector needs to know whether a stable name is
alive or not, so it can work out when to clear it from the table.


> Moreover eqStableName# :: StableName# a -> StableName# b -> Bool
> is directly implemented in the code generator (StgCmmPrim) by an equality
> comparison.
>
> If these things are correct, it would be great to write them down in a
> Note.
>
> And if they are right, I'm now lost about what you question is.  Equality
> is
> /already/ implemented by direct equality comparison, no?
>

It's currently implemented by an equality test on the indices stored in the
stable name objects, rather than the pointers to those objects, if I'm not
very much mistaken.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180821/fca97b9d/attachment-0001.html>


More information about the ghc-devs mailing list