Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI: http://source.squeak.org/FFI/FFI-Kernel-mt.190.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.190 Author: mt Time: 9 August 2021, 5:54:44.510391 pm UUID: 6936522e-daaf-404a-86b6-f21a36197f8d Ancestors: FFI-Kernel-mt.189
Improves initialization of type aliases during initial code loading. Note that "self defineFields" is still required after changing/implementing #originalTypeName in the alias' referentClass.
=============== Diff against FFI-Kernel-mt.189 ===============
Item was changed: + ----- Method: ExternalAtomicType>>newTypeAlias (in category 'private') ----- - ----- Method: ExternalAtomicType>>newTypeAlias (in category 'testing') ----- newTypeAlias + "Only support switching between atomic types for now." + self isTypeAlias ifFalse: [^ self]. + + compiledSpec := referentClass compiledSpec. + byteAlignment := referentClass byteAlignment.! - "self isTypeAlias ifFalse: [^ self]." - "Nothing to do. My referentClass was already upated." - !
Item was changed: ----- Method: ExternalStructureType>>newTypeAlias (in category 'private') ----- newTypeAlias + "Only support switching between struct types for now." + self isTypeAlias ifFalse: [^ self]. + + compiledSpec := referentClass compiledSpec. + byteAlignment := referentClass byteAlignment.! - "self isTypeAlias ifFalse: [^ self]." - "Nothing to do. My referentClass was already upated." - !
Item was changed: ----- Method: ExternalType class>>newTypeNamed: (in category 'instance creation') ----- newTypeNamed: aTypeName "Create a new struct type or array type. Not needed for atomic types; see #initializeDefaultTypes." | structClass arraySpec | self assert: [aTypeName last ~~ $*] description: 'Pointer type will be created automatically'. self assert: [aTypeName first ~~ $*] description: 'Non-pointer type for alias-to-pointer types will be created automatically'. aTypeName last == $] ifTrue: [ "array type, e.g., char[50]" arraySpec := self parseArrayTypeName: aTypeName. arraySpec second ifNil: [arraySpec at: 2 put: (self newTypeNamed: arraySpec first)]. ^ self newTypeForContentType: arraySpec second size: arraySpec third]. structClass := (self environment classNamed: aTypeName) ifNotNil: [:class | (class includesBehavior: ExternalStructure) ifTrue: [class]].
+ ^ (structClass isNil or: [structClass isSkipped "i.e., not yet ready, see ExternalTypeAlias"]) + ifTrue: [self newTypeForUnknownNamed: aTypeName] + ifFalse: [self newTypeForStructureClass: structClass]! - ^ structClass - ifNil: [self newTypeForUnknownNamed: aTypeName] - ifNotNil: [self newTypeForStructureClass: structClass]!
Item was changed: ----- Method: ExternalTypeAlias class>>isSkipped (in category 'field definition') ----- isSkipped + "Skip this class and all subclasses that have not yet implemented #originalTypeName."
+ ^ self == ExternalTypeAlias + or: [(self class lookupSelector: #originalTypeName) hasLiteral: #subclassResponsibility]! - ^ self == ExternalTypeAlias!
Item was changed: ----- Method: ExternalUnknownType>>newTypeAlias (in category 'construction') ----- newTypeAlias + "A type alias is done compiling and its type can now be initialized completely. See ExternalTypeAlias class >> #originalTypeName and #isSkipped."
+ self assert: [referentClass isBehavior]. + + referentClass isTypeAlias + ifTrue: [^ self becomeKnownType]. + + self error: '[FFI] Only type aliases can become a known type later on'.! - self shouldNotImplement.!
squeak-dev@lists.squeakfoundation.org