ffi 1.9.25 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +212 -0
- data/Gemfile +3 -4
- data/README.md +38 -18
- data/Rakefile +55 -146
- data/ext/ffi_c/AbstractMemory.c +29 -34
- data/ext/ffi_c/Buffer.c +4 -9
- data/ext/ffi_c/Call.c +16 -49
- data/ext/ffi_c/Call.h +4 -7
- data/ext/ffi_c/ClosurePool.c +75 -25
- data/ext/ffi_c/ClosurePool.h +3 -1
- data/ext/ffi_c/DynamicLibrary.c +2 -7
- data/ext/ffi_c/Function.c +47 -131
- data/ext/ffi_c/Function.h +0 -4
- data/ext/ffi_c/FunctionInfo.c +3 -8
- data/ext/ffi_c/LastError.c +49 -8
- data/ext/ffi_c/LongDouble.c +12 -10
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MemoryPointer.c +3 -8
- data/ext/ffi_c/MemoryPointer.h +0 -4
- data/ext/ffi_c/MethodHandle.c +21 -31
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +3 -54
- data/ext/ffi_c/Pointer.c +25 -26
- data/ext/ffi_c/Pointer.h +0 -4
- data/ext/ffi_c/Struct.c +49 -56
- data/ext/ffi_c/Struct.h +12 -6
- data/ext/ffi_c/StructByValue.c +2 -7
- data/ext/ffi_c/StructLayout.c +22 -20
- data/ext/ffi_c/Thread.c +4 -228
- data/ext/ffi_c/Thread.h +1 -20
- data/ext/ffi_c/Type.c +1 -19
- data/ext/ffi_c/Type.h +0 -1
- data/ext/ffi_c/Types.c +7 -8
- data/ext/ffi_c/Types.h +3 -4
- data/ext/ffi_c/Variadic.c +23 -24
- data/ext/ffi_c/compat.h +4 -0
- data/ext/ffi_c/extconf.rb +53 -30
- data/ext/ffi_c/ffi.c +3 -8
- data/ext/ffi_c/libffi.darwin.mk +1 -1
- data/ext/ffi_c/libffi/.appveyor.yml +29 -13
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.travis.yml +51 -2
- data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
- data/ext/ffi_c/libffi/.travis/build-in-container.sh +12 -0
- data/ext/ffi_c/libffi/.travis/build.sh +116 -8
- data/ext/ffi_c/libffi/.travis/install.sh +65 -16
- data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
- data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/site.exp +10 -1
- data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
- data/ext/ffi_c/libffi/Makefile.am +56 -72
- data/ext/ffi_c/libffi/README.md +33 -8
- data/ext/ffi_c/libffi/config.guess +552 -331
- data/ext/ffi_c/libffi/config.sub +1321 -1306
- data/ext/ffi_c/libffi/configure.ac +37 -12
- data/ext/ffi_c/libffi/configure.host +56 -27
- data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +997 -0
- data/ext/ffi_c/libffi/doc/version.texi +4 -0
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +2 -4
- data/ext/ffi_c/libffi/include/ffi.h.in +19 -7
- data/ext/ffi_c/libffi/include/ffi_common.h +5 -1
- data/ext/ffi_c/libffi/libffi.map.in +8 -12
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
- data/ext/ffi_c/libffi/msvcc.sh +38 -13
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +153 -69
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +19 -3
- data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +22 -9
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +62 -5
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/arm/sysv.S +6 -4
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/closures.c +69 -14
- data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
- data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
- data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
- data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
- data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
- data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
- data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
- data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/pa/ffi.c +46 -91
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +1 -6
- data/ext/ffi_c/libffi/src/pa/hpux32.S +4 -2
- data/ext/ffi_c/libffi/src/pa/linux.S +27 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +91 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +81 -5
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
- data/ext/ffi_c/libffi/src/riscv/ffi.c +42 -6
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
- data/ext/ffi_c/libffi/src/x86/ffi.c +29 -12
- data/ext/ffi_c/libffi/src/x86/ffi64.c +22 -11
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +20 -10
- data/ext/ffi_c/libffi/src/x86/sysv.S +105 -10
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +100 -4
- data/ext/ffi_c/libffi/src/x86/win64.S +12 -3
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
- data/ext/ffi_c/libffi/testsuite/Makefile.am +114 -109
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +32 -8
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
- data/ext/ffi_c/rbffi.h +0 -2
- data/ffi.gemspec +13 -6
- data/lib/ffi.rb +10 -2
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +1 -1
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/ffi.rb +3 -0
- data/lib/ffi/io.rb +3 -3
- data/lib/ffi/library.rb +12 -8
- data/lib/ffi/managedstruct.rb +2 -2
- data/lib/ffi/platform.rb +34 -10
- data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
- data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
- data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/arm-linux/types.conf +110 -82
- data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
- data/lib/ffi/platform/i386-darwin/types.conf +63 -63
- data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +84 -84
- data/lib/ffi/platform/i386-linux/types.conf +77 -77
- data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
- data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
- data/lib/ffi/platform/i386-solaris/types.conf +96 -96
- data/lib/ffi/platform/i386-windows/types.conf +43 -96
- data/lib/ffi/platform/ia64-linux/types.conf +79 -79
- data/lib/ffi/platform/mips-linux/types.conf +79 -79
- data/lib/ffi/platform/mips64-linux/types.conf +81 -81
- data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
- data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
- data/lib/ffi/platform/powerpc-linux/types.conf +108 -78
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
- data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
- data/lib/ffi/platform/s390-linux/types.conf +79 -79
- data/lib/ffi/platform/s390x-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
- data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
- data/lib/ffi/platform/x86_64-darwin/types.conf +88 -84
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
- data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +107 -77
- data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +42 -110
- data/lib/ffi/pointer.rb +26 -20
- data/lib/ffi/struct.rb +13 -68
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/tools/const_generator.rb +5 -4
- data/lib/ffi/tools/generator.rb +47 -2
- data/lib/ffi/tools/generator_task.rb +13 -17
- data/lib/ffi/tools/struct_generator.rb +4 -4
- data/lib/ffi/tools/types_generator.rb +7 -4
- data/lib/ffi/types.rb +1 -1
- data/lib/ffi/variadic.rb +1 -10
- data/lib/ffi/version.rb +1 -1
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +1 -1
- data/samples/getpid.rb +1 -1
- data/samples/gettimeofday.rb +8 -8
- data/samples/hello.rb +2 -1
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- metadata +160 -122
- data/.gitignore +0 -22
- data/.gitmodules +0 -3
- data/.travis.yml +0 -52
- data/.yardopts +0 -5
- data/appveyor.yml +0 -22
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/StructByReference.c +0 -190
- data/ext/ffi_c/StructByReference.h +0 -50
- data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
- data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
- data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
- data/ext/ffi_c/win32/stdbool.h +0 -8
- data/ext/ffi_c/win32/stdint.h +0 -201
- data/samples/sample_helper.rb +0 -6
@@ -38,7 +38,8 @@
|
|
38
38
|
/* About the LINUX64 ABI. */
|
39
39
|
enum {
|
40
40
|
NUM_GPR_ARG_REGISTERS64 = 8,
|
41
|
-
NUM_FPR_ARG_REGISTERS64 = 13
|
41
|
+
NUM_FPR_ARG_REGISTERS64 = 13,
|
42
|
+
NUM_VEC_ARG_REGISTERS64 = 12,
|
42
43
|
};
|
43
44
|
enum { ASM_NEEDS_REGISTERS64 = 4 };
|
44
45
|
|
@@ -63,10 +64,31 @@ ffi_prep_types_linux64 (ffi_abi abi)
|
|
63
64
|
|
64
65
|
|
65
66
|
static unsigned int
|
66
|
-
discover_homogeneous_aggregate (
|
67
|
+
discover_homogeneous_aggregate (ffi_abi abi,
|
68
|
+
const ffi_type *t,
|
69
|
+
unsigned int *elnum)
|
67
70
|
{
|
68
71
|
switch (t->type)
|
69
72
|
{
|
73
|
+
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
74
|
+
case FFI_TYPE_LONGDOUBLE:
|
75
|
+
/* 64-bit long doubles are equivalent to doubles. */
|
76
|
+
if ((abi & FFI_LINUX_LONG_DOUBLE_128) == 0)
|
77
|
+
{
|
78
|
+
*elnum = 1;
|
79
|
+
return FFI_TYPE_DOUBLE;
|
80
|
+
}
|
81
|
+
/* IBM extended precision values use unaligned pairs
|
82
|
+
of FPRs, but according to the ABI must be considered
|
83
|
+
distinct from doubles. They are also limited to a
|
84
|
+
maximum of four members in a homogeneous aggregate. */
|
85
|
+
else if ((abi & FFI_LINUX_LONG_DOUBLE_IEEE128) == 0)
|
86
|
+
{
|
87
|
+
*elnum = 2;
|
88
|
+
return FFI_TYPE_LONGDOUBLE;
|
89
|
+
}
|
90
|
+
/* Fall through. */
|
91
|
+
#endif
|
70
92
|
case FFI_TYPE_FLOAT:
|
71
93
|
case FFI_TYPE_DOUBLE:
|
72
94
|
*elnum = 1;
|
@@ -79,7 +101,7 @@ discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
|
|
79
101
|
while (*el)
|
80
102
|
{
|
81
103
|
unsigned int el_elt, el_elnum = 0;
|
82
|
-
el_elt = discover_homogeneous_aggregate (*el, &el_elnum);
|
104
|
+
el_elt = discover_homogeneous_aggregate (abi, *el, &el_elnum);
|
83
105
|
if (el_elt == 0
|
84
106
|
|| (base_elt && base_elt != el_elt))
|
85
107
|
return 0;
|
@@ -110,13 +132,23 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
|
|
110
132
|
{
|
111
133
|
ffi_type **ptr;
|
112
134
|
unsigned bytes;
|
113
|
-
unsigned i, fparg_count = 0, intarg_count = 0;
|
135
|
+
unsigned i, fparg_count = 0, intarg_count = 0, vecarg_count = 0;
|
114
136
|
unsigned flags = cif->flags;
|
115
|
-
unsigned
|
137
|
+
unsigned elt, elnum, rtype;
|
116
138
|
|
117
139
|
#if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE
|
118
|
-
/* If compiled without long double support
|
119
|
-
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0
|
140
|
+
/* If compiled without long double support... */
|
141
|
+
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0 ||
|
142
|
+
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
143
|
+
return FFI_BAD_ABI;
|
144
|
+
#elif !defined(__VEC__)
|
145
|
+
/* If compiled without vector register support (used by assembly)... */
|
146
|
+
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
147
|
+
return FFI_BAD_ABI;
|
148
|
+
#else
|
149
|
+
/* If the IEEE128 flag is set, but long double is only 64 bits wide... */
|
150
|
+
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) == 0 &&
|
151
|
+
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
120
152
|
return FFI_BAD_ABI;
|
121
153
|
#endif
|
122
154
|
|
@@ -138,10 +170,19 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
|
|
138
170
|
#endif
|
139
171
|
|
140
172
|
/* Return value handling. */
|
141
|
-
|
173
|
+
rtype = cif->rtype->type;
|
174
|
+
#if _CALL_ELF == 2
|
175
|
+
homogeneous:
|
176
|
+
#endif
|
177
|
+
switch (rtype)
|
142
178
|
{
|
143
179
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
144
180
|
case FFI_TYPE_LONGDOUBLE:
|
181
|
+
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
182
|
+
{
|
183
|
+
flags |= FLAG_RETURNS_VEC;
|
184
|
+
break;
|
185
|
+
}
|
145
186
|
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
|
146
187
|
flags |= FLAG_RETURNS_128BITS;
|
147
188
|
/* Fall through. */
|
@@ -164,19 +205,18 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
|
|
164
205
|
|
165
206
|
case FFI_TYPE_STRUCT:
|
166
207
|
#if _CALL_ELF == 2
|
167
|
-
elt = discover_homogeneous_aggregate (cif->rtype, &elnum);
|
208
|
+
elt = discover_homogeneous_aggregate (cif->abi, cif->rtype, &elnum);
|
168
209
|
if (elt)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
}
|
210
|
+
{
|
211
|
+
flags |= FLAG_RETURNS_SMST;
|
212
|
+
rtype = elt;
|
213
|
+
goto homogeneous;
|
214
|
+
}
|
175
215
|
if (cif->rtype->size <= 16)
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
216
|
+
{
|
217
|
+
flags |= FLAG_RETURNS_SMST;
|
218
|
+
break;
|
219
|
+
}
|
180
220
|
#endif
|
181
221
|
intarg_count++;
|
182
222
|
flags |= FLAG_RETVAL_REFERENCE;
|
@@ -198,6 +238,15 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
|
|
198
238
|
{
|
199
239
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
200
240
|
case FFI_TYPE_LONGDOUBLE:
|
241
|
+
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
242
|
+
{
|
243
|
+
vecarg_count++;
|
244
|
+
/* Align to 16 bytes, plus the 16-byte argument. */
|
245
|
+
intarg_count = (intarg_count + 3) & ~0x1;
|
246
|
+
if (vecarg_count > NUM_VEC_ARG_REGISTERS64)
|
247
|
+
flags |= FLAG_ARG_NEEDS_PSAVE;
|
248
|
+
break;
|
249
|
+
}
|
201
250
|
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
|
202
251
|
{
|
203
252
|
fparg_count++;
|
@@ -224,7 +273,18 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
|
|
224
273
|
intarg_count = FFI_ALIGN (intarg_count, align);
|
225
274
|
}
|
226
275
|
intarg_count += ((*ptr)->size + 7) / 8;
|
227
|
-
elt = discover_homogeneous_aggregate (*ptr, &elnum);
|
276
|
+
elt = discover_homogeneous_aggregate (cif->abi, *ptr, &elnum);
|
277
|
+
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
278
|
+
if (elt == FFI_TYPE_LONGDOUBLE &&
|
279
|
+
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
280
|
+
{
|
281
|
+
vecarg_count += elnum;
|
282
|
+
if (vecarg_count > NUM_VEC_ARG_REGISTERS64)
|
283
|
+
flags |= FLAG_ARG_NEEDS_PSAVE;
|
284
|
+
break;
|
285
|
+
}
|
286
|
+
else
|
287
|
+
#endif
|
228
288
|
if (elt)
|
229
289
|
{
|
230
290
|
fparg_count += elnum;
|
@@ -263,10 +323,17 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
|
|
263
323
|
flags |= FLAG_FP_ARGUMENTS;
|
264
324
|
if (intarg_count > 4)
|
265
325
|
flags |= FLAG_4_GPR_ARGUMENTS;
|
326
|
+
if (vecarg_count != 0)
|
327
|
+
flags |= FLAG_VEC_ARGUMENTS;
|
266
328
|
|
267
329
|
/* Space for the FPR registers, if needed. */
|
268
330
|
if (fparg_count != 0)
|
269
331
|
bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double);
|
332
|
+
/* Space for the vector registers, if needed, aligned to 16 bytes. */
|
333
|
+
if (vecarg_count != 0) {
|
334
|
+
bytes = (bytes + 15) & ~0xF;
|
335
|
+
bytes += NUM_VEC_ARG_REGISTERS64 * sizeof (float128);
|
336
|
+
}
|
270
337
|
|
271
338
|
/* Stack space. */
|
272
339
|
#if _CALL_ELF == 2
|
@@ -349,6 +416,8 @@ ffi_prep_cif_linux64_var (ffi_cif *cif,
|
|
349
416
|
|--------------------------------------------| |
|
350
417
|
| FPR registers f1-f13 (optional) 13*8 | |
|
351
418
|
|--------------------------------------------| |
|
419
|
+
| VEC registers v2-v13 (optional) 12*16 | |
|
420
|
+
|--------------------------------------------| |
|
352
421
|
| Parameter save area | |
|
353
422
|
|--------------------------------------------| |
|
354
423
|
| TOC save area 8 | |
|
@@ -378,6 +447,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
378
447
|
unsigned long *ul;
|
379
448
|
float *f;
|
380
449
|
double *d;
|
450
|
+
float128 *f128;
|
381
451
|
size_t p;
|
382
452
|
} valp;
|
383
453
|
|
@@ -391,11 +461,16 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
391
461
|
valp rest;
|
392
462
|
valp next_arg;
|
393
463
|
|
394
|
-
/* 'fpr_base' points at the space for
|
464
|
+
/* 'fpr_base' points at the space for f1, and grows upwards as
|
395
465
|
we use FPR registers. */
|
396
466
|
valp fpr_base;
|
397
467
|
unsigned int fparg_count;
|
398
468
|
|
469
|
+
/* 'vec_base' points at the space for v2, and grows upwards as
|
470
|
+
we use vector registers. */
|
471
|
+
valp vec_base;
|
472
|
+
unsigned int vecarg_count;
|
473
|
+
|
399
474
|
unsigned int i, words, nargs, nfixedargs;
|
400
475
|
ffi_type **ptr;
|
401
476
|
double double_tmp;
|
@@ -412,6 +487,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
412
487
|
unsigned long **ul;
|
413
488
|
float **f;
|
414
489
|
double **d;
|
490
|
+
float128 **f128;
|
415
491
|
} p_argv;
|
416
492
|
unsigned long gprvalue;
|
417
493
|
unsigned long align;
|
@@ -426,11 +502,21 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
426
502
|
#endif
|
427
503
|
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
|
428
504
|
fparg_count = 0;
|
505
|
+
/* Place the vector args below the FPRs, if used, else the GPRs. */
|
506
|
+
if (ecif->cif->flags & FLAG_FP_ARGUMENTS)
|
507
|
+
vec_base.p = fpr_base.p & ~0xF;
|
508
|
+
else
|
509
|
+
vec_base.p = gpr_base.p;
|
510
|
+
vec_base.f128 -= NUM_VEC_ARG_REGISTERS64;
|
511
|
+
vecarg_count = 0;
|
429
512
|
next_arg.ul = gpr_base.ul;
|
430
513
|
|
431
514
|
/* Check that everything starts aligned properly. */
|
432
515
|
FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
|
433
516
|
FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
|
517
|
+
FFI_ASSERT (((unsigned long) gpr_base.c & 0xF) == 0);
|
518
|
+
FFI_ASSERT (((unsigned long) gpr_end.c & 0xF) == 0);
|
519
|
+
FFI_ASSERT (((unsigned long) vec_base.c & 0xF) == 0);
|
434
520
|
FFI_ASSERT ((bytes & 0xF) == 0);
|
435
521
|
|
436
522
|
/* Deal with return values that are actually pass-by-reference. */
|
@@ -455,6 +541,22 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
455
541
|
{
|
456
542
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
457
543
|
case FFI_TYPE_LONGDOUBLE:
|
544
|
+
if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
545
|
+
{
|
546
|
+
next_arg.p = FFI_ALIGN (next_arg.p, 16);
|
547
|
+
if (next_arg.ul == gpr_end.ul)
|
548
|
+
next_arg.ul = rest.ul;
|
549
|
+
if (vecarg_count < NUM_VEC_ARG_REGISTERS64 && i < nfixedargs)
|
550
|
+
memcpy (vec_base.f128++, *p_argv.f128, sizeof (float128));
|
551
|
+
else
|
552
|
+
memcpy (next_arg.f128, *p_argv.f128, sizeof (float128));
|
553
|
+
if (++next_arg.f128 == gpr_end.f128)
|
554
|
+
next_arg.f128 = rest.f128;
|
555
|
+
vecarg_count++;
|
556
|
+
FFI_ASSERT (__LDBL_MANT_DIG__ == 113);
|
557
|
+
FFI_ASSERT (flags & FLAG_VEC_ARGUMENTS);
|
558
|
+
break;
|
559
|
+
}
|
458
560
|
if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
|
459
561
|
{
|
460
562
|
double_tmp = (*p_argv.d)[0];
|
@@ -492,7 +594,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
492
594
|
/* Fall through. */
|
493
595
|
#endif
|
494
596
|
case FFI_TYPE_DOUBLE:
|
597
|
+
#if _CALL_ELF != 2
|
495
598
|
do_double:
|
599
|
+
#endif
|
496
600
|
double_tmp = **p_argv.d;
|
497
601
|
if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
|
498
602
|
{
|
@@ -511,7 +615,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
511
615
|
break;
|
512
616
|
|
513
617
|
case FFI_TYPE_FLOAT:
|
618
|
+
#if _CALL_ELF != 2
|
514
619
|
do_float:
|
620
|
+
#endif
|
515
621
|
double_tmp = **p_argv.f;
|
516
622
|
if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
|
517
623
|
{
|
@@ -548,9 +654,13 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
548
654
|
if (align > 16)
|
549
655
|
align = 16;
|
550
656
|
if (align > 1)
|
551
|
-
|
657
|
+
{
|
658
|
+
next_arg.p = FFI_ALIGN (next_arg.p, align);
|
659
|
+
if (next_arg.ul == gpr_end.ul)
|
660
|
+
next_arg.ul = rest.ul;
|
661
|
+
}
|
552
662
|
}
|
553
|
-
elt = discover_homogeneous_aggregate (*ptr, &elnum);
|
663
|
+
elt = discover_homogeneous_aggregate (ecif->cif->abi, *ptr, &elnum);
|
554
664
|
if (elt)
|
555
665
|
{
|
556
666
|
#if _CALL_ELF == 2
|
@@ -558,9 +668,29 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
558
668
|
void *v;
|
559
669
|
float *f;
|
560
670
|
double *d;
|
671
|
+
float128 *f128;
|
561
672
|
} arg;
|
562
673
|
|
563
674
|
arg.v = *p_argv.v;
|
675
|
+
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
676
|
+
if (elt == FFI_TYPE_LONGDOUBLE &&
|
677
|
+
(ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
678
|
+
{
|
679
|
+
do
|
680
|
+
{
|
681
|
+
if (vecarg_count < NUM_VEC_ARG_REGISTERS64
|
682
|
+
&& i < nfixedargs)
|
683
|
+
memcpy (vec_base.f128++, arg.f128, sizeof (float128));
|
684
|
+
else
|
685
|
+
memcpy (next_arg.f128, arg.f128++, sizeof (float128));
|
686
|
+
if (++next_arg.f128 == gpr_end.f128)
|
687
|
+
next_arg.f128 = rest.f128;
|
688
|
+
vecarg_count++;
|
689
|
+
}
|
690
|
+
while (--elnum != 0);
|
691
|
+
}
|
692
|
+
else
|
693
|
+
#endif
|
564
694
|
if (elt == FFI_TYPE_FLOAT)
|
565
695
|
{
|
566
696
|
do
|
@@ -576,11 +706,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
|
576
706
|
fparg_count++;
|
577
707
|
}
|
578
708
|
while (--elnum != 0);
|
579
|
-
if ((next_arg.p &
|
580
|
-
|
581
|
-
|
582
|
-
next_arg.f = rest.f;
|
583
|
-
}
|
709
|
+
if ((next_arg.p & 7) != 0)
|
710
|
+
if (++next_arg.f == gpr_end.f)
|
711
|
+
next_arg.f = rest.f;
|
584
712
|
}
|
585
713
|
else
|
586
714
|
do
|
@@ -733,17 +861,20 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
733
861
|
void *user_data,
|
734
862
|
void *rvalue,
|
735
863
|
unsigned long *pst,
|
736
|
-
|
864
|
+
ffi_dblfl *pfr,
|
865
|
+
float128 *pvec)
|
737
866
|
{
|
738
867
|
/* rvalue is the pointer to space for return value in closure assembly */
|
739
868
|
/* pst is the pointer to parameter save area
|
740
869
|
(r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */
|
741
870
|
/* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */
|
871
|
+
/* pvec is the pointer to where v2-v13 are stored in ffi_closure_LINUX64 */
|
742
872
|
|
743
873
|
void **avalue;
|
744
874
|
ffi_type **arg_types;
|
745
875
|
unsigned long i, avn, nfixedargs;
|
746
876
|
ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
|
877
|
+
float128 *end_pvec = pvec + NUM_VEC_ARG_REGISTERS64;
|
747
878
|
unsigned long align;
|
748
879
|
|
749
880
|
avalue = alloca (cif->nargs * sizeof (void *));
|
@@ -813,7 +944,7 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
813
944
|
if (align > 1)
|
814
945
|
pst = (unsigned long *) FFI_ALIGN ((size_t) pst, align);
|
815
946
|
}
|
816
|
-
elt = discover_homogeneous_aggregate (arg_types[i], &elnum);
|
947
|
+
elt = discover_homogeneous_aggregate (cif->abi, arg_types[i], &elnum);
|
817
948
|
if (elt)
|
818
949
|
{
|
819
950
|
#if _CALL_ELF == 2
|
@@ -822,6 +953,7 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
822
953
|
unsigned long *ul;
|
823
954
|
float *f;
|
824
955
|
double *d;
|
956
|
+
float128 *f128;
|
825
957
|
size_t p;
|
826
958
|
} to, from;
|
827
959
|
|
@@ -829,6 +961,17 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
829
961
|
aggregate size is not greater than the space taken by
|
830
962
|
the registers so store back to the register/parameter
|
831
963
|
save arrays. */
|
964
|
+
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
965
|
+
if (elt == FFI_TYPE_LONGDOUBLE &&
|
966
|
+
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
967
|
+
{
|
968
|
+
if (pvec + elnum <= end_pvec)
|
969
|
+
to.v = pvec;
|
970
|
+
else
|
971
|
+
to.v = pst;
|
972
|
+
}
|
973
|
+
else
|
974
|
+
#endif
|
832
975
|
if (pfr + elnum <= end_pfr)
|
833
976
|
to.v = pfr;
|
834
977
|
else
|
@@ -836,6 +979,23 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
836
979
|
|
837
980
|
avalue[i] = to.v;
|
838
981
|
from.ul = pst;
|
982
|
+
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
983
|
+
if (elt == FFI_TYPE_LONGDOUBLE &&
|
984
|
+
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
985
|
+
{
|
986
|
+
do
|
987
|
+
{
|
988
|
+
if (pvec < end_pvec && i < nfixedargs)
|
989
|
+
memcpy (to.f128, pvec++, sizeof (float128));
|
990
|
+
else
|
991
|
+
memcpy (to.f128, from.f128, sizeof (float128));
|
992
|
+
to.f128++;
|
993
|
+
from.f128++;
|
994
|
+
}
|
995
|
+
while (--elnum != 0);
|
996
|
+
}
|
997
|
+
else
|
998
|
+
#endif
|
839
999
|
if (elt == FFI_TYPE_FLOAT)
|
840
1000
|
{
|
841
1001
|
do
|
@@ -891,7 +1051,18 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
891
1051
|
|
892
1052
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
893
1053
|
case FFI_TYPE_LONGDOUBLE:
|
894
|
-
|
1054
|
+
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
|
1055
|
+
{
|
1056
|
+
if (((unsigned long) pst & 0xF) != 0)
|
1057
|
+
++pst;
|
1058
|
+
if (pvec < end_pvec && i < nfixedargs)
|
1059
|
+
avalue[i] = pvec++;
|
1060
|
+
else
|
1061
|
+
avalue[i] = pst;
|
1062
|
+
pst += 2;
|
1063
|
+
break;
|
1064
|
+
}
|
1065
|
+
else if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
|
895
1066
|
{
|
896
1067
|
if (pfr + 1 < end_pfr && i + 1 < nfixedargs)
|
897
1068
|
{
|
@@ -915,7 +1086,9 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
915
1086
|
/* Fall through. */
|
916
1087
|
#endif
|
917
1088
|
case FFI_TYPE_DOUBLE:
|
1089
|
+
#if _CALL_ELF != 2
|
918
1090
|
do_double:
|
1091
|
+
#endif
|
919
1092
|
/* On the outgoing stack all values are aligned to 8 */
|
920
1093
|
/* there are 13 64bit floating point registers */
|
921
1094
|
|
@@ -930,7 +1103,9 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
930
1103
|
break;
|
931
1104
|
|
932
1105
|
case FFI_TYPE_FLOAT:
|
1106
|
+
#if _CALL_ELF != 2
|
933
1107
|
do_float:
|
1108
|
+
#endif
|
934
1109
|
if (pfr < end_pfr && i < nfixedargs)
|
935
1110
|
{
|
936
1111
|
/* Float values are stored as doubles in the
|
@@ -962,13 +1137,17 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
|
|
962
1137
|
/* Tell ffi_closure_LINUX64 how to perform return type promotions. */
|
963
1138
|
if ((cif->flags & FLAG_RETURNS_SMST) != 0)
|
964
1139
|
{
|
965
|
-
if ((cif->flags & FLAG_RETURNS_FP) == 0)
|
1140
|
+
if ((cif->flags & (FLAG_RETURNS_FP | FLAG_RETURNS_VEC)) == 0)
|
966
1141
|
return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1;
|
1142
|
+
else if ((cif->flags & FLAG_RETURNS_VEC) != 0)
|
1143
|
+
return FFI_V2_TYPE_VECTOR_HOMOG;
|
967
1144
|
else if ((cif->flags & FLAG_RETURNS_64BITS) != 0)
|
968
1145
|
return FFI_V2_TYPE_DOUBLE_HOMOG;
|
969
1146
|
else
|
970
1147
|
return FFI_V2_TYPE_FLOAT_HOMOG;
|
971
1148
|
}
|
1149
|
+
if ((cif->flags & FLAG_RETURNS_VEC) != 0)
|
1150
|
+
return FFI_V2_TYPE_VECTOR;
|
972
1151
|
return cif->rtype->type;
|
973
1152
|
}
|
974
1153
|
#endif
|