6
6
# GNU General Public License version 2, or
7
7
# GNU Lesser General Public License version 2.1.
8
8
9
- module Truffle ::Fiddle
9
+ module Truffle ::FiddleBackend
10
10
11
11
SIZEOF_INT = Truffle ::FFI ::Pointer . find_type_size ( :int )
12
12
SIZEOF_LONG = Truffle ::FFI ::Pointer . find_type_size ( :long )
@@ -114,8 +114,8 @@ class DLError < StandardError
114
114
SIZEOF_VOIDP = Truffle ::FFI ::Pointer . find_type_size ( :pointer )
115
115
SIZEOF_CHAR = Truffle ::FFI ::Pointer . find_type_size ( :char )
116
116
SIZEOF_SHORT = Truffle ::FFI ::Pointer . find_type_size ( :short )
117
- SIZEOF_INT = Truffle ::Fiddle ::SIZEOF_INT
118
- SIZEOF_LONG = Truffle ::Fiddle ::SIZEOF_LONG
117
+ SIZEOF_INT = Truffle ::FiddleBackend ::SIZEOF_INT
118
+ SIZEOF_LONG = Truffle ::FiddleBackend ::SIZEOF_LONG
119
119
SIZEOF_LONG_LONG = Truffle ::FFI ::Pointer . find_type_size ( :long_long )
120
120
SIZEOF_FLOAT = Truffle ::FFI ::Pointer . find_type_size ( :float )
121
121
SIZEOF_DOUBLE = Truffle ::FFI ::Pointer . find_type_size ( :double )
@@ -126,10 +126,10 @@ class DLError < StandardError
126
126
SIZEOF_INTPTR_T = Truffle ::FFI ::Pointer . find_type_size ( :intptr_t )
127
127
SIZEOF_UINTPTR_T = Truffle ::FFI ::Pointer . find_type_size ( :uintptr_t )
128
128
129
- TYPE_SSIZE_T = Truffle ::Fiddle . int_type ( SIZEOF_SIZE_T )
130
- TYPE_SIZE_T = -1 * Truffle ::Fiddle ::SIGNEDNESS_OF_SIZE_T * TYPE_SSIZE_T
131
- TYPE_PTRDIFF_T = Truffle ::Fiddle . int_type ( SIZEOF_PTRDIFF_T )
132
- TYPE_INTPTR_T = Truffle ::Fiddle . int_type ( SIZEOF_INTPTR_T )
129
+ TYPE_SSIZE_T = Truffle ::FiddleBackend . int_type ( SIZEOF_SIZE_T )
130
+ TYPE_SIZE_T = -1 * Truffle ::FiddleBackend ::SIGNEDNESS_OF_SIZE_T * TYPE_SSIZE_T
131
+ TYPE_PTRDIFF_T = Truffle ::FiddleBackend . int_type ( SIZEOF_PTRDIFF_T )
132
+ TYPE_INTPTR_T = Truffle ::FiddleBackend . int_type ( SIZEOF_INTPTR_T )
133
133
TYPE_UINTPTR_T = -TYPE_INTPTR_T
134
134
135
135
# Alignment assumed to be the same as size
@@ -178,8 +178,8 @@ class Function
178
178
def initialize ( ptr , args , ret_type , abi = DEFAULT , name : nil )
179
179
@arg_types = args
180
180
@ret_type = ret_type
181
- args = args . map { |arg | Truffle ::Fiddle . type_to_nfi ( arg ) }
182
- ret_type = Truffle ::Fiddle . type_to_nfi ( ret_type )
181
+ args = args . map { |arg | Truffle ::FiddleBackend . type_to_nfi ( arg ) }
182
+ ret_type = Truffle ::FiddleBackend . type_to_nfi ( ret_type )
183
183
signature = "(#{ args . join ( ',' ) } ):#{ ret_type } "
184
184
185
185
if ptr . is_a? ( Closure )
@@ -191,9 +191,9 @@ def initialize(ptr, args, ret_type, abi = DEFAULT, name: nil)
191
191
end
192
192
193
193
def call ( *args )
194
- args = ( args . zip ( @arg_types ) ) . map { |arg , type | Truffle ::Fiddle . convert_ruby_to_native ( type , arg ) }
194
+ args = args . zip ( @arg_types ) . map { |arg , type | Truffle ::FiddleBackend . convert_ruby_to_native ( type , arg ) }
195
195
ret = @function . call ( *args )
196
- Truffle ::Fiddle . convert_native_to_ruby ( @ret_type , ret )
196
+ Truffle ::FiddleBackend . convert_native_to_ruby ( @ret_type , ret )
197
197
end
198
198
199
199
end
0 commit comments