Skip to content

Commit 45075e9

Browse files
committed
Adapt the FFI backend code for FFI 1.11.1
1 parent 80380df commit 45075e9

File tree

3 files changed

+0
-101
lines changed

3 files changed

+0
-101
lines changed

lib/truffle/ffi.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def self.find_type_size(type)
2222
end
2323

2424
module Platform
25-
CPU = RbConfig::CONFIG['host_cpu']
2625
# eregon: I would like to use rbconfig/sizeof here, but the linker requires
2726
# ffi, and the linker is needed to build the rbconfig/sizeof C extension,
2827
# so we need to break the cycle.
@@ -35,7 +34,6 @@ module Platform
3534

3635
# Require the pure-Ruby Truffle NFI backend
3736
require_relative 'truffle/ffi_backend/last_error'
38-
require_relative 'truffle/ffi_backend/data_converter'
3937
require_relative 'truffle/ffi_backend/type'
4038
require_relative 'truffle/ffi_backend/struct_layout'
4139
require_relative 'truffle/ffi_backend/struct'

lib/truffle/truffle/ffi_backend/data_converter.rb

Lines changed: 0 additions & 68 deletions
This file was deleted.

lib/truffle/truffle/ffi_backend/struct.rb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -200,35 +200,4 @@ def to_s
200200
alias_method :to_str, :to_s
201201
end
202202
end
203-
204-
class StructByReference
205-
include DataConverter
206-
207-
attr_reader :struct_class
208-
209-
def initialize(struct_class)
210-
unless Class === struct_class and struct_class < FFI::Struct
211-
raise TypeError, 'wrong type (expected subclass of FFI::Struct)'
212-
end
213-
@struct_class = struct_class
214-
end
215-
216-
def native_type
217-
FFI::Type::POINTER
218-
end
219-
220-
def to_native(value, ctx)
221-
return Pointer::NULL if value.nil?
222-
223-
unless @struct_class === value
224-
raise TypeError, "wrong argument type #{value.class} (expected #{@struct_class})"
225-
end
226-
227-
value.pointer
228-
end
229-
230-
def from_native(value, ctx)
231-
@struct_class.new(value)
232-
end
233-
end
234203
end

0 commit comments

Comments
 (0)