FFI: FFI-Pools-mt.16.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFI: FFI-Pools-mt.16.mcz

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

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

Name: FFI-Pools-mt.16
Author: mt
Time: 28 May 2020, 9:20:47.243479 am
UUID: ff3070e5-d241-6346-95a1-3b809f56a4bd
Ancestors: FFI-Pools-mt.15

Moves interpretation of <ffiExternalSharedPool> pragma to the definition class where all other pragmas are interpreted and documented already.

Adds simple way to explore pool definitions by calling the method that holds the definition pragmas:

MyExternalPool class >> #win32ExamplePool
  <ffiExternalSharedPool>
  <ffiPlatformName: 'Win32'>
  ^ self poolDefinition

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

Item was changed:
  ----- Method: FFIExternalSharedPool class>>definitions (in category 'accessing') -----
  definitions
- | definitions |
 
+ | definitions |
  definitions := OrderedCollection with: self defaultDefinition.
 
  self class methodsDo: [:each |
+ (self definitionClass fromMethod: each) ifNotNil: [:poolDefinition |
+ definitions add: poolDefinition]].
- (each pragmaAt: #ffiExternalSharedPool)
- ifNotNil: [
- definitions addLast:
- (self definitionClass fromMethod: each)]].
 
+ ^ definitions!
- ^ definitions asArray.!

Item was added:
+ ----- Method: FFIExternalSharedPool class>>poolDefinition (in category 'accessing') -----
+ poolDefinition
+ "For convenience. Answer the result of this call in definition methods to support debugging."
+
+ thisContext sender method ifNotNil: [:poolDefinitionMethod |
+ (self definitionClass fromMethod: poolDefinitionMethod)
+ ifNotNil: [:poolDefinition | ^ poolDefinition]].
+
+ self error: 'Sender is no valid pool definition!!'.!

Item was changed:
  ----- Method: FFIExternalSharedPoolDefinition class>>fromMethod: (in category 'instance creation') -----
  fromMethod: aCompiledMethod
  | definition |
 
+ (aCompiledMethod pragmaAt: #ffiExternalSharedPool)
+ ifNil: [^ nil].
+
  definition := self name: aCompiledMethod selector.
 
  "Squeak does not have #pragmasDo:"
  aCompiledMethod pragmas do: [:each |
  (self whichCategoryIncludesSelector: each keyword) == #'pragmas'
  ifTrue: [
  definition
  perform: each keyword
  withArguments: each arguments]].
 
  ^ definition.!