Eliot Miranda uploaded a new version of Cog to project VM Maker: http://source.squeak.org/VMMaker/Cog-eem.194.mcz
==================== Summary ====================
Name: Cog-eem.194 Author: eem Time: 21 August 2014, 8:16:40.31 am UUID: b999fc10-6f1c-4df3-968a-717745570d50 Ancestors: Cog-eem.193
Move send of findRequiredGlobals prior to installing any replacement methods, and fix the fall-out this has over classMetaclass initialization.
=============== Diff against Cog-eem.193 ===============
Item was changed: ----- Method: SpurBootstrap>>bootstrapImage (in category 'bootstrap image') ----- bootstrapImage oldHeap fullGC. self measureOldHeapPostGC. self initMaps. - self findRequiredGlobals. Transcript cr; nextPutAll: 'transforming image...'; flush. self cloneNilTrueAndFalse. self allocateFreeLists. self buildClassMap. self allocateClassTable. self cloneObjects. self fillInObjects. self fillInClassTable. newHeapSize := newHeap freeStart. newHeap initializePostBootstrap. self measureNewHeapPostInitPostBootstrap!
Item was changed: ----- Method: SpurBootstrap>>checkReshapeOf: (in category 'bootstrap image') ----- checkReshapeOf: ourMethodClasses "Check the shape of all our method classes match the shape of those in the image to be bootstrapped. Use the simulator to redefine any that need it. Does /not/ reshape metaclasses; these we assume are ok." | toReshape | toReshape := Set new. ourMethodClasses do: [:mc| | binding | binding := literalMap at: mc binding. + self assert: binding ~= oldHeap nilObject. (mc ~~ Character "Character will reshape anyway" and: [mc instSize ~= (oldHeap instanceSizeOf: (oldHeap fetchPointer: ValueIndex ofObject: binding))]) ifTrue: [toReshape add: mc]]. toReshape isEmpty ifTrue: [^self]. "Assume only one class in any subtree needs reshaping. Fast and loose but gets us there for now." toReshape copy do: [:class| toReshape removeAll: (toReshape select: [:ea| ea inheritsFrom: class])]. toReshape do: [:class| Transcript cr; nextPutAll: 'RESHAPING '; print: class; flush. self interpreter: oldInterpreter object: (self oldClassOopFor: Compiler) perform: (self findSymbol: #evaluate:) withArguments: {oldHeap stringForCString: class definition}]!
Item was added: + ----- Method: SpurBootstrap>>classMetaclass (in category 'bootstrap image') ----- + classMetaclass + ^classMetaclass ifNil: + [classMetaclass := oldHeap fetchClassOfNonImm: (oldHeap fetchClassOfNonImm: oldHeap classArray)]!
Item was changed: ----- Method: SpurBootstrap>>findRequiredGlobals (in category 'bootstrap image') ----- findRequiredGlobals "Look for the necessary gobal bindings in the prototype methods in the old image. This has to be done early by sending bindingOf: to Smalltalk. Collect the class hierarchy of all prototypes that access inst vars (non-local prototypes) to check their shapes. Also find out Metaclass, needed for identifying classes." | globals ourMethodClasses classVars bindingOfSym | globals := Set new. ourMethodClasses := Set new. classVars := Dictionary new. self prototypeClassNameMetaSelectorMethodDo: [:c :m :s :method| | nonMetaClass allNonMetaSupers | allNonMetaSupers := (nonMetaClass := Smalltalk classNamed: c) withAllSuperclasses. method methodClass ~= SpurBootstrap class ifTrue: [ourMethodClasses addAll: allNonMetaSupers]. globals addAll: (allNonMetaSupers collect: [:sc| sc binding]). method literals do: [:l| (l isVariableBinding and: [l key isSymbol]) ifTrue: [(Smalltalk bindingOf: l key) == l ifTrue: [globals add: l] ifFalse: [self assert: (nonMetaClass bindingOf: l key) == l. classVars at: l put: nonMetaClass]]]]. globals add: Compiler binding. "For potential reshaping in checkReshapeOf:" bindingOfSym := self findSymbol: #bindingOf:. self withExecutableInterpreter: oldInterpreter do: [| toBeAdded | globals do: + [:global| | bindingOop | + bindingOop := self interpreter: oldInterpreter + object: (oldHeap splObj: 8) "Smalltalk" + perform: bindingOfSym + withArguments: {self findSymbol: global key}. + self assert: bindingOop ~= oldHeap nilObject. + literalMap at: global put: bindingOop]. - [:global| - literalMap - at: global - put: (self interpreter: oldInterpreter - object: (oldHeap splObj: 8) "Smalltalk" - perform: bindingOfSym - withArguments: {self findSymbol: global key})]. toBeAdded := Dictionary new. classVars keysAndValuesDo: [:var :class| | val | (self findSymbol: var key) "New class inst vars may not yet be interned." ifNil: [toBeAdded at: var put: class] ifNotNil: [:varName| val := self interpreter: oldInterpreter object: (self oldClassOopFor: class) perform: bindingOfSym withArguments: {varName}. val ~= oldHeap nilObject ifTrue: [literalMap at: var put: val] ifFalse: [toBeAdded at: var put: class]]]. "May have to redefine to add missing inst vars and/or add any missing class vars." self checkReshapeOf: ourMethodClasses. + self addMissingClassVars: toBeAdded]! - self addMissingClassVars: toBeAdded]. - classMetaclass := oldHeap fetchClassOfNonImm: (oldHeap fetchClassOfNonImm: oldHeap classArray)!
Item was changed: ----- Method: SpurBootstrap>>isOldObjABehavior: (in category 'bootstrap image') ----- isOldObjABehavior: oldObj + | oldObjClass | - | oldObjClass oldObjClassClass | ^(classToIndex includesKey: oldObj) + or: [(oldObjClass := oldHeap fetchClassOfNonImm: oldObj) = self classMetaclass + or: [(oldHeap fetchClassOfNonImm: oldObjClass) = classMetaclass]]! - or: [oldObjClass := oldHeap fetchClassOfNonImm: oldObj. - oldObjClassClass := oldHeap fetchClassOfNonImm: oldObjClass. - oldObjClass = classMetaclass - or: [oldObjClassClass = classMetaclass]]!
vm-dev@lists.squeakfoundation.org