[Vm-dev] Adding object to foo->scpecialObject

Mathieu Suen mathk.sue at gmail.com
Thu Jul 26 10:18:08 UTC 2007


Thanks

So what is the right way of using the compactClassesArray.
If I use I shoudn't use the slot 15 but who else is using it?

	Mth



On Jul 26, 2007, at 12:10 PM, <bryce at kampjes.demon.co.uk> wrote:

>
> 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