[squeak-dev] FFI: FFI-Pools-mt.39.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Sep 16 09:47:48 UTC 2021


Marcel Taeumel uploaded a new version of FFI-Pools to project FFI:
http://source.squeak.org/FFI/FFI-Pools-mt.39.mcz

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

Name: FFI-Pools-mt.39
Author: mt
Time: 16 September 2021, 11:47:46.45032 am
UUID: a4714e92-6b1a-0244-8aaf-b461af879700
Ancestors: FFI-Pools-mt.38

Complements/prepares FFI-Kernel-mt.220. Integrates FFI-Pools-eem.39 from inbox.

16-bit and 32-bit character types will simply get type codes 14 and 15 to remain backwards compatible within plugin version 1.

Sketches possible #initializeTypeConstants_v2 for plugin version 2, using 5 bits instead of 4 bits for encoding type codes.

=============== Diff against FFI-Pools-mt.38 ===============

Item was changed:
  SharedPool subclass: #FFIConstants
  	instanceVariableNames: ''
+ 	classVariableNames: 'FFIAtomicTypeMask FFIAtomicTypeShift FFICallFlagThreaded FFICallTypeApi FFICallTypeCDecl FFICallTypesMask FFIErrorAddressNotFound FFIErrorAttemptToPassVoid FFIErrorBadAddress FFIErrorBadArg FFIErrorBadArgs FFIErrorBadAtomicType FFIErrorBadExternalFunction FFIErrorBadExternalLibrary FFIErrorBadReturn FFIErrorCallFrameTooBig FFIErrorCallType FFIErrorCoercionFailed FFIErrorGenericError FFIErrorIntAsPointer FFIErrorInvalidPointer FFIErrorModuleNotFound FFIErrorNoModule FFIErrorNotFunction FFIErrorStructSize FFIErrorWrongType FFIFlagAtomic FFIFlagPointer FFIFlagStructure FFINoCalloutAvailable FFIStructSizeMask FFITypeBool FFITypeDoubleFloat FFITypeSignedChar8 FFITypeSignedInt16 FFITypeSignedInt32 FFITypeSignedInt64 FFITypeSignedInt8 FFITypeSingleFloat FFITypeUnsignedChar16 FFITypeUnsignedChar32 FFITypeUnsignedChar8 FFITypeUnsignedInt16 FFITypeUnsignedInt32 FFITypeUnsignedInt64 FFITypeUnsignedInt8 FFITypeVoid'
- 	classVariableNames: 'FFIAtomicTypeMask FFIAtomicTypeShift FFICallFlagThreaded FFICallTypeApi FFICallTypeCDecl FFICallTypesMask FFIErrorAddressNotFound FFIErrorAttemptToPassVoid FFIErrorBadAddress FFIErrorBadArg FFIErrorBadArgs FFIErrorBadAtomicType FFIErrorBadExternalFunction FFIErrorBadExternalLibrary FFIErrorBadReturn FFIErrorCallFrameTooBig FFIErrorCallType FFIErrorCoercionFailed FFIErrorGenericError FFIErrorIntAsPointer FFIErrorInvalidPointer FFIErrorModuleNotFound FFIErrorNoModule FFIErrorNotFunction FFIErrorStructSize FFIErrorWrongType FFIFlagAtomic FFIFlagPointer FFIFlagStructure FFINoCalloutAvailable FFIStructSizeMask FFITypeBool FFITypeDoubleFloat FFITypeSignedChar16 FFITypeSignedChar32 FFITypeSignedChar8 FFITypeSignedInt16 FFITypeSignedInt32 FFITypeSignedInt64 FFITypeSignedInt8 FFITypeSingleFloat FFITypeUnsignedChar16 FFITypeUnsignedChar32 FFITypeUnsignedChar8 FFITypeUnsignedInt16 FFITypeUnsignedInt32 FFITypeUnsignedInt64 FFITypeUnsignedInt8 FFITypeVoid'
  	poolDictionaries: ''
  	category: 'FFI-Pools'!
  
  !FFIConstants commentStamp: 'TorstenBergmann 4/27/2017 11:02' prior: 0!
  Constants definitions for FFI!

Item was changed:
  ----- Method: FFIConstants class>>initializeTypeConstants_v1 (in category 'pool initialization') -----
  initializeTypeConstants_v1
  	<pluginVersion: 1>
  
  	"type void"
  	FFITypeVoid := 0.
  
  	"type bool"
  	FFITypeBool := 1.
  
  	"basic integer types.
  	note: (integerType anyMask: 1) = integerType isSigned"
- 
  	FFITypeUnsignedInt8 := 2.
  	FFITypeSignedInt8 := 3.
  	FFITypeUnsignedInt16 := 4.
  	FFITypeSignedInt16 := 5.
  	FFITypeUnsignedInt32 := 6.
  	FFITypeSignedInt32 := 7.
  	FFITypeUnsignedInt64 := 8.
  	FFITypeSignedInt64 := 9.
  
+ 	"original character types
+ 	 note: isCharacterType ^type >> 1 >= 5 and: [(type >> 1) odd]"
- 	"special integer types"
  	FFITypeUnsignedChar8 := 10.
