David T. Lewis uploaded a new version of ImageFormat to project VM Maker: http://source.squeak.org/VMMaker/ImageFormat-dtl.38.mcz ==================== Summary ==================== Name: ImageFormat-dtl.38 Author: dtl Time: 21 July 2019, 6:13:57.417 pm UUID: 37b709f4-a01d-48ea-8750-70eb5b194751 Ancestors: ImageFormat-dtl.37 More unit tests and consistency checks for image format numbers. =============== Diff against ImageFormat-dtl.37 =============== Item was changed: ----- Method: ImageFormat class>>bitAssignments (in category 'bit assignments') ----- bitAssignments "ImageFormat bitAssignments doWithIndex: [ :e :i | Transcript cr; show: 'bit ', i asString, ' is ', (e ifNil: ['unused'])]" | bits | bits := Array new: 32. "If bit 1 is set, the high and low order 32-bit words of a Float are stored in platform word order. If bit 1 is not set, big-endian word order is used for Float regardless of the platform." bits at: 1 put: 'the use platform float word order bit (Cog and StackInterpreter)'. bits at: 2 put: 'used in base version numbers'. bits at: 3 put: 'used in base version numbers'. bits at: 4 put: 'used in base version numbers'. bits at: 5 put: 'the Spur object format bit'. bits at: 6 put: 'used in base version numbers'. bits at: 7 put: 'used in base version numbers'. bits at: 8 put: 'used in base version numbers'. bits at: 9 put: 'used in base version numbers'. + bits at: 10 put: 'the multiple bytecode bit for Sista'. - bits at: 10 put: 'the multiple bytecode bit for Sista'.. bits at: 11 put: nil. "unassigned bit available for future image formats" bits at: 12 put: 'used in base version numbers'. bits at: 13 put: 'used in base version numbers'. bits at: 14 put: nil. "unassigned bit available for future image formats" bits at: 15 put: nil. "unassigned bit available for future image formats" bits at: 16 put: nil. "unassigned bit available for future image formats" bits at: 17 put: 'used in base version numbers'. bits at: 18 put: nil. "unassigned bit available for future image formats" bits at: 19 put: nil. "unassigned bit available for future image formats" bits at: 20 put: nil. "unassigned bit available for future image formats" bits at: 21 put: nil. "unassigned bit available for future image formats" bits at: 22 put: nil. "unassigned bit available for future image formats" bits at: 23 put: nil. "unassigned bit available for future image formats" bits at: 24 put: nil. "unassigned bit available for future image formats" bits at: 25 put: nil. "unassigned bit available for future image formats" bits at: 26 put: nil. "unassigned bit available for future image formats" bits at: 27 put: nil. "unassigned bit available for future image formats" bits at: 28 put: nil. "unassigned bit available for future image formats" bits at: 29 put: nil. "unassigned bit available for future image formats" bits at: 30 put: nil. "unassigned bit available for future image formats" bits at: 31 put: nil. "unassigned bit available for future image formats" "If bit 32 is set, additional image format information will be stored in one or more additional words. Currently this is unused, and bit 32 is always zero." bits at: 32 put: 'the extension bit (reserved for future use)'. ^bits ! Item was added: + ----- Method: ImageFormat class>>wordSize:closures:cog:spur:requiresNewSpur64TagAssignment:multipleBytecodes: (in category 'instance creation') ----- + wordSize: bytesPerWord closures: closuresRequired cog: cogRequired spur: spurRequired requiresNewSpur64TagAssignment: newSpur64 multipleBytecodes: isSista + + | fmt | + fmt := (self wordSize: bytesPerWord) + setCogSupportRequirement: cogRequired; + setClosureSupportRequirement: closuresRequired; "may override cog default set above" + setSpurSupportRequirement: spurRequired; + setRequiresNewSpur64TagAssignmentRequirement: newSpur64; + setRequiresMultipleBytecodeSupport: isSista. + fmt isValidVersionNumber ifFalse: [ self error: 'invalid format number ', fmt asInteger printString ]. + ^ fmt. + + ! Item was changed: ----- Method: ImageFormat class>>wordSize:spur:requiresNewSpur64TagAssignment:multipleBytecodes: (in category 'instance creation') ----- + wordSize: bytesPerWord spur: spurRequired requiresNewSpur64TagAssignment: newSpur64 multipleBytecodes: isSista - wordSize: bytesPerWord spur: spurRequired requiresNewSpur64TagAssignment: newSpur64 multipleBytecodes: isSpur + ^ self wordSize: bytesPerWord + closures: true + cog: true + spur: spurRequired + requiresNewSpur64TagAssignment: newSpur64 + multipleBytecodes: isSista - ^(self wordSize: bytesPerWord) - setClosureSupportRequirement: true; - setCogSupportRequirement: true; - setSpurSupportRequirement: spurRequired; - setRequiresNewSpur64TagAssignmentRequirement: newSpur64; - setRequiresMultipleBytecodeSupport: isSpur ! Item was added: + ----- Method: ImageFormat>>isDeprecated (in category 'private') ----- + isDeprecated + + "On 64 bit, the requiresNewSpur64TagAssignment bit must be set for all + format numbers higher than 68019, otherwise consider the format number + to be unused and deprecated. On 32 bit, the requiresNewSpur64TagAssignment + bit should never be set. The requiresNewSpur64TagAssignment is a hack + to account for some numbering confusion in early Spur 64 bit VM releases." + ^ wordSize = 8 + ifTrue: [ self asInteger > 68019 + and: [requiresNewSpur64TagAssignment not ] ] + ifFalse: [ requiresNewSpur64TagAssignment ] + ! Item was changed: ----- Method: ImageFormat>>isValidVersionNumber (in category 'private') ----- isValidVersionNumber "True if the version number uses a known base version number and does not use any reserved bits. Used only for unit tests, by definition this must always be true." + ^((BaseVersionNumbers includes: self baseVersionBits) + and: [(self asInteger bitAnd: ReservedBitsMask) = 0]) + and: [self isDeprecated not]! - ^(BaseVersionNumbers includes: self baseVersionBits) - and: [(self asInteger bitAnd: ReservedBitsMask) = 0]! Item was added: + ----- Method: ImageFormatTest>>testAllNewFromParameters (in category 'testing') ----- + testAllNewFromParameters + + "ImageFormat knownVersionNumbers ==> #(6502 6504 6505 6521 7033 68000 68002 68003 68004 68019 68021 68533)" + + "6502" + self assert: 6502 equals: (ImageFormat + wordSize: 4 + closures: false + cog: false + spur: false + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "6504" + self assert: 6504 equals: (ImageFormat + wordSize: 4 + closures: true + cog: false + spur: false + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "6505" + self assert: 6505 equals: (ImageFormat + wordSize: 4 + closures: true + cog: true + spur: false + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "6521" + self assert: 6521 equals: (ImageFormat + wordSize: 4 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + self should: [ImageFormat + wordSize: 4 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: true "should be false for 32 bits, this was a fix for 64 bit format numbers only" + multipleBytecodes: false] + raise: Error + whoseDescriptionIncludes: 'invalid format number 6523' + description: 'requiresNewSpurt64TagAssignment should be false for 32 bits, this was a fix for 64 bit format numbers only'. + "7033" + self assert: 7033 equals: (ImageFormat + wordSize: 4 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: false + multipleBytecodes: true) asInteger. + self should: [ImageFormat + wordSize: 4 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: true + multipleBytecodes: true] + raise: Error + whoseDescriptionIncludes: 'invalid format number 7035' + description: 'requiresNewSpurt64TagAssignment should be false for 32 bits, this was a fix for 64 bit format numbers only'. + "68000" + self assert: 68000 equals: (ImageFormat + wordSize: 8 + closures: false + cog: false + spur: false + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "68002" + self assert: 68002 equals: (ImageFormat + wordSize: 8 + closures: true + cog: false + spur: false + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "68003 is valid but has never been implemented" + self assert: 68003 equals: (ImageFormat + wordSize: 8 + closures: true + cog: true + spur: false + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "68004 FIXME should not be allowed" + self assert: 68004 equals: (ImageFormat "FIXME" + wordSize: 8 + closures: true + cog: false + spur: false + requiresNewSpur64TagAssignment: true + multipleBytecodes: false) asInteger. + "68019 is valid but obsolete, replaced by 68021" + self assert: 68019 equals: (ImageFormat + wordSize: 8 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: false + multipleBytecodes: false) asInteger. + "68021" + self assert: 68021 equals: (ImageFormat + wordSize: 8 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: true + multipleBytecodes: false) asInteger. + "68531 is not used" + self should: [ImageFormat + wordSize: 8 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: false + multipleBytecodes: true] + raise: Error + whoseDescriptionIncludes: 'invalid format number 68531' + description: '68531 is obsolete, use 68533 instead'. + "68533" + self assert: 68533 equals: (ImageFormat "FIXME pick one please" + wordSize: 8 + closures: true + cog: true + spur: true + requiresNewSpur64TagAssignment: true + multipleBytecodes: true) asInteger. + + + + + ! |
Free forum by Nabble | Edit this page |