Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI: http://source.squeak.org/FFI/FFI-Kernel-mt.230.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.230 Author: mt Time: 16 June 2023, 1:53:15.667813 pm UUID: a4c0f4c0-a674-2c48-8ac0-f73251d7aa69 Ancestors: FFI-Kernel-mt.229
Revise FFI-Kernel-eem.228 by just updating the check in ExternalType >> #platformChangedFrom:to:. Reverts the extra update logic that was introduced by FFI-Kernel-eem.228.
=============== Diff against FFI-Kernel-mt.229 ===============
Item was changed: ExternalFunction subclass: #ExternalLibraryFunction instanceVariableNames: 'name module errorCodeName' + classVariableNames: '' - classVariableNames: 'Instances' poolDictionaries: '' category: 'FFI-Kernel'!
!ExternalLibraryFunction commentStamp: '' prior: 0! An ExternalLibraryFunction specifies a fully qualified function from an external library.
Instance variables: name <String | Integer> name or ordinal of function module <String | nil> name of module (nil if bound in the VM). errorCodeName <String | nil> name of temp receiving error code, if any!
Item was removed: - ----- Method: ExternalLibraryFunction class>>instances (in category 'private') ----- - instances - "Cache our instances for faster reinitialization." - ^Instances ifNil: [Instances := WeakSet withAll: self allInstances]!
Item was removed: - ----- Method: ExternalLibraryFunction class>>new (in category 'instance creation') ----- - new - ^self instances add: super new!
Item was removed: - ----- Method: ExternalLibraryFunction class>>platformChangedFrom:to: (in category 'instance initialization') ----- - platformChangedFrom: lastPlatform to: currentPlatform - "Byte size or byte alignment for atomic types might be different on the new platform." - - "Make sure that the cache of all instances is up-to-date before using it..." - Instances ifNil: [self new]. - - "Get all instances to update their compiledSpecs so that FFI calls work." - self updateArgTypeSpecs!
Item was removed: - ----- Method: ExternalLibraryFunction class>>updateArgTypeSpecs (in category 'instance initialization') ----- - updateArgTypeSpecs - self instances do: [:elf| elf updateArgTypeSpecs]!
Item was removed: - ----- Method: ExternalLibraryFunction>>updateArgTypeSpecs (in category 'instance initialization') ----- - updateArgTypeSpecs - argTypes ifNotNil: - [:typeArray| typeArray do: [:argType| argType updateFromReferentClass]]!
Item was changed: ----- Method: ExternalType class>>platformChangedFrom:to: (in category 'system startup') ----- platformChangedFrom: lastPlatform to: currentPlatform "Byte size or byte alignment for atomic types might be different on the new platform." lastPlatform pluginVersion ~= currentPlatform pluginVersion ifTrue: ["Type codes might have changed. Re-init thoroughly. Preserve type identity." self initialize "Slower but necessary for new type codes"] + ifFalse: ["Byte alignment of double and int64_t might have changed. Re-init quickly. Preserve type identity. Also updates all struct types and thus all library function calls." + self flag: #performance. "mt: Maybe cache ExternalAtomicType atomicTypeSpecs and compare it to actually detect changes? Well, #initializeFast is even faster if nothing changed for the atomic types, so..." + self initializeFast]. - ifFalse: ["Byte alignment of double and int64_t might have changed. Re-init quickly. Preserve type identity." - currentPlatform wordSize = 4 ifTrue: [self initializeFast]]. self flag: #todo. "mt: Update all critical aliases for atomic types, i.e., intptr_t, uintptr_t. But what about 'c_long' between 64-bit platforms?!!" "lastPlatform wordSize ~= currentPlatform wordSize ifTrue: [self recompileAllLibraryFunctions]."!
Item was removed: - ----- Method: ExternalType>>updateFromReferentClass (in category 'instance initialization') ----- - updateFromReferentClass - "If I have a referentClass update my compiledSpec to reflect the new state of the system, e.g. after a platform change." - - referentClass ifNotNil: [:refClass| self newReferentClass: refClass]!
Item was changed: ----- Method: FFIPlatformDescription class>>startUp: (in category 'system startup') ----- startUp: resuming "Notify all FFI classes about platform changes."
resuming ifTrue: [ LastPlatform in: [:lastPlatform | self newCurrent in: [:currentPlatform | lastPlatform = currentPlatform ifTrue: [ self flag: #discuss. "mt: Maybe add #platformResuming?" ExternalAddress allBeNull ] ifFalse: [ LastPlatform := currentPlatform. "Update now. See #current." + { ExternalAddress. ExternalType. ExternalPool. ExternalLibrary } - { ExternalAddress. ExternalType. ExternalPool. ExternalLibrary. ExternalLibraryFunction } do: [:cls | cls platformChangedFrom: lastPlatform to: currentPlatform] ]]]. + self checkFFIOnStartUp ifTrue: [self checkFFI]].! - self checkFFIOnStartUp ifTrue: [self checkFFI]]!
packages@lists.squeakfoundation.org