+ 	FFITypeSignedChar8 := 11. "N.B. misnomer!!"
- 	FFITypeSignedChar8 := 11.
- 	FFITypeUnsignedChar16 := 10. "v1 is for backwards compatibility"
- 	FFITypeSignedChar16 := 11. "v1 is for backwards compatibility"
- 	FFITypeUnsignedChar32 := 10. "v1 is for backwards compatibility"
- 	FFITypeSignedChar32 := 11. "v1 is for backwards compatibility"
  
+ 	"float types
+ 	 note: isFloatType ^type >> 1 = 6"
- 	"float types"
  	FFITypeSingleFloat := 12.
  	FFITypeDoubleFloat := 13.
  
+ 	"new character types
+ 	 note: isCharacterType ^type >> 1 >= 5 and: [(type >> 1) odd]"
+ 	FFITypeUnsignedChar16 := 14.
+ 	FFITypeUnsignedChar32 := 15.
+ 
  	"type flags"
  	FFIFlagAtomic := 16r40000. "type is atomic"
  	FFIFlagPointer := 16r20000. "type is pointer to base type"
  	FFIFlagStructure := 16r10000. "baseType is structure of 64k length"
  	FFIStructSizeMask := 16rFFFF. "mask for max size of structure"
  	FFIAtomicTypeMask := 16r0F000000. "mask for atomic type spec"
  	FFIAtomicTypeShift := 24. "shift for atomic type"
  !

Item was changed:
  ----- Method: FFIConstants class>>initializeTypeConstants_v2 (in category 'pool initialization') -----
  initializeTypeConstants_v2
  	<pluginVersion: 2>
  	
  	self halt. "Not fully specified and still to be discussed."
  	
  	"type void"
  	FFITypeVoid := 0.
+ 	
+ 	"float types"
+ 	"FFITypeHalfFloat := 1 -- ARMv8 supports 16-bit floats"
+ 	FFITypeSingleFloat := 2.
+ 	FFITypeDoubleFloat := 3.
  
+ 	"4 - 7 unused"
- 	"type bool"
- 	FFITypeBool := 1.
  
+ 	"integer types
+ 	note: (integerType allMask: 2r01100) = integerType isSigned
+ 	note: (integerType anyMask: 2r01000) = integerType isIntegerType"
- 	"basic integer types.
- 	note: (integerType anyMask: 1) = integerType isSigned"
  
+ 	FFITypeUnsignedInt8 := 8.
+ 	FFITypeUnsignedInt16 := 9.
+ 	FFITypeUnsignedInt32 := 10.
+ 	FFITypeUnsignedInt64 := 11.
- 	FFITypeUnsignedInt8 := 2.
- 	FFITypeSignedInt8 := 3.
- 	FFITypeUnsignedInt16 := 4.
- 	FFITypeSignedInt16 := 5.
- 	FFITypeUnsignedInt32 := 6.
- 	FFITypeSignedInt32 := 7.
- 	FFITypeUnsignedInt64 := 8.
- 	FFITypeSignedInt64 := 9.
  
+ 	FFITypeSignedInt8 := 12.
+ 	FFITypeSignedInt16 := 13.
+ 	FFITypeSignedInt32 := 14.
+ 	FFITypeSignedInt64 := 15.
- 	"special integer types"
- 	FFITypeUnsignedChar8 := 10.
- 	FFITypeSignedChar8 := 11.
- 	FFITypeUnsignedChar16 := 12.
- 	FFITypeSignedChar16 := 13.
- 	FFITypeUnsignedChar32 := 14.
- 	FFITypeSignedChar32 := 15.
  
+ 	"boolean types
+ 	note: ((boolType anyMask: 2r10000) and: [boolType noMask: 2r00100]) = boolType isBoolType"
+ 	"FFITypeBool8 := 16."
+ 	"FFITypeBool16 := 17"
+ 	"FFITypeBool32 := 18"
+ 	"FFITypeBool64 := 19"
+ 	
+ 	"character types
+ 	note: (charType allMask: 2r10100) = charType isCharType"
+ 	FFITypeUnsignedChar8 := 20.
+ 	FFITypeUnsignedChar16 := 21.
+ 	FFITypeUnsignedChar32 := 22.
+ 	"FFITypeUnsignedChar64 := 23."
- 	"float types"
- 	FFITypeSingleFloat := 16.
- 	FFITypeDoubleFloat := 17.
  
+ 	"24 - 31 unused"
+ 
  	"type flags"
  	FFIFlagAtomic := 16r40000. "type is atomic"
  	FFIFlagPointer := 16r20000. "type is pointer to base type"
  	FFIFlagStructure := 16r10000. "baseType is structure of 64k length"
  	FFIStructSizeMask := 16rFFFF. "mask for max size of structure"
+ 	FFIAtomicTypeMask := 16r1F000000. "mask for atomic type spec"
- 	FFIAtomicTypeMask := 16r0F000000. "mask for atomic type spec"
  	FFIAtomicTypeShift := 24. "shift for atomic type"
  !



More information about the Squeak-dev mailing list