VM Maker: ImageFormat-dtl.26.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

VM Maker: ImageFormat-dtl.26.mcz

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

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

Name: ImageFormat-dtl.26
Author: dtl
Time: 25 July 2017, 8:11:17.418 am
UUID: f97d3f06-0bf7-4472-aecd-0a750c9d7ca1
Ancestors: ImageFormat-dtl.25

Bit 17 of the image format number may be used as a test for 64-bit-ness for both Spur and V3. Add testBit17AsTestFor64BitImages to document this.

The changes in ImageFormat-dtl.20 for format numbers 68019 and 68021 were missing test support, add it here.

=============== Diff against ImageFormat-dtl.25 ===============

Item was changed:
  ----- 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"
- ^ self baseVersionNumbers, "the original four variants"
  {
  6505 . "Cog and StackVM"
+ 68004 . "Cog and StackVM running 64-bit image"
- 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"
  }
  !

Item was changed:
  ----- Method: ImageFormatTest>>testAsInteger (in category 'testing') -----
  testAsInteger
 
  self assert: (ImageFormat fromInteger: 6502) asInteger = 6502.
  self assert: (ImageFormat fromInteger: 6504) asInteger = 6504.
  self assert: (ImageFormat fromInteger: 68000) asInteger = 68000.
  self assert: (ImageFormat fromInteger: 68002) asInteger = 68002.
  self assert: (ImageFormat fromInteger: 6521) asInteger = 6521.
  self assert: (ImageFormat fromInteger: 68019) asInteger = 68019.
+ self assert: (ImageFormat fromInteger: 68021) asInteger = 68021.
  !

Item was added:
+ ----- Method: ImageFormatTest>>testBit17AsTestFor64BitImages (in category 'testing') -----
+ testBit17AsTestFor64BitImages
+ "If bit 17 of the version number is 1, then the image is a 64-bit image."
+
+ ImageFormat knownVersionNumbers do: [ :versionNumber | | is64 bit17 |
+ is64 := (ImageFormat fromInteger: versionNumber) is64Bit.
+ bit17 := versionNumber bitAt: 17.
+ self assert: bit17 = 1 equals:is64
+ ].
+ !

Item was changed:
  ----- Method: ImageFormatTest>>testIs32Bit (in category 'testing') -----
  testIs32Bit
 
  self assert: (ImageFormat wordSize: 4) is32Bit.
  self assert: (ImageFormat new fromInteger: 6504) is32Bit.
  self deny: (ImageFormat wordSize: 8) is32Bit.
  self deny: (ImageFormat new fromInteger: 68002) is32Bit.
  self deny: (ImageFormat fromInteger: 6521) is64Bit.
  self assert: (ImageFormat new fromInteger: 68019) is64Bit.
+ self assert: (ImageFormat new fromInteger: 68021) is64Bit.
  !

Item was changed:
  ----- Method: ImageFormatTest>>testIs64Bit (in category 'testing') -----
  testIs64Bit
 
  self deny: (ImageFormat wordSize: 4) is64Bit.
  self deny: (ImageFormat new fromInteger: 6504) is64Bit.
  self assert: (ImageFormat wordSize: 8) is64Bit.
  self assert: (ImageFormat new fromInteger: 68002) is64Bit.
  self deny: (ImageFormat fromInteger: 6521) is64Bit.
  self assert: (ImageFormat new fromInteger: 68019) is64Bit.
+ self assert: (ImageFormat new fromInteger: 68021) is64Bit.
  !

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.
 
  !

Item was changed:
  ----- Method: ImageFormatTest>>testRequiresNativeFloatWordOrder (in category 'testing') -----
  testRequiresNativeFloatWordOrder
  "Required for Cog and StackInterpreter"
 
  | v |
  v := ImageFormat wordSize: 4.
  self deny: v requiresNativeFloatWordOrder.
  v setCogSupportRequirement: false.
  self assert: v asInteger = 6502.
  self deny: v requiresNativeFloatWordOrder.
  v setCogSupportRequirement: true.
  self assert: v asInteger = 6505.
  self assert: v requiresNativeFloatWordOrder.
  v setSpurSupportRequirement: true.
  self assert: v asInteger = 6521.
 
  v := ImageFormat wordSize: 8.
  self deny: v requiresNativeFloatWordOrder.
  v setCogSupportRequirement: false.
  self assert: v asInteger = 68000.
  self deny: v requiresNativeFloatWordOrder.
  v setCogSupportRequirement: true.
  self assert: v asInteger = 68003.
  self assert: v requiresNativeFloatWordOrder.
  v setSpurSupportRequirement: true.
  self assert: v asInteger = 68019.
 
  self deny: (ImageFormat wordSize: 4 cog: false) requiresNativeFloatWordOrder.
  self deny: (ImageFormat wordSize: 4 cog: false) requiresClosureSupport.
  self deny: (ImageFormat wordSize: 8 cog: false) requiresNativeFloatWordOrder.
  self deny: (ImageFormat wordSize: 8 cog: false) requiresClosureSupport.
  self assert: (ImageFormat wordSize: 4 cog: true) requiresNativeFloatWordOrder.
  self assert: (ImageFormat wordSize: 4 cog: true) requiresClosureSupport.
  self assert: (ImageFormat wordSize: 8 cog: true) requiresNativeFloatWordOrder.
  self assert: (ImageFormat wordSize: 8 cog: true) requiresClosureSupport.
  self assert: (ImageFormat fromInteger: 6521) requiresNativeFloatWordOrder.
  self assert: (ImageFormat fromInteger: 6521) requiresClosureSupport.
  self assert: (ImageFormat fromInteger: 68019) requiresNativeFloatWordOrder.
  self assert: (ImageFormat fromInteger: 68019) requiresClosureSupport.
+ self assert: (ImageFormat fromInteger: 68021) requiresNativeFloatWordOrder.
+ self assert: (ImageFormat fromInteger: 68021) requiresClosureSupport.
+
  !

Loading...