[Vm-dev] VM Maker: Cog-eem.238.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 2 23:01:51 UTC 2015

Eliot Miranda uploaded a new version of Cog to project VM Maker:

==================== Summary ====================

Name: Cog-eem.238
Author: eem
Time: 2 February 2015, 3:01:40.657 pm
UUID: 632143e7-106b-46e6-8b63-793708755e06
Ancestors: Cog-eem.237

Spur Bootstrap:
Relax the check for a single instance metaclass in
If the ClassBuilder is using becomeForward: and
avoiding the GC on instance mutation, a metaclass
may be the class of either the mutated class or the
class it is mutated from (oldClass).

=============== Diff against Cog-eem.237 ===============

Item was changed:
  ----- Method: SpurBootstrapPrototypes>>ClassDescriptionPROTOTYPEupdateInstances:from:isMeta: (in category 'method prototypes') -----
  ClassDescriptionPROTOTYPEupdateInstances: oldInstances from: oldClass isMeta: isMeta
  	"Recreate any existing instances of the argument, oldClass, as instances of the receiver,
  	 which is a newly changed class. Permute variables as necessary, and forward old instances
  	 to new instances.  Answer nil to defeat old clients that expect an array of old instances.
  	 The old behaviour, which necessitated a global GC, exchanged identities and answered
  	 the old instances.  But no clients used the result.  This way we avoid the unnecessary GC,"
  	| map variable instSize newInstances |
  	oldInstances isEmpty ifTrue:
  		[^nil]. "no instances to convert"
  	isMeta ifTrue:
  		[(oldInstances size = 1
+ 		  and: [self soleInstance class == self
+ 				or: [self soleInstance class == oldClass]]) ifFalse:
+ 			[^self error: 'Metaclasses can only have one instance']].
- 		  and: [self soleInstance class == self]) ifFalse:
- 			[^self error:'Metaclasses can only have one instance']].
  	map := self instVarMappingFrom: oldClass.
  	variable := self isVariable.
  	instSize := self instSize.
  	newInstances := Array new: oldInstances size.
  	1 to: oldInstances size do:
  			at: i
  			put: (self newInstanceFrom: (oldInstances at: i) variable: variable size: instSize map: map)].
  	"Now perform a bulk mutation of old instances into new ones"
  	oldInstances elementsForwardIdentityTo: newInstances.

More information about the Vm-dev mailing list