[Vm-dev] VM Maker: Cog-eem.230.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Dec 22 21:48:52 UTC 2014
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.230.mcz
==================== Summary ====================
Name: Cog-eem.230
Author: eem
Time: 22 December 2014, 1:48:33.304 pm
UUID: 24969f5e-e5a9-49a3-927e-28f5610df9f0
Ancestors: Cog-eem.229
Spur bootstrap:
Add SmallFLoat64>>identityHash. Needs
VMMaker.oscog-eem.997.
Change ClassDescription>>updateInstancesFrom:...
to use forwarding become. This is necessary if the
GC in ClassBuilder>>#update:to: is to be avoided.
=============== Diff against Cog-eem.229 ===============
Item was added:
+ ----- 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]) 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:
+ [:i|
+ newInstances
+ 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.
+ ^nil!
Item was added:
+ ----- Method: SpurBootstrapPrototypes>>ClassDescriptionPROTOTYPEupdateInstancesFrom: (in category 'method prototypes') -----
+ ClassDescriptionPROTOTYPEupdateInstancesFrom: oldClass
+ "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 any clients
+ that expected the old behaviour of answering the array of old instances."
+ "ar 7/15/1999: The updating below is possibly dangerous. If there are any
+ contexts having an old instance as receiver it might crash the system if
+ the new receiver in which the context is executed has a different layout.
+ See bottom below for a simple example:"
+ self updateInstances: oldClass allInstances asArray from: oldClass isMeta: self isMeta.
+ "Now fix up instances in segments that are out on the disk."
+ ImageSegment allSubInstancesDo:
+ [:seg |
+ seg segUpdateInstancesOf: oldClass toBe: self isMeta: self isMeta].
+ ^nil
+
+ "This attempts to crash the VM by stepping off the end of an instance.
+ As the doctor says, do not do this."
+ " | crashingBlock class |
+ class := Object subclass: #CrashTestDummy
+ instanceVariableNames: 'instVar'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Crash-Test'.
+ class compile:'instVar: value instVar := value'.
+ class compile:'crashingBlock ^[instVar]'.
+ crashingBlock := (class new) instVar: 42; crashingBlock.
+ Object subclass: #CrashTestDummy
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Crash-Test'.
+ crashingBlock value"!
Item was added:
+ ----- Method: SpurBootstrapPrototypes>>SmallFloat64PROTOTYPEidentityHash (in category 'method prototypes') -----
+ SmallFloat64PROTOTYPEidentityHash
+ "Answer an integer unique to the receiver."
+ <primitive: 171>
+ ^self primitiveFailed!
More information about the Vm-dev
mailing list