|
From: Anthony H. <aj...@co...> - 2004-04-10 06:31:02
|
What do you guys think of this simple object format. Five primitive object types: SmallInteger, Tuple, Array, Data, and Code. The last four are called structures, and the last three are called variable structures. Object encoding: An oop is a word interpreted either as a SmallInteger or a pointer to a structure, depending on its low bit (eg. 0 for SmallInteger, 1 for pointer). A structure is 2 + n contiguous words: The first word is a SmallInteger, the second word is a pointer to its class, and the remaining n words are interpreted either as oops (for Arrays and Tuples), machine code (for Codes), or raw data (for Datas). The SmallInteger in the first word encodes flags for gc, etc, plus either n for variable structures or an identity hash for Tuples. n is the same for all tuples of the same class so n is stored in the class. n serves as the identity hash for variable structures (usually variable structures sit inside tuples so their identityHashes won't be used much). Finally, a class is a tuple where the first field is a SmallInteger that encodes its primitive type (Tuple, Array, Data, or Code), flags like isBytes/isWeak, and n if its primitive type is Tuple (or number of fixed fields if its primitive type is Array, although the VM shouldn't care). Cheers, Anthony |