[Vm-dev] how many free bits we have in Object Header?
Mariano Martinez Peck
marianopeck at gmail.com
Wed May 5 09:55:20 UTC 2010
On Tue, May 4, 2010 at 2:12 PM, Adrian Lienhard <adi at netstyle.ch> wrote:
> Hi Mariano,
> I see two solutions
> - make the identityHash (even) smaller
Hi Adrian. Thanks for you answer. I am still newbie with the VM and there
are a lot of things I don't understand :(
I though that in squeak the hash of an object was the address in memory.
Then I though this was in Smalltalk 80 where you had an object table, and
thus, there were no problem with the address of an object. In squeak I think
that the Object Table doesn't exist anymore, but objects can change address,
while the Hash shouldn't be modified. That's why you need 12 bits of hash in
the object header ? so...you always use this 12 bits for hash and not the
address of the object at all ? I ask because in the book "Squeak Open
Personal Computing and Multimedia" that I am reading, it says:
"12 bits object hash (for hashed Set usage)"
But if it is only for hashed Set..what happens with the hash of normal
objects? As I see in the code, it ALSO uses those 12 bits. I am right ?
Maybe this changed from the time the book was written.
> - remove compact classes
> The former would probably not be hard to implement (just change some bit
> masks and then rehash all sets). I've brought up the idea about the latter
> some time ago on this mailing list. The idea is to remove compact classes to
> get a larger identityHash (trading memory against speed). After the removal,
> only two header types are left and hence you gain a spare bit.
Again, I am trying to understand all this. I read about Compact Classes but
still I think I don't understand them. They are just one world objects ?
Why you say than removing them we will only use 2 header types instead of 4
? which ones we will use and why we wouldn't use the others 2 ?
In addition, in this book it says:
"5 bits compact class index, nonzero if the class is in a group of classes
known as "Compact Classes"
I don't understand these 5 bits and neither if they have sense or not if we
remove the compact classes.
Thank you very much for any help in advance,
I think this shouldn't be too much work either, but I haven't come around to
> implementing it (yet).
> Good luck ;)
> On May 4, 2010, at 13:13 , Mariano Martinez Peck wrote:
> >>> Now...the question is, is there another free bit in the object header ?
> >>> need another one :(
> >> Based on the comment at the bottom of Interpreter>>internalIsImmutable:
> >> I suspect that somebody else has their eye on that last available bit
> >> also ;-)
> > Yes, I know :( But for the moment I don't care to "integrate" my stuff.
> > just want to play and experiment. And even for that, I need 2 bits :(
> > Of course, if I once make something good to integrate, I will have double
> > problem :(
> > So...no solution ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev