ffi 1.9.24 → 1.16.3
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 +348 -0
- data/Gemfile +4 -5
- data/README.md +44 -17
- data/Rakefile +74 -148
- data/ext/ffi_c/AbstractMemory.c +89 -70
- data/ext/ffi_c/AbstractMemory.h +3 -2
- data/ext/ffi_c/ArrayType.c +49 -13
- data/ext/ffi_c/ArrayType.h +1 -0
- data/ext/ffi_c/Buffer.c +90 -38
- data/ext/ffi_c/Call.c +55 -56
- data/ext/ffi_c/Call.h +12 -6
- data/ext/ffi_c/ClosurePool.c +333 -0
- data/ext/ffi_c/{Closure.h → ClosurePool.h} +25 -13
- data/ext/ffi_c/DynamicLibrary.c +91 -33
- data/ext/ffi_c/Function.c +306 -235
- data/ext/ffi_c/Function.h +3 -5
- data/ext/ffi_c/FunctionInfo.c +87 -32
- data/ext/ffi_c/LastError.c +74 -15
- data/ext/ffi_c/LongDouble.c +12 -10
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MappedType.c +66 -23
- data/ext/ffi_c/MappedType.h +0 -2
- data/ext/ffi_c/MemoryPointer.c +37 -15
- data/ext/ffi_c/MemoryPointer.h +0 -4
- data/ext/ffi_c/MethodHandle.c +265 -38
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +5 -56
- data/ext/ffi_c/Pointer.c +93 -55
- data/ext/ffi_c/Pointer.h +1 -4
- data/ext/ffi_c/Struct.c +202 -134
- data/ext/ffi_c/Struct.h +18 -9
- data/ext/ffi_c/StructByValue.c +50 -23
- data/ext/ffi_c/StructLayout.c +135 -64
- data/ext/ffi_c/Thread.c +4 -228
- data/ext/ffi_c/Thread.h +1 -20
- data/ext/ffi_c/Type.c +105 -55
- data/ext/ffi_c/Type.h +3 -2
- data/ext/ffi_c/Types.c +8 -9
- data/ext/ffi_c/Types.h +3 -4
- data/ext/ffi_c/Variadic.c +88 -47
- data/ext/ffi_c/compat.h +26 -22
- data/ext/ffi_c/extconf.rb +75 -32
- data/ext/ffi_c/ffi.c +9 -10
- data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
- data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
- data/ext/ffi_c/libffi/.appveyor.yml +53 -19
- data/ext/ffi_c/libffi/.ci/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
- data/ext/ffi_c/libffi/.ci/build-in-container.sh +10 -0
- data/ext/ffi_c/libffi/.ci/build.sh +124 -0
- data/ext/ffi_c/libffi/.ci/install.sh +78 -0
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +1 -1
- data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
- data/ext/ffi_c/libffi/.ci/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/site.exp +29 -0
- data/ext/ffi_c/libffi/.ci/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +460 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +171 -0
- data/ext/ffi_c/libffi/.gitignore +10 -2
- 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 +64 -73
- data/ext/ffi_c/libffi/Makefile.in +553 -235
- data/ext/ffi_c/libffi/README.md +165 -100
- data/ext/ffi_c/libffi/acinclude.m4 +10 -112
- data/ext/ffi_c/libffi/compile +348 -0
- data/ext/ffi_c/libffi/config.guess +950 -662
- data/ext/ffi_c/libffi/config.sub +1362 -1306
- data/ext/ffi_c/libffi/configure +4909 -4096
- data/ext/ffi_c/libffi/configure.ac +93 -32
- data/ext/ffi_c/libffi/configure.host +76 -28
- data/ext/ffi_c/libffi/doc/Makefile.in +15 -8
- data/ext/ffi_c/libffi/doc/libffi.texi +107 -46
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +22 -44
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +165 -56
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +17 -12
- data/ext/ffi_c/libffi/include/ffi.h.in +64 -48
- data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +34 -1
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +107 -74
- 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 +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +576 -284
- 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_cc_maxopt.m4 +18 -14
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -44
- 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/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/man/Makefile.in +15 -8
- data/ext/ffi_c/libffi/missing +8 -8
- 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/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
- data/ext/ffi_c/libffi/msvcc.sh +39 -14
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +286 -98
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +19 -3
- data/ext/ffi_c/libffi/src/aarch64/internal.h +33 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +142 -37
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
- data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +112 -10
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +117 -44
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/closures.c +189 -48
- 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 +6 -1
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
- 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/loongarch64/ffi.c +621 -0
- data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
- data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
- data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/mips/ffi.c +245 -66
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
- data/ext/ffi_c/libffi/src/mips/o32.S +63 -4
- data/ext/ffi_c/libffi/src/moxie/ffi.c +48 -23
- data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
- data/ext/ffi_c/libffi/src/pa/ffi.c +62 -108
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +20 -11
- data/ext/ffi_c/libffi/src/pa/hpux32.S +87 -38
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +109 -39
- 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 +93 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +83 -5
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +26 -4
- data/ext/ffi_c/libffi/src/riscv/ffi.c +79 -10
- 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/sparc/ffi64.c +16 -0
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +128 -49
- data/ext/ffi_c/libffi/src/x86/ffi64.c +89 -23
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +21 -4
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +63 -10
- data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +274 -45
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +190 -4
- data/ext/ffi_c/libffi/src/x86/win64.S +32 -10
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
- data/ext/ffi_c/libffi/testsuite/Makefile.am +127 -109
- data/ext/ffi_c/libffi/testsuite/Makefile.in +144 -88
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +80 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +71 -25
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +5 -4
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
- 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 +3 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +7 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +6 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +18 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +29 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +35 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +19 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +18 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +29 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +28 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +24 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +39 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +25 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +14 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +14 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +14 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +20 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +40 -25
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +40 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +18 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +11 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +22 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +5 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +6 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +5 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +10 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +24 -22
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +32 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +12 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +21 -5
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +10 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +10 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +2 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +1 -0
- data/ext/ffi_c/libffi.bsd.mk +2 -2
- data/ext/ffi_c/libffi.darwin.mk +1 -1
- data/ext/ffi_c/libffi.gnu.mk +2 -2
- data/ext/ffi_c/rbffi.h +1 -3
- data/ffi.gemspec +15 -9
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +8 -23
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/dynamic_library.rb +89 -0
- data/lib/ffi/enum.rb +18 -11
- data/lib/ffi/ffi.rb +6 -0
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +3 -3
- data/lib/ffi/library.rb +65 -77
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +3 -3
- 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 +181 -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/aarch64-windows/types.conf +52 -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/hppa1.1-linux/types.conf +178 -0
- data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
- 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/loongarch64-linux/types.conf +141 -0
- 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/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- 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/platform.rb +43 -20
- data/lib/ffi/pointer.rb +26 -20
- data/lib/ffi/struct.rb +14 -68
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +1 -1
- data/lib/ffi/tools/const_generator.rb +11 -8
- data/lib/ffi/tools/generator.rb +47 -2
- data/lib/ffi/tools/generator_task.rb +13 -17
- data/lib/ffi/tools/struct_generator.rb +6 -5
- data/lib/ffi/tools/types_generator.rb +7 -4
- data/lib/ffi/types.rb +33 -7
- data/lib/ffi/variadic.rb +20 -18
- data/lib/ffi/version.rb +1 -1
- data/lib/ffi.rb +10 -3
- 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/hello_ractor.rb +11 -0
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- data/samples/qsort_ractor.rb +28 -0
- data.tar.gz.sig +0 -0
- metadata +252 -153
- metadata.gz.sig +0 -0
- 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/Closure.c +0 -54
- 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/.travis/build.sh +0 -34
- data/ext/ffi_c/libffi/.travis/install.sh +0 -22
- data/ext/ffi_c/libffi/.travis/site.exp +0 -18
- data/ext/ffi_c/libffi/.travis.yml +0 -34
- 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/libffi/testsuite/libffi.call/cls_uchar_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +0 -44
- 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
- data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.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_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}/err_bad_abi.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/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +79 -79
@@ -31,6 +31,7 @@
|
|
31
31
|
|
32
32
|
#include <stdint.h>
|
33
33
|
#include <stdlib.h>
|
34
|
+
#include <stdio.h>
|
34
35
|
|
35
36
|
#ifdef __GNUC__
|
36
37
|
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
|
@@ -39,7 +40,9 @@
|
|
39
40
|
#endif
|
40
41
|
|
41
42
|
#ifndef USE__BUILTIN___CLEAR_CACHE
|
42
|
-
# if defined(
|
43
|
+
# if defined(__FreeBSD__)
|
44
|
+
# include <machine/sysarch.h>
|
45
|
+
# elif defined(__OpenBSD__)
|
43
46
|
# include <mips64/sysarch.h>
|
44
47
|
# else
|
45
48
|
# include <sys/cachectl.h>
|
@@ -75,22 +78,39 @@ static void ffi_prep_args(char *stack,
|
|
75
78
|
{
|
76
79
|
int i;
|
77
80
|
void **p_argv;
|
78
|
-
char *argp;
|
81
|
+
char *argp, *argp_f;
|
79
82
|
ffi_type **p_arg;
|
80
83
|
|
84
|
+
memset(stack, 0, bytes);
|
85
|
+
|
81
86
|
#ifdef FFI_MIPS_N32
|
87
|
+
int soft_float = (ecif->cif->abi == FFI_N32_SOFT_FLOAT
|
88
|
+
|| ecif->cif->abi == FFI_N64_SOFT_FLOAT);
|
82
89
|
/* If more than 8 double words are used, the remainder go
|
83
90
|
on the stack. We reorder stuff on the stack here to
|
84
91
|
support this easily. */
|
85
|
-
if
|
86
|
-
|
92
|
+
/* if ret is _Complex long double, args reg shift2, and a0 should holds pointer to rvalue */
|
93
|
+
if (ecif->cif->rtype->type == FFI_TYPE_COMPLEX && ecif->cif->rtype->elements[0]->type == FFI_TYPE_LONGDOUBLE)
|
94
|
+
{
|
95
|
+
if (bytes + 16 > 8 * sizeof(ffi_arg))
|
96
|
+
argp = &stack[bytes - (8 * sizeof(ffi_arg))];
|
97
|
+
else
|
98
|
+
argp = stack;
|
99
|
+
* (unsigned long *) argp = (unsigned long) ecif->rvalue;
|
100
|
+
argp += 16;
|
101
|
+
}
|
87
102
|
else
|
88
|
-
|
103
|
+
{
|
104
|
+
if (bytes > 8 * sizeof(ffi_arg))
|
105
|
+
argp = &stack[bytes - (8 * sizeof(ffi_arg))];
|
106
|
+
else
|
107
|
+
argp = stack;
|
108
|
+
}
|
89
109
|
#else
|
90
110
|
argp = stack;
|
91
111
|
#endif
|
92
112
|
|
93
|
-
|
113
|
+
argp_f = argp;
|
94
114
|
|
95
115
|
#ifdef FFI_MIPS_N32
|
96
116
|
if ( ecif->cif->rstruct_flag != 0 )
|
@@ -131,7 +151,7 @@ static void ffi_prep_args(char *stack,
|
|
131
151
|
if (type == FFI_TYPE_POINTER)
|
132
152
|
type = (ecif->cif->abi == FFI_N64
|
133
153
|
|| ecif->cif->abi == FFI_N64_SOFT_FLOAT)
|
134
|
-
? FFI_TYPE_SINT64 :
|
154
|
+
? FFI_TYPE_SINT64 : FFI_TYPE_UINT32;
|
135
155
|
|
136
156
|
if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT
|
137
157
|
|| ecif->cif->abi == FFI_N64_SOFT_FLOAT))
|
@@ -181,6 +201,25 @@ static void ffi_prep_args(char *stack,
|
|
181
201
|
#endif
|
182
202
|
break;
|
183
203
|
|
204
|
+
#ifdef FFI_MIPS_N32
|
205
|
+
case FFI_TYPE_COMPLEX:
|
206
|
+
/* expand from 4+4 to 8+8 if pass with fpr reg */
|
207
|
+
/* argp will wind back to stack when we process all of reg args */
|
208
|
+
/* all var_args passed with gpr, should be expand */
|
209
|
+
if(!soft_float
|
210
|
+
&& (*p_arg)->elements[0]->type == FFI_TYPE_FLOAT
|
211
|
+
&& argp>=argp_f
|
212
|
+
&& i < ecif->cif->mips_nfixedargs)
|
213
|
+
{
|
214
|
+
*(float *) argp = *(float *)(* p_argv);
|
215
|
+
argp += z;
|
216
|
+
char *tmp = (void *) (*p_argv);
|
217
|
+
*(float *) argp = *(float *)(tmp+4);
|
218
|
+
}
|
219
|
+
else
|
220
|
+
memcpy(argp, *p_argv, (*p_arg)->size);
|
221
|
+
break;
|
222
|
+
#endif
|
184
223
|
/* This can only happen with 64bit slots. */
|
185
224
|
case FFI_TYPE_FLOAT:
|
186
225
|
*(float *) argp = *(float *)(* p_argv);
|
@@ -233,6 +272,24 @@ static void ffi_prep_args(char *stack,
|
|
233
272
|
passed in an integer register". This code traverses structure
|
234
273
|
definitions and generates the appropriate flags. */
|
235
274
|
|
275
|
+
static int
|
276
|
+
calc_n32_struct_flags_element(unsigned *flags, ffi_type *e,
|
277
|
+
unsigned *loc, unsigned *arg_reg)
|
278
|
+
{
|
279
|
+
/* Align this object. */
|
280
|
+
*loc = FFI_ALIGN(*loc, e->alignment);
|
281
|
+
if (e->type == FFI_TYPE_DOUBLE)
|
282
|
+
{
|
283
|
+
/* Already aligned to FFI_SIZEOF_ARG. */
|
284
|
+
*arg_reg = *loc / FFI_SIZEOF_ARG;
|
285
|
+
if (*arg_reg > 7)
|
286
|
+
return 1;
|
287
|
+
*flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS));
|
288
|
+
}
|
289
|
+
*loc += e->size;
|
290
|
+
return 0;
|
291
|
+
}
|
292
|
+
|
236
293
|
static unsigned
|
237
294
|
calc_n32_struct_flags(int soft_float, ffi_type *arg,
|
238
295
|
unsigned *loc, unsigned *arg_reg)
|
@@ -247,19 +304,16 @@ calc_n32_struct_flags(int soft_float, ffi_type *arg,
|
|
247
304
|
|
248
305
|
while ((e = arg->elements[index]))
|
249
306
|
{
|
250
|
-
|
251
|
-
*loc = FFI_ALIGN(*loc, e->alignment);
|
252
|
-
if (e->type == FFI_TYPE_DOUBLE)
|
307
|
+
if (e->type == FFI_TYPE_COMPLEX)
|
253
308
|
{
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS));
|
259
|
-
*loc += e->size;
|
309
|
+
if (calc_n32_struct_flags_element(&flags, e->elements[0], loc, arg_reg))
|
310
|
+
break;
|
311
|
+
if (calc_n32_struct_flags_element(&flags, e->elements[0], loc, arg_reg))
|
312
|
+
break;
|
260
313
|
}
|
261
314
|
else
|
262
|
-
|
315
|
+
if (calc_n32_struct_flags_element(&flags, e, loc, arg_reg))
|
316
|
+
break;
|
263
317
|
index++;
|
264
318
|
}
|
265
319
|
/* Next Argument register at alignment of FFI_SIZEOF_ARG. */
|
@@ -271,7 +325,7 @@ calc_n32_struct_flags(int soft_float, ffi_type *arg,
|
|
271
325
|
static unsigned
|
272
326
|
calc_n32_return_struct_flags(int soft_float, ffi_type *arg)
|
273
327
|
{
|
274
|
-
unsigned flags
|
328
|
+
unsigned flags;
|
275
329
|
unsigned small = FFI_TYPE_SMALLSTRUCT;
|
276
330
|
ffi_type *e;
|
277
331
|
|
@@ -290,33 +344,48 @@ calc_n32_return_struct_flags(int soft_float, ffi_type *arg)
|
|
290
344
|
|
291
345
|
e = arg->elements[0];
|
292
346
|
|
293
|
-
if (e->type ==
|
294
|
-
flags = FFI_TYPE_DOUBLE;
|
295
|
-
else if (e->type == FFI_TYPE_FLOAT)
|
296
|
-
flags = FFI_TYPE_FLOAT;
|
297
|
-
|
298
|
-
if (flags && (e = arg->elements[1]))
|
347
|
+
if (e->type == FFI_TYPE_COMPLEX)
|
299
348
|
{
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS;
|
304
|
-
else
|
349
|
+
int type = e->elements[0]->type;
|
350
|
+
|
351
|
+
if (type != FFI_TYPE_DOUBLE && type != FFI_TYPE_FLOAT)
|
305
352
|
return small;
|
306
353
|
|
307
|
-
if (
|
354
|
+
if (arg->elements[1])
|
308
355
|
{
|
309
|
-
/*
|
310
|
-
|
356
|
+
/* Two floating point fields with more fields!
|
357
|
+
This must be passed the old way. */
|
311
358
|
return small;
|
312
359
|
}
|
313
|
-
|
314
|
-
|
360
|
+
|
361
|
+
flags = (type << FFI_FLAG_BITS) + type;
|
315
362
|
}
|
316
363
|
else
|
317
|
-
|
318
|
-
|
364
|
+
{
|
365
|
+
if (e->type != FFI_TYPE_DOUBLE && e->type != FFI_TYPE_FLOAT)
|
366
|
+
return small;
|
367
|
+
|
368
|
+
flags = e->type;
|
369
|
+
|
370
|
+
if (arg->elements[1])
|
371
|
+
{
|
372
|
+
e = arg->elements[1];
|
373
|
+
if (e->type != FFI_TYPE_DOUBLE && e->type != FFI_TYPE_FLOAT)
|
374
|
+
return small;
|
375
|
+
|
376
|
+
if (arg->elements[2])
|
377
|
+
{
|
378
|
+
/* There are three arguments and the first two are
|
379
|
+
floats! This must be passed the old way. */
|
380
|
+
return small;
|
381
|
+
}
|
319
382
|
|
383
|
+
flags += e->type << FFI_FLAG_BITS;
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
if (soft_float)
|
388
|
+
flags += FFI_TYPE_STRUCT_SOFT;
|
320
389
|
return flags;
|
321
390
|
}
|
322
391
|
|
@@ -333,7 +402,7 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
333
402
|
* does not have special handling for floating point args.
|
334
403
|
*/
|
335
404
|
|
336
|
-
if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32)
|
405
|
+
if (cif->rtype->type != FFI_TYPE_STRUCT && cif->rtype->type != FFI_TYPE_COMPLEX && cif->abi == FFI_O32)
|
337
406
|
{
|
338
407
|
if (cif->nargs > 0 && cif->nargs == nfixedargs)
|
339
408
|
{
|
@@ -401,7 +470,10 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
401
470
|
case FFI_TYPE_STRUCT:
|
402
471
|
case FFI_TYPE_FLOAT:
|
403
472
|
case FFI_TYPE_DOUBLE:
|
473
|
+
case FFI_TYPE_COMPLEX:
|
404
474
|
cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2);
|
475
|
+
if (cif->rtype->type == FFI_TYPE_COMPLEX)
|
476
|
+
cif->flags += ((*cif->rtype->elements[0]).type) << (FFI_FLAG_BITS * 4);
|
405
477
|
break;
|
406
478
|
|
407
479
|
case FFI_TYPE_SINT64:
|
@@ -419,7 +491,6 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
419
491
|
#ifdef FFI_MIPS_N32
|
420
492
|
/* Set the flags necessary for N32 processing */
|
421
493
|
{
|
422
|
-
int type;
|
423
494
|
unsigned arg_reg = 0;
|
424
495
|
unsigned loc = 0;
|
425
496
|
unsigned count = (cif->nargs < 8) ? cif->nargs : 8;
|
@@ -451,29 +522,14 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
451
522
|
|
452
523
|
while (count-- > 0 && arg_reg < 8)
|
453
524
|
{
|
454
|
-
|
525
|
+
ffi_type *t = cif->arg_types[index];
|
455
526
|
|
456
|
-
|
457
|
-
if (soft_float || index >= nfixedargs)
|
458
|
-
{
|
459
|
-
switch (type)
|
460
|
-
{
|
461
|
-
case FFI_TYPE_FLOAT:
|
462
|
-
type = FFI_TYPE_UINT32;
|
463
|
-
break;
|
464
|
-
case FFI_TYPE_DOUBLE:
|
465
|
-
type = FFI_TYPE_UINT64;
|
466
|
-
break;
|
467
|
-
default:
|
468
|
-
break;
|
469
|
-
}
|
470
|
-
}
|
471
|
-
switch (type)
|
527
|
+
switch (t->type)
|
472
528
|
{
|
473
529
|
case FFI_TYPE_FLOAT:
|
474
530
|
case FFI_TYPE_DOUBLE:
|
475
|
-
|
476
|
-
|
531
|
+
if (!soft_float && index < nfixedargs)
|
532
|
+
cif->flags += t->type << (arg_reg * FFI_FLAG_BITS);
|
477
533
|
arg_reg++;
|
478
534
|
break;
|
479
535
|
case FFI_TYPE_LONGDOUBLE:
|
@@ -489,17 +545,71 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
489
545
|
cif->flags +=
|
490
546
|
(FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
|
491
547
|
arg_reg++;
|
548
|
+
if (arg_reg >= 8)
|
549
|
+
continue;
|
492
550
|
cif->flags +=
|
493
551
|
(FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
|
494
552
|
arg_reg++;
|
495
553
|
}
|
496
554
|
break;
|
497
555
|
|
556
|
+
case FFI_TYPE_COMPLEX:
|
557
|
+
switch (t->elements[0]->type)
|
558
|
+
{
|
559
|
+
case FFI_TYPE_LONGDOUBLE:
|
560
|
+
arg_reg = FFI_ALIGN(arg_reg, 2);
|
561
|
+
if (soft_float || index >= nfixedargs)
|
562
|
+
{
|
563
|
+
arg_reg += 2;
|
564
|
+
}
|
565
|
+
else
|
566
|
+
{
|
567
|
+
cif->flags +=
|
568
|
+
(FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
|
569
|
+
arg_reg++;
|
570
|
+
if (arg_reg >= 8)
|
571
|
+
continue;
|
572
|
+
cif->flags +=
|
573
|
+
(FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
|
574
|
+
arg_reg++;
|
575
|
+
if (arg_reg >= 8)
|
576
|
+
continue;
|
577
|
+
}
|
578
|
+
/* passthrough */
|
579
|
+
case FFI_TYPE_FLOAT:
|
580
|
+
// one fpr can only holds one arg even it is single
|
581
|
+
cif->bytes += 16;
|
582
|
+
/* passthrough */
|
583
|
+
case FFI_TYPE_SINT32:
|
584
|
+
case FFI_TYPE_UINT32:
|
585
|
+
case FFI_TYPE_DOUBLE:
|
586
|
+
if (soft_float || index >= nfixedargs)
|
587
|
+
{
|
588
|
+
arg_reg += 2;
|
589
|
+
}
|
590
|
+
else
|
591
|
+
{
|
592
|
+
uint32_t type = t->elements[0]->type != FFI_TYPE_LONGDOUBLE? t->elements[0]->type: FFI_TYPE_DOUBLE;
|
593
|
+
cif->flags +=
|
594
|
+
(type << (arg_reg * FFI_FLAG_BITS));
|
595
|
+
arg_reg++;
|
596
|
+
if (arg_reg >= 8)
|
597
|
+
continue;
|
598
|
+
cif->flags +=
|
599
|
+
(type << (arg_reg * FFI_FLAG_BITS));
|
600
|
+
arg_reg++;
|
601
|
+
}
|
602
|
+
break;
|
603
|
+
default:
|
604
|
+
arg_reg += 2;
|
605
|
+
break;
|
606
|
+
}
|
607
|
+
break;
|
608
|
+
|
498
609
|
case FFI_TYPE_STRUCT:
|
499
610
|
loc = arg_reg * FFI_SIZEOF_ARG;
|
500
611
|
cif->flags += calc_n32_struct_flags(soft_float || index >= nfixedargs,
|
501
|
-
|
502
|
-
&loc, &arg_reg);
|
612
|
+
t, &loc, &arg_reg);
|
503
613
|
break;
|
504
614
|
|
505
615
|
default:
|
@@ -537,7 +647,7 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
537
647
|
|
538
648
|
case FFI_TYPE_POINTER:
|
539
649
|
if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32)
|
540
|
-
cif->flags +=
|
650
|
+
cif->flags += FFI_TYPE_UINT32 << (FFI_FLAG_BITS * 8);
|
541
651
|
else
|
542
652
|
cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
|
543
653
|
break;
|
@@ -561,8 +671,9 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
561
671
|
two doubles. */
|
562
672
|
if (soft_float)
|
563
673
|
{
|
564
|
-
|
565
|
-
|
674
|
+
/* if ret is long double, the ret is given by v0 and a0, no idea why
|
675
|
+
* Let's us VOID | VOID | LONGDOUBLE for it*/
|
676
|
+
cif->flags += FFI_TYPE_LONGDOUBLE << (FFI_FLAG_BITS * 8);
|
566
677
|
}
|
567
678
|
else
|
568
679
|
{
|
@@ -572,13 +683,44 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
|
|
572
683
|
<< (4 + (FFI_FLAG_BITS * 8));
|
573
684
|
}
|
574
685
|
break;
|
686
|
+
case FFI_TYPE_COMPLEX:
|
687
|
+
{
|
688
|
+
int type = cif->rtype->elements[0]->type;
|
689
|
+
|
690
|
+
cif->flags += (FFI_TYPE_COMPLEX << (FFI_FLAG_BITS * 8));
|
691
|
+
if (soft_float || (type != FFI_TYPE_FLOAT && type != FFI_TYPE_DOUBLE && type != FFI_TYPE_LONGDOUBLE))
|
692
|
+
{
|
693
|
+
switch (type)
|
694
|
+
{
|
695
|
+
case FFI_TYPE_DOUBLE:
|
696
|
+
case FFI_TYPE_SINT64:
|
697
|
+
case FFI_TYPE_UINT64:
|
698
|
+
case FFI_TYPE_INT:
|
699
|
+
type = FFI_TYPE_SMALLSTRUCT2;
|
700
|
+
break;
|
701
|
+
case FFI_TYPE_LONGDOUBLE:
|
702
|
+
type = FFI_TYPE_LONGDOUBLE;
|
703
|
+
break;
|
704
|
+
case FFI_TYPE_FLOAT:
|
705
|
+
default:
|
706
|
+
type = FFI_TYPE_SMALLSTRUCT;
|
707
|
+
}
|
708
|
+
cif->flags += type << (4 + (FFI_FLAG_BITS * 8));
|
709
|
+
}
|
710
|
+
else
|
711
|
+
{
|
712
|
+
//cif->flags += (type + (type << FFI_FLAG_BITS))
|
713
|
+
// << (4 + (FFI_FLAG_BITS * 8));
|
714
|
+
cif->flags += type << (4 + (FFI_FLAG_BITS * 8));
|
715
|
+
}
|
716
|
+
break;
|
717
|
+
}
|
575
718
|
default:
|
576
719
|
cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
|
577
720
|
break;
|
578
721
|
}
|
579
722
|
}
|
580
723
|
#endif
|
581
|
-
|
582
724
|
return FFI_OK;
|
583
725
|
}
|
584
726
|
|
@@ -616,7 +758,7 @@ void ffi_call_int(ffi_cif *cif, void (*fn)(void), void *rvalue,
|
|
616
758
|
/* value address then we need to make one */
|
617
759
|
|
618
760
|
if ((rvalue == NULL) &&
|
619
|
-
(cif->rtype->type == FFI_TYPE_STRUCT))
|
761
|
+
(cif->rtype->type == FFI_TYPE_STRUCT || cif->rtype->type == FFI_TYPE_COMPLEX))
|
620
762
|
ecif.rvalue = alloca(cif->rtype->size);
|
621
763
|
else
|
622
764
|
ecif.rvalue = rvalue;
|
@@ -777,11 +919,13 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
|
777
919
|
closure->fun = fun;
|
778
920
|
closure->user_data = user_data;
|
779
921
|
|
922
|
+
#if !defined(__FreeBSD__)
|
780
923
|
#ifdef USE__BUILTIN___CLEAR_CACHE
|
781
924
|
__builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
|
782
925
|
#else
|
783
926
|
cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE);
|
784
927
|
#endif
|
928
|
+
#endif /* ! __FreeBSD__ */
|
785
929
|
return FFI_OK;
|
786
930
|
}
|
787
931
|
|
@@ -826,6 +970,11 @@ ffi_closure_mips_inner_O32 (ffi_cif *cif,
|
|
826
970
|
argn = 1;
|
827
971
|
seen_int = 1;
|
828
972
|
}
|
973
|
+
if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_COMPLEX)
|
974
|
+
{
|
975
|
+
rvalue = fpr;
|
976
|
+
argn = 1;
|
977
|
+
}
|
829
978
|
|
830
979
|
i = 0;
|
831
980
|
avn = cif->nargs;
|
@@ -898,6 +1047,9 @@ ffi_closure_mips_inner_O32 (ffi_cif *cif,
|
|
898
1047
|
}
|
899
1048
|
else
|
900
1049
|
{
|
1050
|
+
if (cif->rtype->type == FFI_TYPE_COMPLEX) {
|
1051
|
+
__asm__ volatile ("move $v1, %0" : : "r"(cif->rtype->size));
|
1052
|
+
}
|
901
1053
|
return cif->rtype->type;
|
902
1054
|
}
|
903
1055
|
}
|
@@ -987,6 +1139,8 @@ ffi_closure_mips_inner_N32 (ffi_cif *cif,
|
|
987
1139
|
#endif
|
988
1140
|
argn = 1;
|
989
1141
|
}
|
1142
|
+
if (cif->rtype->type == FFI_TYPE_COMPLEX && cif->rtype->elements[0]->type == FFI_TYPE_LONGDOUBLE)
|
1143
|
+
argn = 2;
|
990
1144
|
|
991
1145
|
i = 0;
|
992
1146
|
avn = cif->nargs;
|
@@ -1011,6 +1165,31 @@ ffi_closure_mips_inner_N32 (ffi_cif *cif,
|
|
1011
1165
|
#endif
|
1012
1166
|
avaluep[i] = (char *) argp;
|
1013
1167
|
}
|
1168
|
+
else if (arg_types[i]->type == FFI_TYPE_COMPLEX && arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
|
1169
|
+
{
|
1170
|
+
argp = (argn >= 8 || i >= cif->mips_nfixedargs || soft_float) ? ar + argn : fpr + argn;
|
1171
|
+
avaluep[i] = (char *) argp;
|
1172
|
+
}
|
1173
|
+
else if (arg_types[i]->type == FFI_TYPE_COMPLEX && arg_types[i]->elements[0]->type == FFI_TYPE_LONGDOUBLE)
|
1174
|
+
{
|
1175
|
+
/* align long double */
|
1176
|
+
argn += ((argn & 0x1)? 1 : 0);
|
1177
|
+
argp = (argn >= 8 || i >= cif->mips_nfixedargs || soft_float) ? ar + argn : fpr + argn;
|
1178
|
+
avaluep[i] = (char *) argp;
|
1179
|
+
}
|
1180
|
+
else if (arg_types[i]->type == FFI_TYPE_COMPLEX && arg_types[i]->elements[0]->type == FFI_TYPE_FLOAT)
|
1181
|
+
{
|
1182
|
+
if (argn >= 8 || i >= cif->mips_nfixedargs || soft_float)
|
1183
|
+
argp = ar + argn;
|
1184
|
+
else
|
1185
|
+
{
|
1186
|
+
argp = fpr + argn;
|
1187
|
+
/* the normal args for function holds 8bytes, while here we convert it to ptr */
|
1188
|
+
uint32_t *tmp = (uint32_t *)argp;
|
1189
|
+
tmp[1] = tmp[2];
|
1190
|
+
}
|
1191
|
+
avaluep[i] = (char *) argp;
|
1192
|
+
}
|
1014
1193
|
else
|
1015
1194
|
{
|
1016
1195
|
unsigned type = arg_types[i]->type;
|
@@ -1023,10 +1202,10 @@ ffi_closure_mips_inner_N32 (ffi_cif *cif,
|
|
1023
1202
|
/* The size of a pointer depends on the ABI */
|
1024
1203
|
if (type == FFI_TYPE_POINTER)
|
1025
1204
|
type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT)
|
1026
|
-
? FFI_TYPE_SINT64 :
|
1205
|
+
? FFI_TYPE_SINT64 : FFI_TYPE_UINT32;
|
1027
1206
|
|
1028
1207
|
if (soft_float && type == FFI_TYPE_FLOAT)
|
1029
|
-
type =
|
1208
|
+
type = FFI_TYPE_SINT32;
|
1030
1209
|
|
1031
1210
|
switch (type)
|
1032
1211
|
{
|
@@ -41,7 +41,7 @@
|
|
41
41
|
#define _MIPS_SIM_ABI32 1
|
42
42
|
#define _MIPS_SIM_NABI32 2
|
43
43
|
#define _MIPS_SIM_ABI64 3
|
44
|
-
#elif !defined(__OpenBSD__)
|
44
|
+
#elif !defined(__OpenBSD__) && !defined(__FreeBSD__)
|
45
45
|
# include <sgidefs.h>
|
46
46
|
#endif
|
47
47
|
|
@@ -80,6 +80,7 @@
|
|
80
80
|
# endif
|
81
81
|
#endif
|
82
82
|
|
83
|
+
#define FFI_TARGET_HAS_COMPLEX_TYPE 1
|
83
84
|
#define FFI_FLAG_BITS 2
|
84
85
|
|
85
86
|
/* SGI's strange assembler requires that we multiply by 4 rather
|
@@ -111,6 +112,12 @@
|
|
111
112
|
#define FFI_TYPE_STRUCT_SMALL 93
|
112
113
|
#define FFI_TYPE_STRUCT_SMALL2 109
|
113
114
|
|
115
|
+
#define FFI_TYPE_COMPLEX_SMALL 95
|
116
|
+
#define FFI_TYPE_COMPLEX_SMALL2 111
|
117
|
+
#define FFI_TYPE_COMPLEX_FF 47
|
118
|
+
#define FFI_TYPE_COMPLEX_DD 63
|
119
|
+
#define FFI_TYPE_COMPLEX_LDLD 79
|
120
|
+
|
114
121
|
/* and for n32 soft float, add 16 * 2^4 */
|
115
122
|
#define FFI_TYPE_STRUCT_D_SOFT 317
|
116
123
|
#define FFI_TYPE_STRUCT_F_SOFT 301
|