@@ -128,7 +128,7 @@ def self.attach_function_eagerly(native_name, argument_types, return_type,
128
128
parsed_sig = Primitive . interop_eval_nfi "(#{ nfi_args_types . join ( ',' ) } ):#{ nfi_return_type } "
129
129
bound_func = parsed_sig . bind ( func )
130
130
131
- on . define_singleton_method method_name , -> *args do
131
+ method_body = Truffle :: Graal . copy_captured_locals -> *args do
132
132
string_args . each do |i |
133
133
str = args . fetch ( i )
134
134
# TODO CS 14-Nov-17 this involves copying to a Java byte[], and then NFI will copy it again!
@@ -140,7 +140,7 @@ def self.attach_function_eagerly(native_name, argument_types, return_type,
140
140
result = Primitive . thread_run_blocking_nfi_system_call ( bound_func , args )
141
141
end while Primitive . is_a? ( result , Integer ) and result == -1 and Errno . errno == EINTR
142
142
else
143
- result = bound_func . call ( * args )
143
+ result = Primitive . interop_execute ( bound_func , args )
144
144
end
145
145
146
146
if return_type == :string
@@ -164,6 +164,7 @@ def self.attach_function_eagerly(native_name, argument_types, return_type,
164
164
165
165
result
166
166
end
167
+ on . define_singleton_method method_name , method_body
167
168
else
168
169
on . define_singleton_method method_name , -> * do
169
170
raise NotImplementedError , "#{ native_name } is not available"
0 commit comments