[MLton] card and cross maps
Matthew Fluet
fluet@cs.cornell.edu
Mon, 12 Sep 2005 08:25:13 -0400 (EDT)
> Same idea. BTW, the code (forwardIntergenerationPointers)
> doesn't actually need to step back through the cross map to find the
> nonempty entry, since, as it scans the old generation from beginning to
> end, it maintains as an invariant (objectStart) the last object prior to
> the current card. Actually, given that, I'm not quite sure why
> skipObjects is needed, since I don't see how the object at objectStart
> could point earlier than the card being scanned. If it did, wouldn't
> the crossMap have caused us to have moved objectStart forward? Hmmm.
> If you can figure out a situation where minorBytesSkipped will be
> nonzero I'd like to see it.
Yeah, I was curious about the skipObjects as well. It seemed like it
wasn't assuming the invariant maintained by the crossMap.
>> My question: why does the crossMap offset count 32-bit words, rather
>> than 8-bit bytes?
>
> I don't think it's anything deeper than the fact that all objects are
> 32-bit aligned, so why waste the extra 2 bits.
Fair enough.
> As you mention, it does allow a larger card size (2^9) to be used.
But, certainly not an arbitrary card size.
> I remember testing various card sizes, up to about 2^12 IIRC, but that
> must have been when the crossMap had its old meaning as a bit-map.
Right, for some reason the -card-size-log2 runtime option sticks in my
mind, despite the fact that it wasn't ever around for very long.
> So, if you want to change crossMap offset to use bytes instead of
> words, I have no objection. I'm curious to know why it might help,
> though, or if it's more for general cleanliness and consistency.
More for genearl cleanliness and consistency. I'm really trying to count
everything in 8-bit bytes. I'm very suspicious of scaling by WORD_SIZE,
because sometimes that is assuming the word size is the native pointer
size, sometimes it is assuming that word size is a header size, and
sometimes (like this case) it is assuming that word size is just 32-bits.
I'll add changing the meaning of crossMap to my TODO list.