ffi 1.16.2 → 1.17.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +36 -0
- data/Gemfile +9 -2
- data/README.md +2 -2
- data/Rakefile +17 -5
- data/ext/ffi_c/AbstractMemory.c +42 -40
- data/ext/ffi_c/ArrayType.c +2 -2
- data/ext/ffi_c/Buffer.c +4 -4
- data/ext/ffi_c/Call.c +18 -9
- data/ext/ffi_c/Call.h +3 -2
- data/ext/ffi_c/DynamicLibrary.c +2 -2
- data/ext/ffi_c/Function.c +4 -2
- data/ext/ffi_c/FunctionInfo.c +4 -2
- data/ext/ffi_c/LastError.c +4 -4
- data/ext/ffi_c/MemoryPointer.c +2 -2
- data/ext/ffi_c/Pointer.c +14 -11
- data/ext/ffi_c/Struct.c +18 -7
- data/ext/ffi_c/StructLayout.c +6 -6
- data/ext/ffi_c/Type.c +17 -16
- data/ext/ffi_c/Types.c +7 -1
- data/ext/ffi_c/Types.h +0 -1
- data/ext/ffi_c/Variadic.c +5 -2
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +34 -15
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +2 -1
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/README.md +10 -5
- data/ext/ffi_c/libffi/compile +9 -8
- data/ext/ffi_c/libffi/configure +15 -15
- data/ext/ffi_c/libffi/configure.ac +2 -2
- data/ext/ffi_c/libffi/configure.host +1 -1
- data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/include/ffi.h.in +2 -11
- data/ext/ffi_c/libffi/include/ffi_common.h +4 -2
- data/ext/ffi_c/libffi/libffi.map.in +5 -0
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/ltmain.sh +8 -20
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +26 -13
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +198 -46
- data/ext/ffi_c/libffi/src/closures.c +3 -3
- data/ext/ffi_c/libffi/src/debug.c +2 -2
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +3 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +12 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +65 -14
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +7 -1
- data/ext/ffi_c/libffi/src/tramp.c +1 -1
- data/ext/ffi_c/libffi/src/types.c +4 -6
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +13 -0
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +1 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -127
- data/ext/ffi_c/libffi/testsuite/Makefile.in +79 -127
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +6 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi.darwin.mk +2 -2
- data/lib/ffi/dynamic_library.rb +34 -5
- data/lib/ffi/enum.rb +0 -1
- data/lib/ffi/function.rb +1 -1
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +23 -23
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +4 -4
- data/lib/ffi/struct_layout.rb +2 -2
- data/lib/ffi/struct_layout_builder.rb +8 -8
- data/lib/ffi/types.rb +51 -48
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +164 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +39 -15
- metadata.gz.sig +0 -0
data/ext/ffi_c/LastError.c
CHANGED
@@ -141,7 +141,7 @@ thread_data_get(void)
|
|
141
141
|
|
142
142
|
/*
|
143
143
|
* call-seq: error
|
144
|
-
* @return [
|
144
|
+
* @return [Integer]
|
145
145
|
* Get +errno+ value.
|
146
146
|
*/
|
147
147
|
static VALUE
|
@@ -153,7 +153,7 @@ get_last_error(VALUE self)
|
|
153
153
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
154
154
|
/*
|
155
155
|
* call-seq: winapi_error
|
156
|
-
* @return [
|
156
|
+
* @return [Integer]
|
157
157
|
* Get +GetLastError()+ value. Only Windows or Cygwin.
|
158
158
|
*/
|
159
159
|
static VALUE
|
@@ -166,7 +166,7 @@ get_last_winapi_error(VALUE self)
|
|
166
166
|
|
167
167
|
/*
|
168
168
|
* call-seq: error(error)
|
169
|
-
* @param [
|
169
|
+
* @param [Integer] error
|
170
170
|
* @return [nil]
|
171
171
|
* Set +errno+ value.
|
172
172
|
*/
|
@@ -185,7 +185,7 @@ set_last_error(VALUE self, VALUE error)
|
|
185
185
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
186
186
|
/*
|
187
187
|
* call-seq: error(error)
|
188
|
-
* @param [
|
188
|
+
* @param [Integer] error
|
189
189
|
* @return [nil]
|
190
190
|
* Set +GetLastError()+ value. Only on Windows and Cygwin.
|
191
191
|
*/
|
data/ext/ffi_c/MemoryPointer.c
CHANGED
@@ -80,8 +80,8 @@ memptr_allocate(VALUE klass)
|
|
80
80
|
|
81
81
|
/*
|
82
82
|
* call-seq: initialize(size, count=1, clear=true)
|
83
|
-
* @param [
|
84
|
-
* @param [
|
83
|
+
* @param [Integer, Symbol, FFI::Type] size size of a memory cell (in bytes, or type whom size will be used)
|
84
|
+
* @param [Integer] count number of cells in memory
|
85
85
|
* @param [Boolean] clear set memory to all-zero if +true+
|
86
86
|
* @return [self]
|
87
87
|
* A new instance of FFI::MemoryPointer.
|
data/ext/ffi_c/Pointer.c
CHANGED
@@ -95,12 +95,10 @@ ptr_allocate(VALUE klass)
|
|
95
95
|
}
|
96
96
|
|
97
97
|
/*
|
98
|
-
* @overload initialize(
|
99
|
-
* @param [Pointer] pointer another pointer to initialize from
|
100
|
-
* Create a new pointer from another {Pointer}.
|
98
|
+
* @overload initialize(address)
|
101
99
|
* @overload initialize(type, address)
|
102
|
-
* @param [Type] type type for pointer
|
103
|
-
* @param [Integer] address base address for pointer
|
100
|
+
* @param [Type] type Optional type for pointer (defaults to byte)
|
101
|
+
* @param [Pointer, Integer] address base address for pointer
|
104
102
|
* Create a new pointer from a {Type} and a base address
|
105
103
|
* @return [self]
|
106
104
|
* A new instance of Pointer.
|
@@ -229,7 +227,7 @@ slice(VALUE self, long offset, long size)
|
|
229
227
|
/*
|
230
228
|
* Document-method: +
|
231
229
|
* call-seq: ptr + offset
|
232
|
-
* @param [
|
230
|
+
* @param [Integer] offset
|
233
231
|
* @return [Pointer]
|
234
232
|
* Return a new {Pointer} from an existing pointer and an +offset+.
|
235
233
|
*/
|
@@ -246,8 +244,8 @@ ptr_plus(VALUE self, VALUE offset)
|
|
246
244
|
|
247
245
|
/*
|
248
246
|
* call-seq: ptr.slice(offset, length)
|
249
|
-
* @param [
|
250
|
-
* @param [
|
247
|
+
* @param [Integer] offset
|
248
|
+
* @param [Integer] length
|
251
249
|
* @return [Pointer]
|
252
250
|
* Return a new {Pointer} from an existing one. This pointer points on same contents
|
253
251
|
* from +offset+ for a length +length+.
|
@@ -314,12 +312,17 @@ ptr_equals(VALUE self, VALUE other)
|
|
314
312
|
return ptr->memory.address == NULL ? Qtrue : Qfalse;
|
315
313
|
}
|
316
314
|
|
317
|
-
|
315
|
+
if (!rb_obj_is_kind_of(other, rbffi_PointerClass)) {
|
316
|
+
return Qfalse;
|
317
|
+
}
|
318
|
+
else {
|
319
|
+
return ptr->memory.address == POINTER(other)->address ? Qtrue : Qfalse;
|
320
|
+
}
|
318
321
|
}
|
319
322
|
|
320
323
|
/*
|
321
324
|
* call-seq: ptr.address
|
322
|
-
* @return [
|
325
|
+
* @return [Integer] pointer's base address
|
323
326
|
* Return +self+'s base address (alias: #to_i).
|
324
327
|
*/
|
325
328
|
static VALUE
|
@@ -440,7 +443,7 @@ ptr_autorelease(VALUE self, VALUE autorelease)
|
|
440
443
|
|
441
444
|
rb_check_frozen(self);
|
442
445
|
TypedData_Get_Struct(self, Pointer, &rbffi_pointer_data_type, ptr);
|
443
|
-
ptr->autorelease = autorelease
|
446
|
+
ptr->autorelease = RB_TEST(autorelease);
|
444
447
|
|
445
448
|
return autorelease;
|
446
449
|
}
|
data/ext/ffi_c/Struct.c
CHANGED
@@ -91,6 +91,7 @@ VALUE rbffi_StructLayoutCharArrayClass = Qnil;
|
|
91
91
|
|
92
92
|
static ID id_pointer_ivar = 0, id_layout_ivar = 0;
|
93
93
|
static ID id_get = 0, id_put = 0, id_to_ptr = 0, id_to_s = 0, id_layout = 0;
|
94
|
+
static ID id_initialize = 0;
|
94
95
|
|
95
96
|
static inline char*
|
96
97
|
memory_address(VALUE self)
|
@@ -114,6 +115,7 @@ struct_allocate(VALUE klass)
|
|
114
115
|
|
115
116
|
/*
|
116
117
|
* call-seq: initialize
|
118
|
+
* @overload initialize
|
117
119
|
* @overload initialize(pointer, *args)
|
118
120
|
* @param [AbstractMemory] pointer
|
119
121
|
* @param [Array] args
|
@@ -189,9 +191,11 @@ struct_initialize_copy(VALUE self, VALUE other)
|
|
189
191
|
}
|
190
192
|
|
191
193
|
if (src->layout->referenceFieldCount > 0) {
|
194
|
+
size_t index;
|
195
|
+
|
192
196
|
dst->rbReferences = ALLOC_N(VALUE, dst->layout->referenceFieldCount);
|
193
197
|
memcpy(dst->rbReferences, src->rbReferences, dst->layout->referenceFieldCount * sizeof(VALUE));
|
194
|
-
for (
|
198
|
+
for ( index = 0; index < dst->layout->referenceFieldCount; index++) {
|
195
199
|
RB_OBJ_WRITTEN(self, Qundef, &dst->rbReferences[index]);
|
196
200
|
}
|
197
201
|
}
|
@@ -268,7 +272,8 @@ struct_mark(void *data)
|
|
268
272
|
rb_gc_mark_movable(s->rbPointer);
|
269
273
|
rb_gc_mark_movable(s->rbLayout);
|
270
274
|
if (s->rbReferences != NULL) {
|
271
|
-
|
275
|
+
size_t index;
|
276
|
+
for (index = 0; index < s->layout->referenceFieldCount; index++) {
|
272
277
|
rb_gc_mark_movable(s->rbReferences[index]);
|
273
278
|
}
|
274
279
|
}
|
@@ -281,7 +286,8 @@ struct_compact(void *data)
|
|
281
286
|
ffi_gc_location(s->rbPointer);
|
282
287
|
ffi_gc_location(s->rbLayout);
|
283
288
|
if (s->rbReferences != NULL) {
|
284
|
-
|
289
|
+
size_t index;
|
290
|
+
for (index = 0; index < s->layout->referenceFieldCount; index++) {
|
285
291
|
ffi_gc_location(s->rbReferences[index]);
|
286
292
|
}
|
287
293
|
}
|
@@ -612,7 +618,7 @@ inline_array_initialize(VALUE self, VALUE rbMemory, VALUE rbField)
|
|
612
618
|
|
613
619
|
/*
|
614
620
|
* call-seq: size
|
615
|
-
* @return [
|
621
|
+
* @return [Integer]
|
616
622
|
* Get size
|
617
623
|
*/
|
618
624
|
static VALUE
|
@@ -637,7 +643,7 @@ inline_array_offset(InlineArray* array, int index)
|
|
637
643
|
|
638
644
|
/*
|
639
645
|
* call-seq: [](index)
|
640
|
-
* @param [
|
646
|
+
* @param [Integer] index
|
641
647
|
* @return [Type, Struct]
|
642
648
|
*/
|
643
649
|
static VALUE
|
@@ -661,8 +667,12 @@ inline_array_aref(VALUE self, VALUE rbIndex)
|
|
661
667
|
VALUE rbOffset = INT2NUM(inline_array_offset(array, NUM2INT(rbIndex)));
|
662
668
|
VALUE rbLength = INT2NUM(array->componentType->ffiType->size);
|
663
669
|
VALUE rbPointer = rb_funcall(array->rbMemory, rb_intern("slice"), 2, rbOffset, rbLength);
|
670
|
+
VALUE obj;
|
664
671
|
|
665
|
-
|
672
|
+
/* We avoid rb_class_new_instance here, to avoid passing the method block */
|
673
|
+
obj = rb_obj_alloc(((StructByValue *) array->componentType)->rbStructClass);
|
674
|
+
rb_funcallv(obj, id_initialize, 1, &rbPointer);
|
675
|
+
return obj;
|
666
676
|
} else {
|
667
677
|
|
668
678
|
rb_raise(rb_eArgError, "get not supported for %s", rb_obj_classname(array->arrayType->rbComponentType));
|
@@ -672,7 +682,7 @@ inline_array_aref(VALUE self, VALUE rbIndex)
|
|
672
682
|
|
673
683
|
/*
|
674
684
|
* call-seq: []=(index, value)
|
675
|
-
* @param [
|
685
|
+
* @param [Integer] index
|
676
686
|
* @param [Type, Struct]
|
677
687
|
* @return [value]
|
678
688
|
*/
|
@@ -889,5 +899,6 @@ rbffi_Struct_Init(VALUE moduleFFI)
|
|
889
899
|
id_put = rb_intern("put");
|
890
900
|
id_to_ptr = rb_intern("to_ptr");
|
891
901
|
id_to_s = rb_intern("to_s");
|
902
|
+
id_initialize = rb_intern("initialize");
|
892
903
|
}
|
893
904
|
|
data/ext/ffi_c/StructLayout.c
CHANGED
@@ -132,7 +132,7 @@ struct_field_memsize(const void *data)
|
|
132
132
|
/*
|
133
133
|
* call-seq: initialize(name, offset, type)
|
134
134
|
* @param [String,Symbol] name
|
135
|
-
* @param [
|
135
|
+
* @param [Integer] offset
|
136
136
|
* @param [FFI::Type] type
|
137
137
|
* @return [self]
|
138
138
|
* A new FFI::StructLayout::Field instance.
|
@@ -188,7 +188,7 @@ struct_field_initialize(int argc, VALUE* argv, VALUE self)
|
|
188
188
|
|
189
189
|
/*
|
190
190
|
* call-seq: offset
|
191
|
-
* @return [
|
191
|
+
* @return [Integer]
|
192
192
|
* Get the field offset.
|
193
193
|
*/
|
194
194
|
static VALUE
|
@@ -201,7 +201,7 @@ struct_field_offset(VALUE self)
|
|
201
201
|
|
202
202
|
/*
|
203
203
|
* call-seq: size
|
204
|
-
* @return [
|
204
|
+
* @return [Integer]
|
205
205
|
* Get the field size.
|
206
206
|
*/
|
207
207
|
static VALUE
|
@@ -214,7 +214,7 @@ struct_field_size(VALUE self)
|
|
214
214
|
|
215
215
|
/*
|
216
216
|
* call-seq: alignment
|
217
|
-
* @return [
|
217
|
+
* @return [Integer]
|
218
218
|
* Get the field alignment.
|
219
219
|
*/
|
220
220
|
static VALUE
|
@@ -474,8 +474,8 @@ struct_layout_allocate(VALUE klass)
|
|
474
474
|
/*
|
475
475
|
* call-seq: initialize(fields, size, align)
|
476
476
|
* @param [Array<StructLayout::Field>] fields
|
477
|
-
* @param [
|
478
|
-
* @param [
|
477
|
+
* @param [Integer] size
|
478
|
+
* @param [Integer] align
|
479
479
|
* @return [self]
|
480
480
|
* A new StructLayout instance.
|
481
481
|
*/
|
data/ext/ffi_c/Type.c
CHANGED
@@ -107,7 +107,7 @@ type_allocate(VALUE klass)
|
|
107
107
|
/*
|
108
108
|
* Document-method: initialize
|
109
109
|
* call-seq: initialize(value)
|
110
|
-
* @param [
|
110
|
+
* @param [Integer,Type] value
|
111
111
|
* @return [self]
|
112
112
|
*/
|
113
113
|
static VALUE
|
@@ -135,7 +135,7 @@ type_initialize(VALUE self, VALUE value)
|
|
135
135
|
|
136
136
|
/*
|
137
137
|
* call-seq: type.size
|
138
|
-
* @return [
|
138
|
+
* @return [Integer]
|
139
139
|
* Return type's size, in bytes.
|
140
140
|
*/
|
141
141
|
static VALUE
|
@@ -150,7 +150,7 @@ type_size(VALUE self)
|
|
150
150
|
|
151
151
|
/*
|
152
152
|
* call-seq: type.alignment
|
153
|
-
* @return [
|
153
|
+
* @return [Integer]
|
154
154
|
* Get Type alignment.
|
155
155
|
*/
|
156
156
|
static VALUE
|
@@ -333,10 +333,10 @@ rbffi_Type_Init(VALUE moduleFFI)
|
|
333
333
|
classBuiltinType = rb_define_class_under(rbffi_TypeClass, "Builtin", rbffi_TypeClass);
|
334
334
|
/*
|
335
335
|
* Document-module: FFI::NativeType
|
336
|
-
* This module defines constants for native
|
336
|
+
* This module defines constants for C native types.
|
337
337
|
*
|
338
338
|
* ==Native type constants
|
339
|
-
* Native types are defined by constants :
|
339
|
+
* Native types are defined by constants and aliases:
|
340
340
|
* * INT8, SCHAR, CHAR
|
341
341
|
* * UINT8, UCHAR
|
342
342
|
* * INT16, SHORT, SSHORT
|
@@ -349,24 +349,25 @@ rbffi_Type_Init(VALUE moduleFFI)
|
|
349
349
|
* * ULONG
|
350
350
|
* * FLOAT32, FLOAT
|
351
351
|
* * FLOAT64, DOUBLE
|
352
|
+
* * LONGDOUBLE (if the native platform has `long double`)
|
352
353
|
* * POINTER
|
353
|
-
* * CALLBACK
|
354
|
-
* * FUNCTION
|
355
|
-
* * CHAR_ARRAY
|
356
354
|
* * BOOL
|
357
|
-
* * STRING (immutable string,
|
358
|
-
*
|
359
|
-
* * ARRAY (array type definition)
|
360
|
-
* * MAPPED (custom native type)
|
361
|
-
* For function return type only :
|
355
|
+
* * STRING (immutable string, null terminated)
|
356
|
+
* For function return type only:
|
362
357
|
* * VOID
|
363
|
-
* For function argument type only
|
358
|
+
* For function argument type only:
|
364
359
|
* * BUFFER_IN
|
365
360
|
* * BUFFER_OUT
|
361
|
+
* * BUFFER_INOUT
|
366
362
|
* * VARARGS (function takes a variable number of arguments)
|
367
363
|
*
|
368
|
-
*
|
369
|
-
*
|
364
|
+
* They are objects of the class {FFI::Type::Builtin}.
|
365
|
+
*
|
366
|
+
* Non-alias (the first name in each bullet point) constants are also exported to modules +FFI::NativeType+ and (prefixed with +TYPE_+) {FFI}.
|
367
|
+
* All constants and aliases above are exported to the {FFI::Type} class, as well as the following aliases:
|
368
|
+
* * Array ({FFI::ArrayType})
|
369
|
+
* * Function ({FFI::FunctionType})
|
370
|
+
* * Struct ({FFI::StructByValue})
|
370
371
|
*/
|
371
372
|
moduleNativeType = rb_define_module_under(moduleFFI, "NativeType");
|
372
373
|
|
data/ext/ffi_c/Types.c
CHANGED
@@ -41,6 +41,7 @@
|
|
41
41
|
#include "LongDouble.h"
|
42
42
|
|
43
43
|
static ID id_from_native = 0;
|
44
|
+
static ID id_initialize = 0;
|
44
45
|
|
45
46
|
|
46
47
|
VALUE
|
@@ -95,6 +96,7 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
95
96
|
case NATIVE_STRUCT: {
|
96
97
|
StructByValue* sbv = (StructByValue *)type;
|
97
98
|
AbstractMemory* mem;
|
99
|
+
VALUE obj;
|
98
100
|
VALUE rbMemory = rbffi_MemoryPointer_NewInstance(1, sbv->base.ffiType->size, false);
|
99
101
|
|
100
102
|
TypedData_Get_Struct(rbMemory, AbstractMemory, &rbffi_abstract_memory_data_type, mem);
|
@@ -102,7 +104,10 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
102
104
|
RB_GC_GUARD(rbMemory);
|
103
105
|
RB_GC_GUARD(rbType);
|
104
106
|
|
105
|
-
|
107
|
+
/* We avoid rb_class_new_instance here, to avoid passing the method block */
|
108
|
+
obj = rb_obj_alloc(sbv->rbStructClass);
|
109
|
+
rb_funcallv(obj, id_initialize, 1, &rbMemory);
|
110
|
+
return obj;
|
106
111
|
}
|
107
112
|
|
108
113
|
case NATIVE_MAPPED: {
|
@@ -134,5 +139,6 @@ void
|
|
134
139
|
rbffi_Types_Init(VALUE moduleFFI)
|
135
140
|
{
|
136
141
|
id_from_native = rb_intern("from_native");
|
142
|
+
id_initialize = rb_intern("initialize");
|
137
143
|
}
|
138
144
|
|
data/ext/ffi_c/Types.h
CHANGED
data/ext/ffi_c/Variadic.c
CHANGED
@@ -202,6 +202,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
202
202
|
Type** paramTypes;
|
203
203
|
VALUE* argv;
|
204
204
|
VALUE* callbackParameters;
|
205
|
+
VALUE callbackProc;
|
205
206
|
int paramCount = 0, fixedCount = 0, callbackCount = 0, i;
|
206
207
|
ffi_status ffiStatus;
|
207
208
|
rbffi_frame_t frame = { 0 };
|
@@ -290,8 +291,9 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
290
291
|
rb_raise(rb_eArgError, "Unknown FFI error");
|
291
292
|
}
|
292
293
|
|
293
|
-
rbffi_SetupCallParams(paramCount, argv, -1, paramTypes, params,
|
294
|
-
ffiValues, callbackParameters, callbackCount,
|
294
|
+
callbackProc = rbffi_SetupCallParams(paramCount, argv, -1, paramTypes, params,
|
295
|
+
ffiValues, callbackParameters, callbackCount,
|
296
|
+
invoker->rbEnums);
|
295
297
|
|
296
298
|
rbffi_frame_push(&frame);
|
297
299
|
|
@@ -309,6 +311,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
309
311
|
} else {
|
310
312
|
ffi_call(&cif, FFI_FN(invoker->function), retval, ffiValues);
|
311
313
|
}
|
314
|
+
RB_GC_GUARD(callbackProc);
|
312
315
|
|
313
316
|
rbffi_frame_pop(&frame);
|
314
317
|
|
File without changes
|
@@ -14,6 +14,30 @@ on:
|
|
14
14
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
15
15
|
jobs:
|
16
16
|
|
17
|
+
build-warp:
|
18
|
+
name: ${{ matrix.HOST }} ${{ matrix.CONFIGURE_OPTIONS }} ${{ matrix.MEVAL }} ${{ matrix.LIBFFI_TEST_OPTIMIZATION }}
|
19
|
+
runs-on: warp-ubuntu-latest-arm64-2x
|
20
|
+
|
21
|
+
strategy:
|
22
|
+
fail-fast: false
|
23
|
+
matrix:
|
24
|
+
include:
|
25
|
+
- HOST: "aarch64-linux-gnu"
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
|
30
|
+
- env:
|
31
|
+
MEVAL: ${{ matrix.MEVAL }}
|
32
|
+
HOST: ${{ matrix.HOST }}
|
33
|
+
LDFLAGS: ${{ matrix.LDFLAGS }}
|
34
|
+
RUNTESTFLAGS: ${{ matrix.RUNTESTFLAGS }}
|
35
|
+
CONFIGURE_OPTIONS: ${{ matrix.CONFIGURE_OPTIONS }}
|
36
|
+
run: |
|
37
|
+
if test x"$MEVAL" != x; then eval ${MEVAL}; fi
|
38
|
+
./.ci/install.sh
|
39
|
+
./.ci/build.sh
|
40
|
+
|
17
41
|
build-sim:
|
18
42
|
name: ${{ matrix.HOST }} ${{ matrix.CONFIGURE_OPTIONS }} ${{ matrix.MEVAL }} ${{ matrix.LIBFFI_TEST_OPTIMIZATION }}
|
19
43
|
runs-on: ubuntu-latest
|
@@ -89,57 +113,52 @@ jobs:
|
|
89
113
|
fail-fast: false
|
90
114
|
matrix:
|
91
115
|
include:
|
92
|
-
- CFARM_HOST:
|
116
|
+
- CFARM_HOST: cfarm185.cfarm.net
|
93
117
|
CFARM_PORT: 22
|
94
118
|
CFARM_TRIPLE: aarch64-linux-gnu
|
95
119
|
CFARM_CC: "gcc"
|
96
120
|
CFARM_CXX: "g++"
|
97
|
-
- CFARM_HOST:
|
98
|
-
CFARM_PORT: 22
|
99
|
-
CFARM_TRIPLE: aarch64-linux-gnu
|
100
|
-
CFARM_CC: "/home/green/gcc12/bin/gcc"
|
101
|
-
CFARM_CXX: "/home/green/gcc12/bin/g++"
|
102
|
-
- CFARM_HOST: gcc117.fsffrance.org
|
121
|
+
- CFARM_HOST: cfarm185.fsffrance.org
|
103
122
|
CFARM_PORT: 22
|
104
123
|
CFARM_TRIPLE: aarch64-lto-linux-gnu
|
105
124
|
CFARM_CC: "gcc -flto"
|
106
125
|
CFARM_CXX: "g++ -flto"
|
107
|
-
- CFARM_HOST:
|
126
|
+
- CFARM_HOST: cfarm400.cfarm.net
|
108
127
|
CFARM_PORT: 25465
|
109
128
|
CFARM_TRIPLE: loongarch64-linux-gnu
|
110
129
|
CFARM_CC: "gcc"
|
111
130
|
CFARM_CXX: "g++"
|
112
|
-
- CFARM_HOST:
|
131
|
+
- CFARM_HOST: cfarm230.cfarm.net
|
113
132
|
CFARM_PORT: 22
|
114
133
|
CFARM_TRIPLE: mips-linux-gnu
|
115
134
|
CFARM_CC: "gcc"
|
116
135
|
CFARM_CXX: "g++"
|
117
|
-
- CFARM_HOST:
|
136
|
+
- CFARM_HOST: cfarm211.cfarm.net
|
118
137
|
CFARM_PORT: 22
|
119
138
|
CFARM_TRIPLE: sparc64-linux-gnu
|
120
139
|
CFARM_CC: "gcc"
|
121
140
|
CFARM_CXX: "g++"
|
122
|
-
- CFARM_HOST:
|
141
|
+
- CFARM_HOST: cfarm211.cfarm.net
|
123
142
|
CFARM_PORT: 22
|
124
143
|
CFARM_TRIPLE: sparc64-linux-gnu
|
125
144
|
CFARM_CC: "gcc -m32"
|
126
145
|
CFARM_CXX: "g++ -m32"
|
127
|
-
- CFARM_HOST:
|
146
|
+
- CFARM_HOST: cfarm91.cfarm.net
|
128
147
|
CFARM_PORT: 22
|
129
148
|
CFARM_TRIPLE: riscv64-linux-gnu
|
130
149
|
CFARM_CC: "gcc"
|
131
150
|
CFARM_CXX: "g++"
|
132
|
-
- CFARM_HOST:
|
151
|
+
- CFARM_HOST: cfarm103.cfarm.net
|
133
152
|
CFARM_PORT: 22
|
134
153
|
CFARM_TRIPLE: aarch64-m1-linux-gnu
|
135
154
|
CFARM_CC: "gcc"
|
136
155
|
CFARM_CXX: "g++"
|
137
|
-
- CFARM_HOST:
|
156
|
+
- CFARM_HOST: cfarm112.cfarm.net
|
138
157
|
CFARM_PORT: 22
|
139
158
|
CFARM_TRIPLE: powerpc64le-linux-gnu
|
140
159
|
CFARM_CC: "gcc"
|
141
160
|
CFARM_CXX: "g++"
|
142
|
-
- CFARM_HOST:
|
161
|
+
- CFARM_HOST: cfarm111.cfarm.net
|
143
162
|
CFARM_PORT: 22
|
144
163
|
CFARM_TRIPLE: powerpc-ibm-aix7.1.5.0
|
145
164
|
CFARM_CC: "gcc"
|
data/ext/ffi_c/libffi/LICENSE
CHANGED
data/ext/ffi_c/libffi/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Status
|
2
2
|
======
|
3
3
|
|
4
|
-
libffi-3.4.
|
4
|
+
libffi-3.4.6 was released on February 18, 2024. Check the libffi web
|
5
5
|
page for updates: <URL:http://sourceware.org/libffi/>.
|
6
6
|
|
7
7
|
|
@@ -158,7 +158,7 @@ It's also possible to build libffi on Windows platforms with
|
|
158
158
|
Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
|
159
159
|
wrapper script during configuration like so:
|
160
160
|
|
161
|
-
path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL"
|
161
|
+
path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CXXCPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL"
|
162
162
|
|
163
163
|
For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and
|
164
164
|
``CXX="path/to/msvcc.sh -m64"``. You may also need to specify
|
@@ -201,11 +201,16 @@ History
|
|
201
201
|
|
202
202
|
See the git log for details at http://github.com/libffi/libffi.
|
203
203
|
|
204
|
-
|
204
|
+
3.4.6 Feb-18-2024
|
205
|
+
Fix long double regression on mips64 and alpha.
|
206
|
+
|
207
|
+
3.4.5 Feb-15-2024
|
205
208
|
Add support for wasm32.
|
206
|
-
Add support for
|
209
|
+
Add support for aarch64 branch target identification (bti).
|
207
210
|
Add support for ARCv3: ARC32 & ARC64.
|
208
|
-
|
211
|
+
Add support for HPPA64, and many HPPA fixes.
|
212
|
+
Add support for Haikuos on PowerPC.
|
213
|
+
Fixes for AIX, loongson, MIPS, power, sparc64, and x86 Darwin.
|
209
214
|
|
210
215
|
3.4.4 Oct-23-2022
|
211
216
|
Important aarch64 fixes, including support for linux builds
|
data/ext/ffi_c/libffi/compile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#! /bin/sh
|
2
2
|
# Wrapper for compilers which do not understand '-c -o'.
|
3
3
|
|
4
|
-
scriptversion=
|
4
|
+
scriptversion=2018-03-07.03; # UTC
|
5
5
|
|
6
|
-
# Copyright (C) 1999-
|
6
|
+
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
7
7
|
# Written by Tom Tromey <tromey@cygnus.com>.
|
8
8
|
#
|
9
9
|
# This program is free software; you can redistribute it and/or modify
|
@@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
|
|
17
17
|
# GNU General Public License for more details.
|
18
18
|
#
|
19
19
|
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with this program. If not, see <
|
20
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
21
21
|
|
22
22
|
# As a special exception to the GNU General Public License, if you
|
23
23
|
# distribute this file as part of a program that contains a
|
@@ -53,7 +53,7 @@ func_file_conv ()
|
|
53
53
|
MINGW*)
|
54
54
|
file_conv=mingw
|
55
55
|
;;
|
56
|
-
CYGWIN*)
|
56
|
+
CYGWIN* | MSYS*)
|
57
57
|
file_conv=cygwin
|
58
58
|
;;
|
59
59
|
*)
|
@@ -67,7 +67,7 @@ func_file_conv ()
|
|
67
67
|
mingw/*)
|
68
68
|
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
69
69
|
;;
|
70
|
-
cygwin/*)
|
70
|
+
cygwin/* | msys/*)
|
71
71
|
file=`cygpath -m "$file" || echo "$file"`
|
72
72
|
;;
|
73
73
|
wine/*)
|
@@ -255,7 +255,8 @@ EOF
|
|
255
255
|
echo "compile $scriptversion"
|
256
256
|
exit $?
|
257
257
|
;;
|
258
|
-
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe
|
258
|
+
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
259
|
+
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
259
260
|
func_cl_wrapper "$@" # Doesn't return...
|
260
261
|
;;
|
261
262
|
esac
|
@@ -339,9 +340,9 @@ exit $ret
|
|
339
340
|
# Local Variables:
|
340
341
|
# mode: shell-script
|
341
342
|
# sh-indentation: 2
|
342
|
-
# eval: (add-hook '
|
343
|
+
# eval: (add-hook 'before-save-hook 'time-stamp)
|
343
344
|
# time-stamp-start: "scriptversion="
|
344
345
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
345
|
-
# time-stamp-time-zone: "
|
346
|
+
# time-stamp-time-zone: "UTC0"
|
346
347
|
# time-stamp-end: "; # UTC"
|
347
348
|
# End:
|