|
|
An brief description of difference of Squeak and Smalltalk-80.
For Squeak, Basic concept is:
byteSize := total of
bytes in Object Table Entry +
byte size of object header +
byte size of instance variables field +
byte size of indexable field
For VisualWorks the concept is:
byteSize := total of
bytes in Object Table Entry +
byte size of instance variables field +
byte size of indexable field
See below:
AOKI Atsushi, "Smalltalk Idioms", SRC, Tokyo, 1997, ISBN4-915778-81-9 C3055 P4500E, pp.84-85.
So bytes in Object Table Entry = 0 in Squeak.
byteSize := total of
byte size of object header +
byte size of instance variables field +
byte size of indexable field
see direct pointer from OOPSLA paper ("Back to the Future")
Mr. OHSHIMA Yoshiki (The author of Squeak for the Sharp Zaurus) said:
an oop doesn't point at Object Table but object itself directly.
Object headers can be 1, 2, or 3 words (4, 8, or 12 bytes). see The Object Memory from OOPSLA paper ("Back to the Future")
The response to size is the method size in bytes, including the method header, the literal frame, the bytecodes and the 4-byte sourcecode pointer at the end. Just add 4 for the object header.
Of course, you must consider "4 bytes boundary". Look at the expression for inc (the increment due to indexable bytes)
inc := (size + 3) bitAnd: 16r1FFFFFFC.in the method ObjectMemory>>instantiateClass:indexableSize:, which might help you to understand exactly what gets allocated by the Squeak engine.
The home method context is a different object. Contexts and BlockContexts point to the home method rather than copying it. Need not add the size of aBlockContext home method.
SmallIntegers are immediate. Characters are not, but there are only 256 of them which are shared, so their space is effectively 0.
Small integers are immediate. Characters are shared references to one of a set of 256 Character objects. String elements are, of course, a single byte, which is used as an index into the 256 Character table.
With helps, advices and encouragements by Smalltalkers Giants as Dan Ingalls, John Maloney, OHSHIMA Yoshiki and of course AOKI Atsushi. And Squeak mailing-list, SML (Smalltalkers' Salon -> Smalltalkers mailing-list in Japan).