Eliot Miranda uploaded a new version of Cog to project VM Maker: http://source.squeak.org/VMMaker/Cog-eem.174.mcz
==================== Summary ====================
Name: Cog-eem.174 Author: eem Time: 28 July 2014, 6:38:12.482 pm UUID: 8d96136f-1223-476e-9761-546dd9e1d66c Ancestors: Cog-eem.173
Use numSlotsOf: and numBytesOf: in place of fetchLong32LengthOf:, fetchWordLengthOf: and byteLengthOf:. Needs VMMaker.oscog-eem.837
=============== Diff against Cog-eem.173 ===============
Item was changed: ----- Method: SpurBootstrap>>clone:classIndex: (in category 'bootstrap image') ----- clone: oldObj classIndex: classIndex | newObj | newObj := newHeap + allocateSlots: (oldHeap numSlotsOf: oldObj) - allocateSlots: (oldHeap fetchWordLengthOf: oldObj) format: (self newFormatFor: oldObj) classIndex: classIndex. reverseMap at: newObj put: oldObj. ^map at: oldObj put: newObj!
Item was changed: ----- Method: SpurBootstrap>>findLiteral: (in category 'bootstrap methods') ----- findLiteral: aLiteral | symbolOop smalltalk array | aLiteral isString ifTrue: [^self stringFor: aLiteral]. aLiteral isFloat ifTrue: [^oldInterpreter floatObjectOf: aLiteral]. aLiteral isArray ifTrue: [^self cloneArrayLiteral: aLiteral]. self assert: aLiteral isVariableBinding. symbolOop := self findSymbol: aLiteral key. smalltalk := oldHeap splObj: 8. array := oldHeap fetchPointer: 1 ofObject: smalltalk. self assert: (oldHeap isArray: array). + 0 to: (oldHeap numSlotsOf: array) - 1 do: - 0 to: (oldHeap fetchWordLengthOf: array) - 1 do: [:i| | bindingOrNil | bindingOrNil := oldHeap fetchPointer: i ofObject: array. (bindingOrNil ~= oldHeap nilObject and: [symbolOop = (oldHeap fetchPointer: KeyIndex ofObject: bindingOrNil) and: [aLiteral key == #Smalltalk ifTrue: [(oldHeap fetchPointer: ValueIndex ofObject: bindingOrNil) = smalltalk] ifFalse: [oldInterpreter classNameOf: (oldHeap fetchPointer: ValueIndex ofObject: bindingOrNil) Is: aLiteral key]]]) ifTrue: [^bindingOrNil]]. self error: 'couldn''t find literal ', aLiteral printString!
Item was changed: ----- Method: SpurBootstrap>>findSymbol: (in category 'bootstrap methods') ----- findSymbol: aString "Find the Symbol equal to aString in oldHeap." | symbolClass | (literalMap at: aString ifAbsent: nil) ifNotNil: [:oop| ^oop]. symbolClass := self symbolClass. oldHeap allObjectsDo: [:obj| (symbolClass = (oldHeap fetchClassOfNonImm: obj) + and: [(oldHeap numBytesOf: obj) = aString size - and: [(oldHeap byteLengthOf: obj) = aString size and: [aString = (oldHeap stringOf: obj)]]) ifTrue: [^obj]]. ^nil!
Item was changed: ----- Method: SpurBootstrap>>indexOfSelector:in: (in category 'bootstrap methods') ----- indexOfSelector: selectorOop in: methodDict + SelectorStart to: (oldHeap numSlotsOf: methodDict) - 1 do: - SelectorStart to: (oldHeap fetchWordLengthOf: methodDict) - 1 do: [:i| (oldHeap fetchPointer: i ofObject: methodDict) = selectorOop ifTrue: [^i]]. self error: 'could not find selector in method dict'!
Item was changed: ----- Method: SpurBootstrap>>modifyCharacterMethods (in category 'bootstrap methods') ----- modifyCharacterMethods | cc md mda | cc := oldHeap classCharacter. md := oldHeap fetchPointer: MethodDictionaryIndex ofObject: cc. mda := oldHeap fetchPointer: MethodArrayIndex ofObject: md.. + 0 to: (oldHeap numSlotsOf: mda) - 1 do: - 0 to: (oldHeap fetchWordLengthOf: mda) - 1 do: [:i| | method | method := oldHeap fetchPointer: i ofObject: mda. method ~= oldHeap nilObject ifTrue: [(self replacementForCharacterMethod: method) ifNotNil: [:replacement| Transcript cr; nextPutAll: 'replacing Character>>#'; nextPutAll: (oldHeap stringOf: (oldHeap fetchPointer: i + SelectorStart ofObject: md)); flush. oldHeap storePointer: i ofObject: mda withValue: replacement]]]!
Item was changed: ----- Method: SpurBootstrap>>newFormatFor: (in category 'bootstrap image') ----- newFormatFor: oldObj "OLD: 0 no fields 1 fixed fields only (all containing pointers) 2 indexable fields only (all containing pointers) 3 both fixed and indexable fields (all containing pointers) 4 both fixed and indexable weak fields (all containing pointers).
5 unused 6 indexable word fields only (no pointers) 7 indexable long (64-bit) fields (only in 64-bit images)
8-11 indexable byte fields only (no pointers) (low 2 bits are low 2 bits of size) 12-15 compiled methods: # of literal oops specified in method header, followed by indexable bytes (same interpretation of low 2 bits as above)"
"NEW: 0 = 0 sized objects (UndefinedObject True False et al) 1 = non-indexable objects with inst vars (Point et al) 2 = indexable objects with no inst vars (Array et al) 3 = indexable objects with inst vars (MethodContext AdditionalMethodState et al) 4 = weak indexable objects with inst vars (WeakArray et al) 5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)
and here it gets messy, we need 8 CompiledMethod values, 8 byte values, 4 16-bit values, 2 32-bit values and a 64-bit value, = 23 values, 23 + 5 = 30, so there may be room.
9 (?) 64-bit indexable 10 - 11 32-bit indexable 12 - 15 16-bit indexable 16 - 23 byte indexable 24 - 31 compiled method" | oldFormat | oldFormat := oldHeap formatOf: oldObj. oldFormat <= 4 ifTrue: [^oldFormat]. oldFormat >= 12 ifTrue: "CompiledMethod" + [^24 + (self wordSize - (oldHeap numBytesOf: oldObj) bitAnd: self wordSizeMask)]. - [^24 + (self wordSize - (oldHeap byteLengthOf: oldObj) bitAnd: self wordSizeMask)]. oldFormat >= 8 ifTrue: "ByteArray et al" + [^16 + (self wordSize - (oldHeap numBytesOf: oldObj) bitAnd: self wordSizeMask)]. - [^16 + (self wordSize - (oldHeap byteLengthOf: oldObj) bitAnd: self wordSizeMask)]. oldFormat = 6 ifTrue: "32-bit indexable" + [^10 + ((oldHeap numBytesOf: oldObj) bitAnd: self wordSizeMask) sign]. - [^10 + ((oldHeap byteLengthOf: oldObj) bitAnd: self wordSizeMask) sign]. oldFormat = 7 ifTrue: "64-bit indexable" [^9]. self error: 'illegal old format'!
Item was changed: ----- Method: SpurBootstrap32>>fillInBitsObject:from: (in category 'bootstrap') ----- fillInBitsObject: newObj from: oldObj + 0 to: (oldHeap numSlotsOf: oldObj) - 1 do: - 0 to: (oldHeap fetchLong32LengthOf: oldObj) - 1 do: [:i| newHeap storeLong32: i ofObject: newObj withValue: (oldHeap fetchLong32: i ofObject: oldObj)]!
vm-dev@lists.squeakfoundation.org