[Vm-dev] VM Maker: ImageFormat-dtl.36.mcz

commits at source.squeak.org commits at source.squeak.org
Fri May 10 11:27:01 UTC 2019


David T. Lewis uploaded a new version of ImageFormat to project VM Maker:
http://source.squeak.org/VMMaker/ImageFormat-dtl.36.mcz

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

Name: ImageFormat-dtl.36
Author: dtl
Time: 10 May 2019, 7:27:00.214 am
UUID: 84ef5cdf-ca3b-4f81-8724-0662c9becb80
Ancestors: ImageFormat-kks.35

Let 68004 be a base version number, supporting the 68021 64-bit Spur format. Base number plus Spur bit plus platform float order bit yields 68021.

68004 + 2r10001 ==> 68021

Restore a unit test that covers 68021format.
Reorganize method categories to clarify bit assignment methods.

Notes: 68004 has not been used in practice but is considered valid. These changes do not affect the generated ckformat.c program.

=============== Diff against ImageFormat-kks.35 ===============

Item was changed:
+ ----- Method: ImageFormat class>>availableBits (in category 'bit assignments') -----
- ----- Method: ImageFormat class>>availableBits (in category 'initialize-release') -----
  availableBits
  	"Bits available for use as capability bits. Reserve high order bit as the
  	extension bit, to be set true if additional bits are required in the future."
  	
  	"ImageFormat availableBits printStringBase: 2"
  
  	| mask |
  	mask := 0.
  	self bitAssignments doWithIndex: [ :e :i |
  		mask := mask bitAt: i put: (e isNil ifTrue: [ 1 ] ifFalse: [ 0 ])].
  	^ mask
  !

Item was changed:
  ----- Method: ImageFormat class>>baseVersionNumbers (in category 'image formats') -----
  baseVersionNumbers
  	"The well-known image format versions for basic 32 and 64 bit images,
  	including images that require closure bytecode support. These base
  	format numbers my be modified by application of various capability bits
  	representing additional requirements that the image expects to be
  	supported by the virtual machine."
  
+ 	^#(6502 6504 68000 68002 68004)
- 	^#(6502 6504 68000 68002)
  !

Item was changed:
+ ----- Method: ImageFormat class>>bitAssignments (in category 'bit assignments') -----
- ----- Method: ImageFormat class>>bitAssignments (in category 'initialize-release') -----
  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: nil.	"unassigned bit available for future image formats"
  	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 changed:
+ ----- Method: ImageFormat class>>bitsInUse (in category 'bit assignments') -----
- ----- Method: ImageFormat class>>bitsInUse (in category 'image formats') -----
  bitsInUse
  	"Answer a mask of the bits used by all known version format numbers"
  
  	"Transcript cr; show: (ImageFormat bitsInUse printStringBase: 2)"
  
  	| mask |
  	mask := 0.
  	self bitAssignments doWithIndex: [ :e :i |
  		mask := mask bitAt: i put: (e notNil ifTrue: [ 1 ] ifFalse: [ 0 ])].
  	^ mask
  !

Item was changed:
+ ----- Method: ImageFormat class>>knownVersionNumbers (in category 'image formats') -----
- ----- Method: ImageFormat class>>knownVersionNumbers (in category 'initialize-release') -----
  knownVersionNumbers
  	"Version numbers currently in use or likely to be used (e.g. 64-bit Cog formats)"
  
  	"ImageFormat knownVersionNumbers collect: [:e | (ImageFormat fromInteger: e) description]"
  
  	^ ( self baseVersionNumbers, "the original format number variants"
  		{
  			6505 .	"Cog and StackVM"
  			68003 .	"Cog and StackVM running 64-bit image"
  			6521 .	"Spur 32 bit object memory"
  			68019 .	"Spur 64 bit object memory (early)"
  			68021 .	"Spur 64 bit object memory"
  				" ... add others here as bits are allocated to represent requirements of other image formats"
  		} ) sort.
  !

Item was changed:
  ----- Method: ImageFormatTest>>testIsValidVersionNumber (in category 'testing') -----
  testIsValidVersionNumber
  
  	self should: [ImageFormat fromInteger: 0] raise: Error.
  	self should: [ImageFormat fromInteger: (6502 bitAnd: 16r80000000)] raise: Error.
  	self should: [ImageFormat fromInteger: (6502 bitAt: 31 put: 1)] raise: Error.
  	self should: [ImageFormat fromInteger: 6500] raise: Error.
  	self should: [ImageFormat fromInteger: 6501] raise: Error.
  	self should: [ImageFormat fromInteger: 6503] raise: Error. "Cog requires both capabilities"
  	self should: [ImageFormat fromInteger: 68001] raise: Error. "Cog requires both capabilities"
  
  	self assert: ImageFormat default isValidVersionNumber.
  	self assert: (ImageFormat wordSize: 4 closures: false) isValidVersionNumber.
  	self assert: (ImageFormat wordSize: 4 closures: true) isValidVersionNumber.
  	self assert: (ImageFormat wordSize: 8 closures: false) isValidVersionNumber.
  	self assert: (ImageFormat wordSize: 8 closures: true) isValidVersionNumber.
  	self assert: (ImageFormat fromInteger: 6502) isValidVersionNumber.
  	self assert: (ImageFormat fromInteger: (6502 bitAt: 31 put: 0)) isValidVersionNumber.
  	self assert: (ImageFormat fromInteger: 6521) isValidVersionNumber.
  	self assert: (ImageFormat fromInteger:68000) isValidVersionNumber.
  	self assert: (ImageFormat fromInteger:68002) isValidVersionNumber.
+ 	self assert: (ImageFormat fromInteger:68004) isValidVersionNumber.
  	self assert: (ImageFormat fromInteger:68003) isValidVersionNumber. "valid but unused, as with 68019"
  	self assert: (ImageFormat fromInteger: 68019) isValidVersionNumber.
+ 	self assert: (ImageFormat fromInteger: 68021) isValidVersionNumber.
  
  !



More information about the Vm-dev mailing list