[Vm-dev] Adding object to foo->scpecialObject
bryce at kampjes.demon.co.uk
bryce at kampjes.demon.co.uk
Thu Jul 26 10:10:42 UTC 2007
Mathieu Suen writes:
>
> Hi,
>
> Where can I find the #becomeCompactAt:.
Sorry, that seems to be an Exupery extension. I don't think I
wrote this method.
It's here:
Behavior>>becomeCompactAt: anInteger
"Here are the restrictions on compact classes in order for export segments to work: A compact class index may not be reused. If a class was compact in a release of Squeak, no other class may use that index. The class might not be compact later, and there should be nil in its place in the array."
| cct index |
self isWeak ifTrue:[^ self halt: 'You must not make a weak class compact'].
cct := self environment compactClassesArray.
(self indexIfCompact > 0 or: [cct includes: self])
ifTrue: [^ self halt: self name , 'is already compact'].
index := anInteger.
(cct at: index) isNil ifFalse: [self halt: 'The compact class index is already used'].
"Install this class in the compact class table"
cct at: index put: self.
"Update instspec so future instances will be compact"
format := format + (index bitShift: 11).
"Make up new instances and become old ones into them"
self updateInstancesFrom: self.
"Purge any old instances"
Smalltalk garbageCollect.
More information about the Vm-dev
mailing list