WordX/IntX wrap Word#/Int#?

Ben Gamari ben at smart-cactus.org
Mon Jun 12 01:43:16 UTC 2017


Joachim Breitner <mail at joachim-breitner.de> writes:

> Hi,
>
> Am Sonntag, den 11.06.2017, 10:44 -0400 schrieb Ben Gamari:
>> This is certainly one consideration. Another is that you would also
>> need to teach the garbage collector to understand closures with sub-
>> word-size fields. Currently we can encode whether each field of a
>> closure is a pointer or not with a simple bitmap. If we naively
>> allowed smaller fields we would need to increase the granularity of
>> this representation to encode bytes.
>> 
>> Of course, one way to work around this would be to impose an
>> invariant that guarantees that pointers are always word-aligned. Then
>> we would probably want to shuffle sub-word sized fields, allowing two
>> Word16s to inhabit a single word.
>
> that is not an issue; we already sort field into pointers first, and
> non-pointers later. So all pointers are at the beginning and nicely
> aligned, and all the non-pointer data can follow in whatever weird
> format. The GC only needs to know how many words in total are used by
> the non-pointer data.
>
Ahh, great point. I stand corrected.

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/20170611/1b174073/attachment-0001.sig>


More information about the ghc-devs mailing list