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
@@ -28,13 +28,20 @@
|
|
28
28
|
DEALINGS IN THE SOFTWARE.
|
29
29
|
----------------------------------------------------------------------- */
|
30
30
|
|
31
|
+
#if defined(__arm__) || defined(_M_ARM)
|
31
32
|
#include <fficonfig.h>
|
32
33
|
#include <ffi.h>
|
33
34
|
#include <ffi_common.h>
|
34
35
|
#include <stdint.h>
|
35
36
|
#include <stdlib.h>
|
37
|
+
#include <tramp.h>
|
36
38
|
#include "internal.h"
|
37
39
|
|
40
|
+
#if defined(_WIN32)
|
41
|
+
#define WIN32_LEAN_AND_MEAN
|
42
|
+
#include <windows.h>
|
43
|
+
#endif
|
44
|
+
|
38
45
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
39
46
|
|
40
47
|
#ifdef __MACH__
|
@@ -42,7 +49,23 @@
|
|
42
49
|
#endif
|
43
50
|
|
44
51
|
#else
|
52
|
+
#ifndef _WIN32
|
45
53
|
extern unsigned int ffi_arm_trampoline[2] FFI_HIDDEN;
|
54
|
+
#else
|
55
|
+
// Declare this as an array of char, instead of array of int,
|
56
|
+
// otherwise Clang optimizes out the "& 0xFFFFFFFE" for clearing
|
57
|
+
// the thumb bit.
|
58
|
+
extern unsigned char ffi_arm_trampoline[12] FFI_HIDDEN;
|
59
|
+
#endif
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#if defined(__FreeBSD__) && defined(__arm__)
|
63
|
+
#include <sys/types.h>
|
64
|
+
#include <machine/sysarch.h>
|
65
|
+
#endif
|
66
|
+
|
67
|
+
#if defined(__QNX__)
|
68
|
+
#include <sys/mman.h>
|
46
69
|
#endif
|
47
70
|
|
48
71
|
/* Forward declares. */
|
@@ -88,10 +111,20 @@ ffi_put_arg (ffi_type *ty, void *src, void *dst)
|
|
88
111
|
case FFI_TYPE_SINT32:
|
89
112
|
case FFI_TYPE_UINT32:
|
90
113
|
case FFI_TYPE_POINTER:
|
114
|
+
#ifndef _WIN32
|
91
115
|
case FFI_TYPE_FLOAT:
|
116
|
+
#endif
|
92
117
|
*(UINT32 *)dst = *(UINT32 *)src;
|
93
118
|
break;
|
94
119
|
|
120
|
+
#ifdef _WIN32
|
121
|
+
// casting a float* to a UINT32* doesn't work on Windows
|
122
|
+
case FFI_TYPE_FLOAT:
|
123
|
+
*(uintptr_t *)dst = 0;
|
124
|
+
*(float *)dst = *(float *)src;
|
125
|
+
break;
|
126
|
+
#endif
|
127
|
+
|
95
128
|
case FFI_TYPE_SINT64:
|
96
129
|
case FFI_TYPE_UINT64:
|
97
130
|
case FFI_TYPE_DOUBLE:
|
@@ -210,7 +243,7 @@ ffi_prep_args_VFP (ffi_cif *cif, int flags, void *rvalue,
|
|
210
243
|
}
|
211
244
|
|
212
245
|
/* Perform machine dependent cif processing */
|
213
|
-
ffi_status
|
246
|
+
ffi_status FFI_HIDDEN
|
214
247
|
ffi_prep_cif_machdep (ffi_cif *cif)
|
215
248
|
{
|
216
249
|
int flags = 0, cabi = cif->abi;
|
@@ -301,7 +334,7 @@ ffi_prep_cif_machdep (ffi_cif *cif)
|
|
301
334
|
}
|
302
335
|
|
303
336
|
/* Perform machine dependent cif processing for variadic calls */
|
304
|
-
ffi_status
|
337
|
+
ffi_status FFI_HIDDEN
|
305
338
|
ffi_prep_cif_machdep_var (ffi_cif * cif,
|
306
339
|
unsigned int nfixedargs, unsigned int ntotalargs)
|
307
340
|
{
|
@@ -401,12 +434,14 @@ ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue)
|
|
401
434
|
ffi_call_int (cif, fn, rvalue, avalue, NULL);
|
402
435
|
}
|
403
436
|
|
437
|
+
#ifdef FFI_GO_CLOSURES
|
404
438
|
void
|
405
439
|
ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue,
|
406
440
|
void **avalue, void *closure)
|
407
441
|
{
|
408
442
|
ffi_call_int (cif, fn, rvalue, avalue, closure);
|
409
443
|
}
|
444
|
+
#endif
|
410
445
|
|
411
446
|
static void *
|
412
447
|
ffi_prep_incoming_args_SYSV (ffi_cif *cif, void *rvalue,
|
@@ -509,6 +544,8 @@ ffi_prep_incoming_args_VFP (ffi_cif *cif, void *rvalue, char *stack,
|
|
509
544
|
return rvalue;
|
510
545
|
}
|
511
546
|
|
547
|
+
#if FFI_CLOSURES
|
548
|
+
|
512
549
|
struct closure_frame
|
513
550
|
{
|
514
551
|
char vfp_space[8*8] __attribute__((aligned(8)));
|
@@ -544,11 +581,28 @@ ffi_closure_inner_VFP (ffi_cif *cif,
|
|
544
581
|
|
545
582
|
void ffi_closure_SYSV (void) FFI_HIDDEN;
|
546
583
|
void ffi_closure_VFP (void) FFI_HIDDEN;
|
584
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
585
|
+
void ffi_closure_SYSV_alt (void) FFI_HIDDEN;
|
586
|
+
void ffi_closure_VFP_alt (void) FFI_HIDDEN;
|
587
|
+
#endif
|
588
|
+
|
589
|
+
#ifdef FFI_GO_CLOSURES
|
547
590
|
void ffi_go_closure_SYSV (void) FFI_HIDDEN;
|
548
591
|
void ffi_go_closure_VFP (void) FFI_HIDDEN;
|
592
|
+
#endif
|
549
593
|
|
550
594
|
/* the cif must already be prep'ed */
|
551
595
|
|
596
|
+
#if defined(__FreeBSD__) && defined(__arm__)
|
597
|
+
#define __clear_cache(start, end) do { \
|
598
|
+
struct arm_sync_icache_args ua; \
|
599
|
+
\
|
600
|
+
ua.addr = (uintptr_t)(start); \
|
601
|
+
ua.len = (char *)(end) - (char *)start; \
|
602
|
+
sysarch(ARM_SYNC_ICACHE, &ua); \
|
603
|
+
} while (0);
|
604
|
+
#endif
|
605
|
+
|
552
606
|
ffi_status
|
553
607
|
ffi_prep_closure_loc (ffi_closure * closure,
|
554
608
|
ffi_cif * cif,
|
@@ -571,15 +625,45 @@ ffi_prep_closure_loc (ffi_closure * closure,
|
|
571
625
|
config[0] = closure;
|
572
626
|
config[1] = closure_func;
|
573
627
|
#else
|
574
|
-
|
575
|
-
#if defined
|
576
|
-
|
577
|
-
|
578
|
-
|
628
|
+
|
629
|
+
# if defined(FFI_EXEC_STATIC_TRAMP)
|
630
|
+
if (ffi_tramp_is_present(closure))
|
631
|
+
{
|
632
|
+
/* Initialize the static trampoline's parameters. */
|
633
|
+
if (closure_func == ffi_closure_SYSV)
|
634
|
+
closure_func = ffi_closure_SYSV_alt;
|
635
|
+
else
|
636
|
+
closure_func = ffi_closure_VFP_alt;
|
637
|
+
ffi_tramp_set_parms (closure->ftramp, closure_func, closure);
|
638
|
+
goto out;
|
639
|
+
}
|
640
|
+
# endif
|
641
|
+
|
642
|
+
/* Initialize the dynamic trampoline. */
|
643
|
+
# ifndef _WIN32
|
644
|
+
memcpy(closure->tramp, ffi_arm_trampoline, 8);
|
645
|
+
# else
|
646
|
+
// cast away function type so MSVC doesn't set the lower bit of the function pointer
|
647
|
+
memcpy(closure->tramp, (void*)((uintptr_t)ffi_arm_trampoline & 0xFFFFFFFE), FFI_TRAMPOLINE_CLOSURE_OFFSET);
|
648
|
+
# endif
|
649
|
+
|
650
|
+
# if defined(__QNX__)
|
651
|
+
msync (closure->tramp, 8, MS_INVALIDATE_ICACHE); /* clear data map */
|
652
|
+
msync (codeloc, 8, MS_INVALIDATE_ICACHE); /* clear insn map */
|
653
|
+
# elif defined(_WIN32)
|
654
|
+
FlushInstructionCache(GetCurrentProcess(), closure->tramp, FFI_TRAMPOLINE_SIZE);
|
655
|
+
# else
|
579
656
|
__clear_cache(closure->tramp, closure->tramp + 8); /* clear data map */
|
580
657
|
__clear_cache(codeloc, codeloc + 8); /* clear insn map */
|
581
|
-
#endif
|
658
|
+
# endif
|
659
|
+
# ifdef _WIN32
|
660
|
+
*(void(**)(void))(closure->tramp + FFI_TRAMPOLINE_CLOSURE_FUNCTION) = closure_func;
|
661
|
+
# else
|
582
662
|
*(void (**)(void))(closure->tramp + 8) = closure_func;
|
663
|
+
# endif
|
664
|
+
# if defined(FFI_EXEC_STATIC_TRAMP)
|
665
|
+
out:
|
666
|
+
# endif
|
583
667
|
#endif
|
584
668
|
|
585
669
|
closure->cif = cif;
|
@@ -589,6 +673,7 @@ ffi_prep_closure_loc (ffi_closure * closure,
|
|
589
673
|
return FFI_OK;
|
590
674
|
}
|
591
675
|
|
676
|
+
#ifdef FFI_GO_CLOSURES
|
592
677
|
ffi_status
|
593
678
|
ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif,
|
594
679
|
void (*fun) (ffi_cif *, void *, void **, void *))
|
@@ -610,6 +695,9 @@ ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif,
|
|
610
695
|
|
611
696
|
return FFI_OK;
|
612
697
|
}
|
698
|
+
#endif
|
699
|
+
|
700
|
+
#endif /* FFI_CLOSURES */
|
613
701
|
|
614
702
|
/* Below are routines for VFP hard-float support. */
|
615
703
|
|
@@ -781,7 +869,7 @@ place_vfp_arg (ffi_cif *cif, int h)
|
|
781
869
|
}
|
782
870
|
/* Found regs to allocate. */
|
783
871
|
cif->vfp_used |= new_used;
|
784
|
-
cif->vfp_args[cif->vfp_nargs++] = reg;
|
872
|
+
cif->vfp_args[cif->vfp_nargs++] = (signed char)reg;
|
785
873
|
|
786
874
|
/* Update vfp_reg_free. */
|
787
875
|
if (cif->vfp_used & (1 << cif->vfp_reg_free))
|
@@ -803,7 +891,7 @@ place_vfp_arg (ffi_cif *cif, int h)
|
|
803
891
|
static void
|
804
892
|
layout_vfp_args (ffi_cif * cif)
|
805
893
|
{
|
806
|
-
int i;
|
894
|
+
unsigned int i;
|
807
895
|
/* Init VFP fields */
|
808
896
|
cif->vfp_used = 0;
|
809
897
|
cif->vfp_nargs = 0;
|
@@ -817,3 +905,17 @@ layout_vfp_args (ffi_cif * cif)
|
|
817
905
|
break;
|
818
906
|
}
|
819
907
|
}
|
908
|
+
|
909
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
910
|
+
void *
|
911
|
+
ffi_tramp_arch (size_t *tramp_size, size_t *map_size)
|
912
|
+
{
|
913
|
+
extern void *trampoline_code_table;
|
914
|
+
|
915
|
+
*tramp_size = ARM_TRAMP_SIZE;
|
916
|
+
*map_size = ARM_TRAMP_MAP_SIZE;
|
917
|
+
return &trampoline_code_table;
|
918
|
+
}
|
919
|
+
#endif
|
920
|
+
|
921
|
+
#endif /* __arm__ or _M_ARM */
|
@@ -43,7 +43,7 @@ typedef enum ffi_abi {
|
|
43
43
|
FFI_SYSV,
|
44
44
|
FFI_VFP,
|
45
45
|
FFI_LAST_ABI,
|
46
|
-
#
|
46
|
+
#if defined(__ARM_PCS_VFP) || defined(_WIN32)
|
47
47
|
FFI_DEFAULT_ABI = FFI_VFP,
|
48
48
|
#else
|
49
49
|
FFI_DEFAULT_ABI = FFI_SYSV,
|
@@ -57,7 +57,9 @@ typedef enum ffi_abi {
|
|
57
57
|
signed char vfp_args[16] \
|
58
58
|
|
59
59
|
#define FFI_TARGET_SPECIFIC_VARIADIC
|
60
|
+
#ifndef _WIN32
|
60
61
|
#define FFI_TARGET_HAS_COMPLEX_TYPE
|
62
|
+
#endif
|
61
63
|
|
62
64
|
/* ---- Definitions for closures ----------------------------------------- */
|
63
65
|
|
@@ -74,8 +76,13 @@ typedef enum ffi_abi {
|
|
74
76
|
#error "No trampoline table implementation"
|
75
77
|
#endif
|
76
78
|
|
79
|
+
#else
|
80
|
+
#ifdef _WIN32
|
81
|
+
#define FFI_TRAMPOLINE_SIZE 16
|
82
|
+
#define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12
|
77
83
|
#else
|
78
84
|
#define FFI_TRAMPOLINE_SIZE 12
|
85
|
+
#endif
|
79
86
|
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
|
80
87
|
#endif
|
81
88
|
|
@@ -5,3 +5,13 @@
|
|
5
5
|
#define ARM_TYPE_INT 4
|
6
6
|
#define ARM_TYPE_VOID 5
|
7
7
|
#define ARM_TYPE_STRUCT 6
|
8
|
+
|
9
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
10
|
+
/*
|
11
|
+
* For the trampoline table mapping, a mapping size of 4K (base page size)
|
12
|
+
* is chosen.
|
13
|
+
*/
|
14
|
+
#define ARM_TRAMP_MAP_SHIFT 12
|
15
|
+
#define ARM_TRAMP_MAP_SIZE (1 << ARM_TRAMP_MAP_SHIFT)
|
16
|
+
#define ARM_TRAMP_SIZE 20
|
17
|
+
#endif
|
@@ -25,6 +25,7 @@
|
|
25
25
|
DEALINGS IN THE SOFTWARE.
|
26
26
|
----------------------------------------------------------------------- */
|
27
27
|
|
28
|
+
#ifdef __arm__
|
28
29
|
#define LIBFFI_ASM
|
29
30
|
#include <fficonfig.h>
|
30
31
|
#include <ffi.h>
|
@@ -91,9 +92,25 @@
|
|
91
92
|
#define ARM_FUNC_END(name) \
|
92
93
|
SIZE(name)
|
93
94
|
|
95
|
+
.text
|
96
|
+
.syntax unified
|
97
|
+
#if defined(_WIN32)
|
98
|
+
/* Windows on ARM is thumb-only */
|
99
|
+
.thumb
|
100
|
+
#else
|
101
|
+
/* Keep the assembly in ARM mode in other cases, for simplicity
|
102
|
+
* (to avoid interworking issues). */
|
103
|
+
#undef __thumb__
|
104
|
+
.arm
|
105
|
+
#endif
|
106
|
+
|
94
107
|
/* Aid in defining a jump table with 8 bytes between entries. */
|
108
|
+
#ifdef __thumb__
|
109
|
+
/* In thumb mode, instructions can be shorter than expected in arm mode, so
|
110
|
+
* we need to align the start of each case. */
|
111
|
+
# define E(index) .align 3
|
112
|
+
#elif defined(__clang__)
|
95
113
|
/* ??? The clang assembler doesn't handle .if with symbolic expressions. */
|
96
|
-
#ifdef __clang__
|
97
114
|
# define E(index)
|
98
115
|
#else
|
99
116
|
# define E(index) \
|
@@ -102,9 +119,6 @@
|
|
102
119
|
.endif
|
103
120
|
#endif
|
104
121
|
|
105
|
-
.text
|
106
|
-
.syntax unified
|
107
|
-
.arm
|
108
122
|
|
109
123
|
#ifndef __clang__
|
110
124
|
/* We require interworking on LDM, which implies ARMv5T,
|
@@ -127,13 +141,9 @@ ARM_FUNC_START(ffi_call_VFP)
|
|
127
141
|
cfi_startproc
|
128
142
|
|
129
143
|
cmp r3, #3 @ load only d0 if possible
|
130
|
-
|
131
|
-
vldrle d0, [
|
132
|
-
vldmgt
|
133
|
-
#else
|
134
|
-
ldcle p11, cr0, [r0] @ vldrle d0, [sp]
|
135
|
-
ldcgt p11, cr0, [r0], {16} @ vldmgt sp, {d0-d7}
|
136
|
-
#endif
|
144
|
+
ite le
|
145
|
+
ldcle p11, cr0, [r0] @ vldrle d0, [r0]
|
146
|
+
ldcgt p11, cr0, [r0], {16} @ vldmgt r0, {d0-d7}
|
137
147
|
add r0, r0, #64 @ discard the vfp register args
|
138
148
|
/* FALLTHRU */
|
139
149
|
ARM_FUNC_END(ffi_call_VFP)
|
@@ -166,30 +176,25 @@ ARM_FUNC_START(ffi_call_SYSV)
|
|
166
176
|
cfi_def_cfa_register(sp)
|
167
177
|
|
168
178
|
@ Store values stored in registers.
|
179
|
+
#ifndef __thumb__
|
169
180
|
.align 3
|
170
181
|
add pc, pc, r3, lsl #3
|
171
182
|
nop
|
183
|
+
#else
|
184
|
+
adr ip, 0f
|
185
|
+
add ip, ip, r3, lsl #3
|
186
|
+
mov pc, ip
|
187
|
+
.align 3
|
188
|
+
#endif
|
172
189
|
0:
|
173
190
|
E(ARM_TYPE_VFP_S)
|
174
|
-
#ifdef __clang__
|
175
|
-
vstr s0, [r2]
|
176
|
-
#else
|
177
191
|
stc p10, cr0, [r2] @ vstr s0, [r2]
|
178
|
-
#endif
|
179
192
|
pop {fp,pc}
|
180
193
|
E(ARM_TYPE_VFP_D)
|
181
|
-
#ifdef __clang__
|
182
|
-
vstr d0, [r2]
|
183
|
-
#else
|
184
194
|
stc p11, cr0, [r2] @ vstr d0, [r2]
|
185
|
-
#endif
|
186
195
|
pop {fp,pc}
|
187
196
|
E(ARM_TYPE_VFP_N)
|
188
|
-
#ifdef __clang__
|
189
|
-
vstm r2, {d0-d3}
|
190
|
-
#else
|
191
197
|
stc p11, cr0, [r2], {8} @ vstm r2, {d0-d3}
|
192
|
-
#endif
|
193
198
|
pop {fp,pc}
|
194
199
|
E(ARM_TYPE_INT64)
|
195
200
|
str r1, [r2, #4]
|
@@ -207,6 +212,7 @@ E(ARM_TYPE_STRUCT)
|
|
207
212
|
UNWIND(.fnend)
|
208
213
|
ARM_FUNC_END(ffi_call_SYSV)
|
209
214
|
|
215
|
+
#if FFI_CLOSURES
|
210
216
|
|
211
217
|
/*
|
212
218
|
int ffi_closure_inner_* (cif, fun, user_data, frame)
|
@@ -226,6 +232,9 @@ ARM_FUNC_END(ffi_go_closure_SYSV)
|
|
226
232
|
ARM_FUNC_START(ffi_closure_SYSV)
|
227
233
|
UNWIND(.fnstart)
|
228
234
|
cfi_startproc
|
235
|
+
#ifdef _WIN32
|
236
|
+
ldmfd sp!, {r0, ip} @ restore fp (r0 is used for stack alignment)
|
237
|
+
#endif
|
229
238
|
stmdb sp!, {r0-r3} @ save argument regs
|
230
239
|
cfi_adjust_cfa_offset(16)
|
231
240
|
|
@@ -254,7 +263,12 @@ ARM_FUNC_START(ffi_closure_SYSV)
|
|
254
263
|
@ Load values returned in registers.
|
255
264
|
add r2, sp, #8+64 @ load result
|
256
265
|
adr r3, CNAME(ffi_closure_ret)
|
266
|
+
#ifndef __thumb__
|
257
267
|
add pc, r3, r0, lsl #3
|
268
|
+
#else
|
269
|
+
add r3, r3, r0, lsl #3
|
270
|
+
mov pc, r3
|
271
|
+
#endif
|
258
272
|
cfi_endproc
|
259
273
|
UNWIND(.fnend)
|
260
274
|
ARM_FUNC_END(ffi_closure_SYSV)
|
@@ -273,6 +287,9 @@ ARM_FUNC_END(ffi_go_closure_VFP)
|
|
273
287
|
ARM_FUNC_START(ffi_closure_VFP)
|
274
288
|
UNWIND(.fnstart)
|
275
289
|
cfi_startproc
|
290
|
+
#ifdef _WIN32
|
291
|
+
ldmfd sp!, {r0, ip} @ restore fp (r0 is used for stack alignment)
|
292
|
+
#endif
|
276
293
|
stmdb sp!, {r0-r3} @ save argument regs
|
277
294
|
cfi_adjust_cfa_offset(16)
|
278
295
|
|
@@ -286,11 +303,7 @@ ARM_FUNC_START(ffi_closure_VFP)
|
|
286
303
|
add ip, sp, #16
|
287
304
|
sub sp, sp, #64+32 @ allocate frame
|
288
305
|
cfi_adjust_cfa_offset(64+32)
|
289
|
-
#ifdef __clang__
|
290
|
-
vstm sp, {d0-d7}
|
291
|
-
#else
|
292
306
|
stc p11, cr0, [sp], {16} @ vstm sp, {d0-d7}
|
293
|
-
#endif
|
294
307
|
stmdb sp!, {ip,lr}
|
295
308
|
|
296
309
|
/* See above. */
|
@@ -304,7 +317,12 @@ ARM_FUNC_START(ffi_closure_VFP)
|
|
304
317
|
@ Load values returned in registers.
|
305
318
|
add r2, sp, #8+64 @ load result
|
306
319
|
adr r3, CNAME(ffi_closure_ret)
|
320
|
+
#ifndef __thumb__
|
307
321
|
add pc, r3, r0, lsl #3
|
322
|
+
#else
|
323
|
+
add r3, r3, r0, lsl #3
|
324
|
+
mov pc, r3
|
325
|
+
#endif
|
308
326
|
cfi_endproc
|
309
327
|
UNWIND(.fnend)
|
310
328
|
ARM_FUNC_END(ffi_closure_VFP)
|
@@ -319,40 +337,85 @@ ARM_FUNC_START_LOCAL(ffi_closure_ret)
|
|
319
337
|
cfi_rel_offset(lr, 4)
|
320
338
|
0:
|
321
339
|
E(ARM_TYPE_VFP_S)
|
322
|
-
#ifdef __clang__
|
323
|
-
vldr s0, [r2]
|
324
|
-
#else
|
325
340
|
ldc p10, cr0, [r2] @ vldr s0, [r2]
|
326
|
-
|
327
|
-
ldm sp, {sp,pc}
|
341
|
+
b call_epilogue
|
328
342
|
E(ARM_TYPE_VFP_D)
|
329
|
-
#ifdef __clang__
|
330
|
-
vldr d0, [r2]
|
331
|
-
#else
|
332
343
|
ldc p11, cr0, [r2] @ vldr d0, [r2]
|
333
|
-
|
334
|
-
ldm sp, {sp,pc}
|
344
|
+
b call_epilogue
|
335
345
|
E(ARM_TYPE_VFP_N)
|
336
|
-
#ifdef __clang__
|
337
|
-
vldm r2, {d0-d3}
|
338
|
-
#else
|
339
346
|
ldc p11, cr0, [r2], {8} @ vldm r2, {d0-d3}
|
340
|
-
|
341
|
-
ldm sp, {sp,pc}
|
347
|
+
b call_epilogue
|
342
348
|
E(ARM_TYPE_INT64)
|
343
349
|
ldr r1, [r2, #4]
|
344
350
|
nop
|
345
351
|
E(ARM_TYPE_INT)
|
346
352
|
ldr r0, [r2]
|
347
|
-
|
353
|
+
b call_epilogue
|
348
354
|
E(ARM_TYPE_VOID)
|
349
|
-
|
355
|
+
b call_epilogue
|
350
356
|
nop
|
351
357
|
E(ARM_TYPE_STRUCT)
|
358
|
+
b call_epilogue
|
359
|
+
call_epilogue:
|
360
|
+
#ifndef __thumb__
|
352
361
|
ldm sp, {sp,pc}
|
362
|
+
#else
|
363
|
+
ldm sp, {ip,lr}
|
364
|
+
mov sp, ip
|
365
|
+
bx lr
|
366
|
+
#endif
|
353
367
|
cfi_endproc
|
354
368
|
ARM_FUNC_END(ffi_closure_ret)
|
355
369
|
|
370
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
371
|
+
ARM_FUNC_START(ffi_closure_SYSV_alt)
|
372
|
+
/* See the comments above trampoline_code_table. */
|
373
|
+
ldr ip, [sp, #4] /* Load closure in ip */
|
374
|
+
add sp, sp, 8 /* Restore the stack */
|
375
|
+
b CNAME(ffi_closure_SYSV)
|
376
|
+
ARM_FUNC_END(ffi_closure_SYSV_alt)
|
377
|
+
|
378
|
+
ARM_FUNC_START(ffi_closure_VFP_alt)
|
379
|
+
/* See the comments above trampoline_code_table. */
|
380
|
+
ldr ip, [sp, #4] /* Load closure in ip */
|
381
|
+
add sp, sp, 8 /* Restore the stack */
|
382
|
+
b CNAME(ffi_closure_VFP)
|
383
|
+
ARM_FUNC_END(ffi_closure_VFP_alt)
|
384
|
+
|
385
|
+
/*
|
386
|
+
* Below is the definition of the trampoline code table. Each element in
|
387
|
+
* the code table is a trampoline.
|
388
|
+
*/
|
389
|
+
/*
|
390
|
+
* The trampoline uses register ip (r12). It saves the original value of ip
|
391
|
+
* on the stack.
|
392
|
+
*
|
393
|
+
* The trampoline has two parameters - target code to jump to and data for
|
394
|
+
* the target code. The trampoline extracts the parameters from its parameter
|
395
|
+
* block (see tramp_table_map()). The trampoline saves the data address on
|
396
|
+
* the stack. Finally, it jumps to the target code.
|
397
|
+
*
|
398
|
+
* The target code can choose to:
|
399
|
+
*
|
400
|
+
* - restore the value of ip
|
401
|
+
* - load the data address in a register
|
402
|
+
* - restore the stack pointer to what it was when the trampoline was invoked.
|
403
|
+
*/
|
404
|
+
.align ARM_TRAMP_MAP_SHIFT
|
405
|
+
ARM_FUNC_START(trampoline_code_table)
|
406
|
+
.rept ARM_TRAMP_MAP_SIZE / ARM_TRAMP_SIZE
|
407
|
+
sub sp, sp, #8 /* Make space on the stack */
|
408
|
+
str ip, [sp] /* Save ip on stack */
|
409
|
+
ldr ip, [pc, #4080] /* Copy data into ip */
|
410
|
+
str ip, [sp, #4] /* Save data on stack */
|
411
|
+
ldr pc, [pc, #4076] /* Copy code into PC */
|
412
|
+
.endr
|
413
|
+
ARM_FUNC_END(trampoline_code_table)
|
414
|
+
.align ARM_TRAMP_MAP_SHIFT
|
415
|
+
#endif /* FFI_EXEC_STATIC_TRAMP */
|
416
|
+
|
417
|
+
#endif /* FFI_CLOSURES */
|
418
|
+
|
356
419
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
357
420
|
|
358
421
|
#ifdef __MACH__
|
@@ -368,6 +431,15 @@ ARM_FUNC_START(ffi_closure_trampoline_table_page)
|
|
368
431
|
ARM_FUNC_END(ffi_closure_trampoline_table_page)
|
369
432
|
#endif
|
370
433
|
|
434
|
+
#elif defined(_WIN32)
|
435
|
+
|
436
|
+
ARM_FUNC_START(ffi_arm_trampoline)
|
437
|
+
0: adr ip, 0b
|
438
|
+
stmdb sp!, {r0, ip}
|
439
|
+
ldr pc, 1f
|
440
|
+
1: .long 0
|
441
|
+
ARM_FUNC_END(ffi_arm_trampoline)
|
442
|
+
|
371
443
|
#else
|
372
444
|
|
373
445
|
ARM_FUNC_START(ffi_arm_trampoline)
|
@@ -377,6 +449,7 @@ ARM_FUNC_START(ffi_arm_trampoline)
|
|
377
449
|
ARM_FUNC_END(ffi_arm_trampoline)
|
378
450
|
|
379
451
|
#endif /* FFI_EXEC_TRAMPOLINE_TABLE */
|
452
|
+
#endif /* __arm__ */
|
380
453
|
|
381
454
|
#if defined __ELF__ && defined __linux__
|
382
455
|
.section .note.GNU-stack,"",%progbits
|