[squeak-dev] FFI: FFI-Pools-mt.36.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Aug 19 08:30:25 UTC 2021
Marcel Taeumel uploaded a new version of FFI-Pools to project FFI:
http://source.squeak.org/FFI/FFI-Pools-mt.36.mcz
==================== Summary ====================
Name: FFI-Pools-mt.36
Author: mt
Time: 19 August 2021, 10:30:24.310627 am
UUID: edf5129c-7376-4d4b-a1c3-b882b1bbcd71
Ancestors: FFI-Pools-mt.35
Prepare ExternalTypePool to also hold genuine atomic types.
=============== Diff against FFI-Pools-mt.35 ===============
Item was changed:
----- Method: ExternalTypePool class>>assuredPoolVarNameFor: (in category 'housekeeping') -----
assuredPoolVarNameFor: type
| poolVarName |
poolVarName := (self poolVarNameFor: type) asSymbol.
(self classPool includesKey: poolVarName)
+ ifFalse: [SystemChangeNotifier uniqueInstance doSilently: [
+ self addClassVarName: poolVarName]].
- ifFalse: [self addClassVarName: poolVarName].
self classPool at: poolVarName put: type.
^ poolVarName!
Item was added:
+ ----- Method: ExternalTypePool class>>atomicTypePrefix (in category 'constants') -----
+ atomicTypePrefix
+
+ ^ 'AtomicType_'!
Item was changed:
----- Method: ExternalTypePool class>>cleanUp (in category 'housekeeping') -----
cleanUp
"
self cleanUp.
"
+ | prefix |
+ prefix := self structTypePrefix.
self classPool keys do: [:classVarName |
+ (classVarName beginsWith: prefix) ifTrue: [
- (classVarName beginsWith: 'ExternalType_') ifTrue: [
(self classPool at: classVarName)
ifNil: [self classPool removeKey: classVarName]]].!
Item was added:
+ ----- Method: ExternalTypePool class>>nukeAll (in category 'housekeeping') -----
+ nukeAll
+ "
+ self nukeAll.
+ "
+ self classPool keys do: [:classVarName |
+ self classPool removeKey: classVarName].!
Item was changed:
----- Method: ExternalTypePool class>>poolVarNameFor: (in category 'housekeeping') -----
poolVarNameFor: type
"Answers the name to be used in the shared pool to speed up type look-up for field access in ExternalStructure."
^ String streamContents: [:stream |
| nameStream |
+ stream nextPutAll: ((type isAtomic and: [type isTypeAlias not])
+ ifTrue: [self atomicTypePrefix]
+ ifFalse: [self structTypePrefix]).
- stream nextPutAll: 'ExternalType_'.
nameStream := type typeName readStream.
[nameStream atEnd] whileFalse: [
| char |
(char := nameStream next) caseOf: {
[ $( ] -> [ "Ignore." ].
[ $) ] -> [ "Ignore." ].
[ $* ] -> [ stream nextPutAll: '_star' ].
[ $[ ] -> [ stream nextPut: $_ ].
[ $] ] -> [ stream nextPut: $_ ]
} otherwise: [ stream nextPut: char ]]]!
Item was changed:
----- Method: ExternalTypePool class>>reset (in category 'housekeeping') -----
reset
"
self reset
"
+ | prefix |
+ prefix := self structTypePrefix.
self classPool keys do: [:classVarName |
+ (classVarName beginsWith: prefix) ifTrue: [
- (classVarName beginsWith: 'ExternalType_') ifTrue: [
(self classPool at: classVarName put: nil)]].!
Item was added:
+ ----- Method: ExternalTypePool class>>structTypePrefix (in category 'constants') -----
+ structTypePrefix
+
+ ^ 'ExternalType_'!
Item was added:
+ ----- Method: ExternalTypePool class>>update (in category 'housekeeping') -----
+ update
+ "
+ self update
+ "
+ self reset.
+ ExternalType atomicTypesDo: [:type | type generateTypeAccessor].
+ ExternalStructure defineAllFields. "Relies on #noteModificationOf: to call #generateTypeAccessor on non-atomic types."
+ self cleanUp.!
More information about the Squeak-dev
mailing list
|