[squeak-dev] FFI: FFI-Kernel-mt.221.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Dec 13 13:45:52 UTC 2021
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.221.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.221
Author: mt
Time: 13 December 2021, 2:45:51.029673 pm
UUID: b5c4eb35-ece0-704d-8ff9-15bdb6ea6345
Ancestors: FFI-Kernel-mt.220
Fixes a type-init issue with alias-to-pointer types. Generalize #newReferentClass: to also consider their referencedType (i.e. pointer or non-pointer type).
=============== Diff against FFI-Kernel-mt.220 ===============
Item was removed:
- ----- Method: ExternalArrayType>>newReferentClass: (in category 'private') -----
- newReferentClass: classOrNil
- "The class I'm referencing has changed, which affects arrays of structs. Update my byteSize."
-
- (referentClass := classOrNil)
- ifNil: [ "my class has been removed - make me 'struct { void }'"
- compiledSpec := WordArray with: self class structureSpec.
- byteAlignment := 1.
- contentType := size := byteSize := nil]
- ifNotNil: [ "I am an alias-to-array type. Update my specs."
- | originalType |
- originalType := referentClass originalType.
- self assert: [originalType isArrayType].
-
- compiledSpec := originalType compiledSpec.
- byteAlignment := originalType byteAlignment.
-
- contentType := originalType contentType.
- size := originalType size.
- byteSize := originalType byteSize]!
Item was added:
+ ----- Method: ExternalArrayType>>updateFromReferentClass: (in category 'private') -----
+ updateFromReferentClass: classOrNil
+ "The class I'm referencing has changed, which affects arrays of structs. Update my byteSize."
+
+ (referentClass := classOrNil)
+ ifNil: [ "my class has been removed - make me 'struct { void }'"
+ compiledSpec := WordArray with: self class structureSpec.
+ byteAlignment := 1.
+ contentType := size := byteSize := nil]
+ ifNotNil: [ "I am an alias-to-array type. Update my specs."
+ | originalType |
+ originalType := referentClass originalType.
+ self assert: [originalType isArrayType].
+
+ compiledSpec := originalType compiledSpec.
+ byteAlignment := originalType byteAlignment.
+
+ contentType := originalType contentType.
+ size := originalType size.
+ byteSize := originalType byteSize]!
Item was removed:
- ----- Method: ExternalAtomicType>>newReferentClass: (in category 'private') -----
- newReferentClass: classOrNil
- "If I am an alias-to-atomic type, fetch the current spec from my referentClass."
-
- (referentClass := classOrNil)
- ifNotNil: [ "my class has been changed - update my compiledSpec"
- compiledSpec := referentClass compiledSpec.
- byteAlignment := referentClass byteAlignment].!
Item was added:
+ ----- Method: ExternalAtomicType>>updateFromReferentClass: (in category 'private') -----
+ updateFromReferentClass: classOrNil
+ "If I am an alias-to-atomic type, fetch the current spec from my referentClass."
+
+ (referentClass := classOrNil)
+ ifNotNil: [ "my class has been changed - update my compiledSpec"
+ compiledSpec := referentClass compiledSpec.
+ byteAlignment := referentClass byteAlignment].!
Item was changed:
----- Method: ExternalStructureType class>>newTypeForStructureClass: (in category 'instance creation') -----
newTypeForStructureClass: anExternalStructureClass
+ | type referentClass |
- | type pointerType referentClass |
referentClass := anExternalStructureClass.
self
assert: [referentClass includesBehavior: ExternalStructure]
description: 'Wrong base class for structure'.
type := self newTypeForUnknownNamed: referentClass name.
- pointerType := type asPointerType.
referentClass compiledSpec
ifNil: [ "First time. The referent class' fields are probably just compiled for the first time."
type setReferentClass: referentClass.
+ type asPointerType setReferentClass: referentClass]
- pointerType setReferentClass: referentClass]
ifNotNil: [
+ type newReferentClass: referentClass].
- type newReferentClass: referentClass.
- pointerType newReferentClass: referentClass].
type becomeKnownTypeSafely.
type generateTypeAccessor.
^ type!
Item was removed:
- ----- Method: ExternalStructureType>>newReferentClass: (in category 'private') -----
- newReferentClass: classOrNil
- "The class I'm referencing has changed. Update my spec."
-
- (referentClass := classOrNil)
- ifNil: [ "my class has been removed - make me 'struct { void }'"
- compiledSpec := WordArray with: self class structureSpec.
- byteAlignment := 1]
- ifNotNil: [ "my class has been changed - update my compiledSpec"
- compiledSpec := referentClass compiledSpec.
- byteAlignment := referentClass byteAlignment].!
Item was added:
+ ----- Method: ExternalStructureType>>updateFromReferentClass: (in category 'private') -----
+ updateFromReferentClass: classOrNil
+ "The class I'm referencing has changed. Update my spec."
+
+ (referentClass := classOrNil)
+ ifNil: [ "my class has been removed - make me 'struct { void }'"
+ compiledSpec := WordArray with: self class structureSpec.
+ byteAlignment := 1]
+ ifNotNil: [ "my class has been changed - update my compiledSpec"
+ compiledSpec := referentClass compiledSpec.
+ byteAlignment := referentClass byteAlignment].!
Item was changed:
----- Method: ExternalType class>>noticeModificationOf: (in category 'housekeeping') -----
noticeModificationOf: aClass
"A subclass of ExternalStructure has been redefined."
aClass withAllSubclassesDo: [:cls | | typeName type |
typeName := cls name.
(type := StructTypes at: typeName ifAbsent: [])
ifNil: ["Give unused types a chance to establish a hard reference via type accessor."
type := self structTypeNamed: typeName]
ifNotNil: [
type newReferentClass: cls.
- type asPointerType newReferentClass: cls.
type newTypeAlias].
ArrayTypes at: typeName ifPresent: [:sizes |
sizes do: [:arrayType | arrayType ifNotNil: [
arrayType newContentType: type]]].
"Alias-to-array types, which are stored in StructTypes, will not update via #newContentType:. We scan StructTypes for #isArrayType to find such aliases to then call #newContentType:."
self flag: #performance.
StructTypes do: [:each |
(each notNil and: [each isArrayType and: [each contentType == type]])
ifTrue: [each newContentType: type]]].!
Item was changed:
----- Method: ExternalType class>>noticeRemovalOf: (in category 'housekeeping') -----
noticeRemovalOf: aClass
"A subclass of ExternalStructure is being removed.
Clean out any obsolete references to its type."
| typeName type |
typeName := aClass name.
(type := StructTypes at: typeName ifAbsent: [])
+ ifNotNil: [type newReferentClass: nil].
- ifNotNil: [
- type newReferentClass: nil.
- type asPointerType newReferentClass: nil].
ArrayTypes at: aClass name ifPresent: [:sizes |
sizes do: [:arrayType | arrayType ifNotNil: [
arrayType newContentType: nil]].
"Alias-to-array types, which are stored in StructTypes, will not update via #newContentType:. We scan StructTypes for #isArrayType to find such aliases to then call #newContentType:."
StructTypes do: [:each |
(each notNil and: [each isArrayType and: [each contentType == type]])
ifTrue: [each newContentType: type]]].!
Item was changed:
----- Method: ExternalType>>newReferentClass: (in category 'private') -----
newReferentClass: classOrNil
+ self updateFromReferentClass: classOrNil.
+ referencedType updateFromReferentClass: classOrNil.!
- referentClass := classOrNil.!
Item was added:
+ ----- Method: ExternalType>>updateFromReferentClass: (in category 'private') -----
+ updateFromReferentClass: classOrNil
+
+ referentClass := classOrNil.!
Item was removed:
- ----- Method: ExternalUnknownType>>newReferentClass: (in category 'private') -----
- newReferentClass: classOrNil
-
- self assert: [classOrNil notNil].
-
- referentClass := classOrNil.
- compiledSpec := referentClass compiledSpec.
- byteAlignment := referentClass byteAlignment.!
Item was added:
+ ----- Method: ExternalUnknownType>>updateFromReferentClass: (in category 'private') -----
+ updateFromReferentClass: classOrNil
+
+ self assert: [classOrNil notNil].
+
+ referentClass := classOrNil.
+ compiledSpec := referentClass compiledSpec.
+ byteAlignment := referentClass byteAlignment.!
More information about the Squeak-dev
mailing list
|