Hi,
I am interested in the squeak class format word, which is an instance variable of every squeak class object. I could not find much info about it... The low 2 bits are size bits - size of what? header? Behavior>>instSize shows how to fetch the number of instance variables for an object. Thats it... For example, the format for 'Object' is 2, for 'Array' its 6402, for 'MethodContext' its 29070. Can anybody tell me what additional info is stored in this format word? - Helmut |
2014-05-07 13:16 GMT+02:00 Helmut Rohregger <[hidden email]>: Hi, It's all in image. Search for inst var write of format ClassDescription>>superclass: aClass methodDictionary: mDict format: fmt ClassBuilder>>privateNewSubclassOf: newSuper from: oldClass ClassBuilder>>computeFormat: type instSize: newInstSize forSuper: newSuper ccIndex: ccIndex ClassBuilder>>format: nInstVars variable: isVar words: isWords pointers: isPointers weak: isWeak You will find from highest bits to lowest bits of the SmallInteger: 2 bits for instanceSize high bits 5 bits for compactClassIndex (there are 32 possiblie compact classes) 4 bits for instanceSpecification 6 bits for instanceSize low bits 1 bit = 0 unused (alignment for wordSize in 32bits) Note that instanceSize = number of instance variables + 1. In memory, there is one more bit for representing the SmallInteger:
1 bit = 1 (=SmallInteger) Thus, the low 8 bits represent the size in bytes of a Word-oriented object (variableWord: or pointers...) (assuming the object has at most 63 inst.var. and assuming a 32bits image) |
Thank you very much!!!
Am 07.05.2014 13:42, schrieb Nicolas
Cellier:
|
Free forum by Nabble | Edit this page |