This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
TFFIBackend.class.st
109 lines (81 loc) · 2.4 KB
/
TFFIBackend.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Class {
#name : #TFFIBackend,
#superclass : #FFIBackend,
#type : #bytes,
#category : #'ThreadedFFI-Base'
}
{ #category : #detecting }
TFFIBackend class >> isAvailable [
^ self new isAvailable
]
{ #category : #accessing }
TFFIBackend class >> priority [
^ 10
]
{ #category : #'instance creation' }
TFFIBackend >> allocate: byteSize [
"Primitive. Allocate an object on the external heap."
<primitive: 'primitiveFFIAllocate'>
^ self primitiveFailed
]
{ #category : #'instance creation' }
TFFIBackend >> calloutAPIClass [
^ TFCalloutAPI
]
{ #category : #'instance creation' }
TFFIBackend >> free: anExternalAddress [
<primitive:'primitiveFFIFree'>
^self primitiveFailed
]
{ #category : #accessing }
TFFIBackend >> integerOfObject: anObject at: byteOffset put: value size: nBytes signed: aBoolean [
"Primitive. Store the given value as integer of nBytes size
in the receiver. Fail if the value is out of range.
Note: This primitive will access memory in the outer space if
invoked from ExternalAddress."
<primitive: 'primitiveFFIIntegerAtPut'>
^self primitiveFailed
]
{ #category : #accessing }
TFFIBackend >> integerOfObject: anObject at: byteOffset size: nBytes signed: aBoolean [
"Primitive. Return an integer of nBytes size from the receiver.
Note: This primitive will access memory in the outer space if
invoked from ExternalAddress."
<primitive: 'primitiveFFIIntegerAt'>
^self primitiveFailed
]
{ #category : #testing }
TFFIBackend >> isAvailable [
^ [ self loadSymbol: #primitiveLoadSymbolFromModule module: nil. true ] onErrorDo: [ false ]
]
{ #category : #'instance creation' }
TFFIBackend >> loadSymbol: moduleSymbol module: module [
<primitive: 'primitiveLoadSymbolFromModule'>
^ self primitiveFailed
]
{ #category : #accessing }
TFFIBackend >> on: anObject float32At: offset [
^ self primitiveFailed
]
{ #category : #accessing }
TFFIBackend >> on: anObject float32At: offset put: value [
self isReadOnlyObject ifTrue: [
^ self
modificationForbiddenFor: #on:float32At:put:
index: offset
value: value ].
^ self primitiveFailed
]
{ #category : #accessing }
TFFIBackend >> on: anObject float64At: offset [
^ self primitiveFailed
]
{ #category : #accessing }
TFFIBackend >> on: anObject float64At: offset put: value [
self isReadOnlyObject ifTrue: [
^ self
modificationForbiddenFor: #on:float64At:put:
index: offset
value: value ].
^ self primitiveFailed
]