ffi 1.1.2 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +456 -0
- data/COPYING +49 -0
- data/Gemfile +21 -0
- data/LICENSE +21 -11
- data/LICENSE.SPECS +22 -0
- data/README.md +137 -0
- data/Rakefile +166 -156
- data/ext/ffi_c/AbstractMemory.c +240 -140
- data/ext/ffi_c/AbstractMemory.h +25 -15
- data/ext/ffi_c/ArrayType.c +78 -29
- data/ext/ffi_c/ArrayType.h +22 -12
- data/ext/ffi_c/Buffer.c +121 -60
- data/ext/ffi_c/Call.c +184 -137
- data/ext/ffi_c/Call.h +46 -22
- data/ext/ffi_c/ClosurePool.c +101 -43
- data/ext/ffi_c/ClosurePool.h +24 -13
- data/ext/ffi_c/DynamicLibrary.c +139 -57
- data/ext/ffi_c/DynamicLibrary.h +70 -12
- data/ext/ffi_c/Function.c +372 -273
- data/ext/ffi_c/Function.h +25 -20
- data/ext/ffi_c/FunctionInfo.c +135 -49
- data/ext/ffi_c/LastError.c +97 -30
- data/ext/ffi_c/LastError.h +21 -12
- data/ext/ffi_c/LongDouble.c +15 -9
- data/ext/ffi_c/LongDouble.h +21 -16
- data/ext/ffi_c/MappedType.c +88 -38
- data/ext/ffi_c/MappedType.h +21 -14
- data/ext/ffi_c/MemoryPointer.c +91 -38
- data/ext/ffi_c/MemoryPointer.h +22 -19
- data/ext/ffi_c/MethodHandle.c +52 -51
- data/ext/ffi_c/MethodHandle.h +24 -14
- data/ext/ffi_c/Platform.c +28 -62
- data/ext/ffi_c/Platform.h +21 -12
- data/ext/ffi_c/Pointer.c +145 -86
- data/ext/ffi_c/Pointer.h +23 -19
- data/ext/ffi_c/Struct.c +363 -163
- data/ext/ffi_c/Struct.h +39 -21
- data/ext/ffi_c/StructByValue.c +72 -37
- data/ext/ffi_c/StructByValue.h +21 -12
- data/ext/ffi_c/StructLayout.c +308 -94
- data/ext/ffi_c/Thread.c +73 -270
- data/ext/ffi_c/Thread.h +32 -35
- data/ext/ffi_c/Type.c +147 -84
- data/ext/ffi_c/Type.h +27 -11
- data/ext/ffi_c/Types.c +40 -24
- data/ext/ffi_c/Types.h +24 -21
- data/ext/ffi_c/Variadic.c +148 -64
- data/ext/ffi_c/compat.h +45 -37
- data/ext/ffi_c/extconf.rb +86 -32
- data/ext/ffi_c/ffi.c +32 -21
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- 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 +84 -0
- data/ext/ffi_c/libffi/.ci/ar-lib +270 -0
- 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/compile +351 -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/.ci/moxie-sim.exp +60 -0
- 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/issue_template.md +10 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +479 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +172 -0
- data/ext/ffi_c/libffi/.gitignore +46 -0
- data/ext/ffi_c/libffi/{ChangeLog → ChangeLog.old} +6366 -3559
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +353 -0
- data/ext/ffi_c/libffi/Makefile.am +131 -170
- data/ext/ffi_c/libffi/Makefile.in +1317 -1010
- data/ext/ffi_c/libffi/README.md +531 -0
- data/ext/ffi_c/libffi/acinclude.m4 +289 -4
- data/ext/ffi_c/libffi/autogen.sh +2 -0
- data/ext/ffi_c/libffi/compile +222 -17
- data/ext/ffi_c/libffi/config.guess +1033 -780
- data/ext/ffi_c/libffi/config.sub +1393 -1206
- data/ext/ffi_c/libffi/configure +16340 -10740
- data/ext/ffi_c/libffi/configure.ac +226 -271
- data/ext/ffi_c/libffi/configure.host +330 -4
- data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
- data/ext/ffi_c/libffi/doc/Makefile.in +818 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +525 -79
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +41 -52
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +312 -0
- data/ext/ffi_c/libffi/include/Makefile.am +3 -3
- data/ext/ffi_c/libffi/include/Makefile.in +201 -79
- data/ext/ffi_c/libffi/include/ffi.h.in +190 -99
- data/ext/ffi_c/libffi/include/ffi_cfi.h +76 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +72 -14
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +231 -210
- data/ext/ffi_c/libffi/libffi.map.in +81 -0
- data/ext/ffi_c/libffi/libffi.pc.in +3 -2
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +997 -0
- data/ext/ffi_c/libffi/libtool-ldflags +106 -0
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +3868 -2068
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +13 -0
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +50 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +47 -25
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +110 -147
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +53 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +75 -19
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +8 -29
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +11 -9
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +104 -52
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +18 -8
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/man/Makefile.am +2 -2
- data/ext/ffi_c/libffi/man/Makefile.in +156 -57
- data/ext/ffi_c/libffi/man/ffi.3 +10 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +6 -4
- data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +73 -0
- data/ext/ffi_c/libffi/missing +153 -314
- 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/{include/ffi.h.vc64 → msvc_build/aarch64/aarch64_include/ffi.h} +151 -67
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
- data/ext/ffi_c/libffi/msvcc.sh +176 -20
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +1142 -0
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +97 -0
- data/ext/ffi_c/libffi/src/aarch64/internal.h +100 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +695 -0
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +335 -98
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +10 -1
- data/ext/ffi_c/libffi/src/alpha/internal.h +23 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +161 -266
- data/ext/ffi_c/libffi/src/arc/arcompact.S +210 -0
- data/ext/ffi_c/libffi/src/arc/ffi.c +443 -0
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +67 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +706 -513
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +32 -8
- data/ext/ffi_c/libffi/src/arm/internal.h +17 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +372 -413
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/bfin/ffi.c +196 -0
- data/ext/ffi_c/libffi/src/bfin/ffitarget.h +43 -0
- data/ext/ffi_c/libffi/src/bfin/sysv.S +179 -0
- data/ext/ffi_c/libffi/src/closures.c +565 -73
- data/ext/ffi_c/libffi/src/cris/ffi.c +10 -7
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +6 -1
- 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/debug.c +8 -3
- data/ext/ffi_c/libffi/src/dlmalloc.c +23 -13
- data/ext/ffi_c/libffi/src/frv/ffi.c +2 -2
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/ia64/ffi.c +47 -13
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +8 -2
- data/ext/ffi_c/libffi/src/ia64/unix.S +28 -3
- data/ext/ffi_c/libffi/src/java_raw_api.c +23 -5
- 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 +624 -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 +32 -15
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/m68k/ffi.c +87 -13
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/m68k/sysv.S +119 -32
- data/ext/ffi_c/libffi/src/m88k/ffi.c +400 -0
- data/ext/ffi_c/libffi/src/m88k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m88k/obsd.S +209 -0
- data/ext/ffi_c/libffi/src/metag/ffi.c +330 -0
- data/ext/ffi_c/libffi/{fficonfig.hw → src/metag/ffitarget.h} +22 -26
- data/ext/ffi_c/libffi/src/metag/sysv.S +311 -0
- data/ext/ffi_c/libffi/src/microblaze/ffi.c +321 -0
- data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/microblaze/sysv.S +302 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +382 -101
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +23 -14
- data/ext/ffi_c/libffi/src/mips/n32.S +321 -89
- data/ext/ffi_c/libffi/src/mips/o32.S +211 -31
- data/ext/ffi_c/libffi/src/moxie/eabi.S +55 -82
- data/ext/ffi_c/libffi/src/moxie/ffi.c +100 -66
- data/ext/ffi_c/libffi/src/moxie/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/ffi.c +304 -0
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/sysv.S +136 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +341 -0
- data/ext/ffi_c/libffi/src/or1k/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/or1k/sysv.S +107 -0
- 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 +28 -12
- 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/aix.S +245 -7
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +253 -4
- data/ext/ffi_c/libffi/src/powerpc/asm.h +2 -2
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +2 -7
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +22 -26
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +105 -1378
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +157 -52
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1153 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +105 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +923 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +110 -45
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +191 -85
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +438 -108
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +138 -68
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +73 -119
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +131 -25
- data/ext/ffi_c/libffi/src/raw_api.c +18 -5
- data/ext/ffi_c/libffi/src/riscv/ffi.c +514 -0
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +69 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +293 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +294 -318
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +9 -1
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +257 -366
- data/ext/ffi_c/libffi/src/sh/ffi.c +4 -3
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/sh64/ffi.c +3 -2
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/sparc/ffi.c +326 -527
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +630 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +20 -7
- data/ext/ffi_c/libffi/src/sparc/internal.h +26 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +364 -234
- data/ext/ffi_c/libffi/src/sparc/v9.S +340 -207
- data/ext/ffi_c/libffi/src/tile/ffi.c +355 -0
- data/ext/ffi_c/libffi/src/tile/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/tile/tile.S +360 -0
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/types.c +48 -19
- data/ext/ffi_c/libffi/src/vax/elfbsd.S +195 -0
- data/ext/ffi_c/libffi/src/vax/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/vax/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +947 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/asmnames.h +30 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +686 -498
- data/ext/ffi_c/libffi/src/x86/ffi64.c +444 -129
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +79 -36
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +361 -0
- data/ext/ffi_c/libffi/src/x86/internal.h +43 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +36 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +1198 -394
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +585 -300
- data/ext/ffi_c/libffi/src/x86/win64.S +244 -458
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +238 -0
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +306 -0
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +57 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +268 -0
- data/ext/ffi_c/libffi/stamp-h.in +1 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +80 -73
- data/ext/ffi_c/libffi/testsuite/Makefile.in +233 -117
- 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 +86 -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 +360 -28
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +22 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1746 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +747 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +28 -6
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +52 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +3 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +15 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +4 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +110 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +6 -16
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +127 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +1 -1
- 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 +9 -10
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +9 -7
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +7 -7
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +7 -6
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +9 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +9 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +9 -8
- 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/uninitialized.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +78 -0
- 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 +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +140 -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/closure_stdcall.c → libffi.closures/closure_simple.c} +13 -16
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +22 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +26 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +28 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +33 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +8 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +25 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +40 -8
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +23 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +17 -4
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +113 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +26 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +33 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +29 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +32 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +28 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +43 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +29 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +18 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +18 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +18 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +24 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +44 -31
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +44 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +22 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +7 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +19 -10
- 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 +14 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +32 -12
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +55 -0
- 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 +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +21 -9
- 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.closures/cls_struct_va1.c +125 -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.closures/cls_uint_va.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +49 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +7 -5
- 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 +41 -40
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +38 -15
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +9 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +19 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +137 -0
- 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 +15 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +15 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +17 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +17 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +17 -6
- 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_large.c +7 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +7 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +6 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +6 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +8 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.closures}/unwindtest.cc +4 -10
- data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.closures}/unwindtest_ffi_call.cc +4 -2
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +71 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +16 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.special/special.exp → libffi.complex/complex.exp} +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +51 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +37 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +19 -0
- data/ext/ffi_c/libffi.bsd.mk +13 -7
- data/ext/ffi_c/libffi.darwin.mk +25 -13
- data/ext/ffi_c/libffi.gnu.mk +4 -3
- data/ext/ffi_c/libffi.mk +11 -6
- data/ext/ffi_c/libffi.vc.mk +1 -1
- data/ext/ffi_c/libffi.vc64.mk +1 -1
- data/ext/ffi_c/rbffi.h +23 -15
- data/ext/ffi_c/rbffi_endian.h +11 -2
- data/ffi.gemspec +42 -0
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +65 -68
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/dynamic_library.rb +118 -0
- data/lib/ffi/enum.rb +166 -25
- data/lib/ffi/errno.rb +21 -11
- data/lib/ffi/ffi.rb +28 -11
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +25 -15
- data/lib/ffi/library.rb +227 -136
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +64 -35
- 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 +175 -0
- 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 +3 -0
- 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-linux/types.conf +77 -77
- data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
- data/lib/ffi/platform/i386-openbsd/types.conf +89 -87
- 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 +104 -0
- data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
- 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 +104 -0
- 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-linux/types.conf +102 -0
- 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 +3 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +93 -63
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -88
- 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 -87
- data/lib/ffi/platform/x86_64-openbsd/types.conf +100 -92
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +52 -0
- data/lib/ffi/platform.rb +91 -34
- data/lib/ffi/pointer.rb +78 -33
- data/lib/ffi/struct.rb +100 -66
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +84 -19
- data/lib/ffi/tools/const_generator.rb +11 -8
- data/lib/ffi/tools/generator.rb +48 -1
- data/lib/ffi/tools/generator_task.rb +13 -16
- data/lib/ffi/tools/struct_generator.rb +6 -5
- data/lib/ffi/tools/types_generator.rb +14 -10
- data/lib/ffi/types.rb +96 -51
- data/lib/ffi/union.rb +23 -12
- data/lib/ffi/variadic.rb +44 -29
- data/lib/ffi/version.rb +3 -0
- data/lib/ffi.rb +20 -8
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +8 -0
- data/samples/getpid.rb +8 -0
- data/samples/gettimeofday.rb +18 -0
- data/samples/hello.rb +8 -0
- data/samples/hello_ractor.rb +11 -0
- data/samples/inotify.rb +60 -0
- data/samples/pty.rb +75 -0
- data/samples/qsort.rb +20 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +165 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +508 -268
- metadata.gz.sig +1 -0
- data/History.txt +0 -1
- data/README.rdoc +0 -102
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/Ffi_c.iml +0 -12
- data/ext/ffi_c/StructByReference.c +0 -158
- 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/libffi/Makefile.vc +0 -141
- data/ext/ffi_c/libffi/Makefile.vc64 +0 -141
- data/ext/ffi_c/libffi/README +0 -342
- data/ext/ffi_c/libffi/aclocal.m4 +0 -1873
- data/ext/ffi_c/libffi/build-ios.sh +0 -67
- data/ext/ffi_c/libffi/depcomp +0 -630
- data/ext/ffi_c/libffi/doc/libffi.info +0 -593
- data/ext/ffi_c/libffi/doc/stamp-vti +0 -4
- data/ext/ffi_c/libffi/include/ffi.h.vc +0 -427
- data/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 +0 -76
- data/ext/ffi_c/libffi/m4/libtool.m4 +0 -7831
- data/ext/ffi_c/libffi/m4/ltoptions.m4 +0 -369
- data/ext/ffi_c/libffi/m4/ltsugar.m4 +0 -123
- data/ext/ffi_c/libffi/m4/ltversion.m4 +0 -23
- data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +0 -98
- data/ext/ffi_c/libffi/mdate-sh +0 -201
- data/ext/ffi_c/libffi/src/arm/gentramp.sh +0 -118
- data/ext/ffi_c/libffi/src/arm/trampoline.S +0 -4450
- data/ext/ffi_c/libffi/src/x86/darwin.S +0 -444
- data/ext/ffi_c/libffi/src/x86/darwin64.S +0 -416
- data/ext/ffi_c/libffi/src/x86/freebsd.S +0 -458
- data/ext/ffi_c/libffi/src/x86/win32.S +0 -1065
- data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +0 -300
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +0 -96
- data/ext/ffi_c/libffi/texinfo.tex +0 -7210
- data/ext/ffi_c/win32/stdint.h +0 -199
- data/gen/Rakefile +0 -30
- data/lib/Lib.iml +0 -13
- data/spec/ffi/Ffi.iml +0 -12
- data/spec/ffi/async_callback_spec.rb +0 -46
- data/spec/ffi/bool_spec.rb +0 -40
- data/spec/ffi/buffer_spec.rb +0 -215
- data/spec/ffi/callback_spec.rb +0 -668
- data/spec/ffi/custom_param_type.rb +0 -47
- data/spec/ffi/custom_type_spec.rb +0 -85
- data/spec/ffi/dup_spec.rb +0 -65
- data/spec/ffi/enum_spec.rb +0 -227
- data/spec/ffi/errno_spec.rb +0 -29
- data/spec/ffi/ffi_spec.rb +0 -40
- data/spec/ffi/function_spec.rb +0 -87
- data/spec/ffi/library_spec.rb +0 -208
- data/spec/ffi/long_double.rb +0 -41
- data/spec/ffi/managed_struct_spec.rb +0 -72
- data/spec/ffi/number_spec.rb +0 -247
- data/spec/ffi/pointer_spec.rb +0 -214
- data/spec/ffi/rbx/attach_function_spec.rb +0 -28
- data/spec/ffi/rbx/memory_pointer_spec.rb +0 -111
- data/spec/ffi/rbx/spec_helper.rb +0 -1
- data/spec/ffi/rbx/struct_spec.rb +0 -13
- data/spec/ffi/spec_helper.rb +0 -35
- data/spec/ffi/string_spec.rb +0 -119
- data/spec/ffi/strptr_spec.rb +0 -61
- data/spec/ffi/struct_callback_spec.rb +0 -80
- data/spec/ffi/struct_initialize_spec.rb +0 -46
- data/spec/ffi/struct_packed_spec.rb +0 -62
- data/spec/ffi/struct_spec.rb +0 -719
- data/spec/ffi/typedef_spec.rb +0 -89
- data/spec/ffi/union_spec.rb +0 -76
- data/spec/ffi/variadic_spec.rb +0 -103
- data/spec/spec.opts +0 -4
- data/tasks/ann.rake +0 -80
- data/tasks/extension.rake +0 -32
- data/tasks/gem.rake +0 -199
- data/tasks/git.rake +0 -41
- data/tasks/notes.rake +0 -27
- data/tasks/post_load.rake +0 -34
- data/tasks/rdoc.rake +0 -50
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -301
- data/tasks/spec.rake +0 -54
- data/tasks/svn.rake +0 -47
- data/tasks/test.rake +0 -40
- data/tasks/yard.rake +0 -11
- 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}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/lib/ffi/platform/{i486-gnu → i386-gnu}/types.conf +84 -84
@@ -1,6 +1,7 @@
|
|
1
1
|
/* -----------------------------------------------------------------*-C-*-
|
2
|
-
libffi @VERSION@
|
3
|
-
|
2
|
+
libffi @VERSION@
|
3
|
+
- Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green
|
4
|
+
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
4
5
|
|
5
6
|
Permission is hereby granted, free of charge, to any person
|
6
7
|
obtaining a copy of this software and associated documentation
|
@@ -25,23 +26,14 @@
|
|
25
26
|
----------------------------------------------------------------------- */
|
26
27
|
|
27
28
|
/* -------------------------------------------------------------------
|
28
|
-
|
29
|
+
Most of the API is documented in doc/libffi.texi.
|
29
30
|
|
30
|
-
The raw API is designed to bypass some of the argument packing
|
31
|
-
|
31
|
+
The raw API is designed to bypass some of the argument packing and
|
32
|
+
unpacking on architectures for which it can be avoided. Routines
|
33
|
+
are provided to emulate the raw API if the underlying platform
|
34
|
+
doesn't allow faster implementation.
|
32
35
|
|
33
|
-
|
34
|
-
inside a C function pointer, so that they can be called as C functions,
|
35
|
-
with no understanding on the client side that they are interpreted.
|
36
|
-
It can also be used in other cases in which it is necessary to package
|
37
|
-
up a user specified parameter and a function pointer as a single
|
38
|
-
function pointer.
|
39
|
-
|
40
|
-
The closure API must be implemented in order to get its functionality,
|
41
|
-
e.g. for use by gij. Routines are provided to emulate the raw API
|
42
|
-
if the underlying platform doesn't allow faster implementation.
|
43
|
-
|
44
|
-
More details on the raw and cloure API can be found in:
|
36
|
+
More details on the raw API can be found in:
|
45
37
|
|
46
38
|
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
|
47
39
|
|
@@ -64,11 +56,36 @@ extern "C" {
|
|
64
56
|
|
65
57
|
/* ---- System configuration information --------------------------------- */
|
66
58
|
|
59
|
+
/* If these change, update src/mips/ffitarget.h. */
|
60
|
+
#define FFI_TYPE_VOID 0
|
61
|
+
#define FFI_TYPE_INT 1
|
62
|
+
#define FFI_TYPE_FLOAT 2
|
63
|
+
#define FFI_TYPE_DOUBLE 3
|
64
|
+
#if @HAVE_LONG_DOUBLE@
|
65
|
+
#define FFI_TYPE_LONGDOUBLE 4
|
66
|
+
#else
|
67
|
+
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
68
|
+
#endif
|
69
|
+
#define FFI_TYPE_UINT8 5
|
70
|
+
#define FFI_TYPE_SINT8 6
|
71
|
+
#define FFI_TYPE_UINT16 7
|
72
|
+
#define FFI_TYPE_SINT16 8
|
73
|
+
#define FFI_TYPE_UINT32 9
|
74
|
+
#define FFI_TYPE_SINT32 10
|
75
|
+
#define FFI_TYPE_UINT64 11
|
76
|
+
#define FFI_TYPE_SINT64 12
|
77
|
+
#define FFI_TYPE_STRUCT 13
|
78
|
+
#define FFI_TYPE_POINTER 14
|
79
|
+
#define FFI_TYPE_COMPLEX 15
|
80
|
+
|
81
|
+
/* This should always refer to the last type code (for sanity checks). */
|
82
|
+
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
|
83
|
+
|
67
84
|
#include <ffitarget.h>
|
68
85
|
|
69
86
|
#ifndef LIBFFI_ASM
|
70
87
|
|
71
|
-
#
|
88
|
+
#if defined(_MSC_VER) && !defined(__clang__)
|
72
89
|
#define __attribute__(X)
|
73
90
|
#endif
|
74
91
|
|
@@ -106,8 +123,8 @@ extern "C" {
|
|
106
123
|
# endif
|
107
124
|
#endif
|
108
125
|
|
109
|
-
/* The closure code assumes that this works on pointers, i.e. a size_t
|
110
|
-
|
126
|
+
/* The closure code assumes that this works on pointers, i.e. a size_t
|
127
|
+
can hold a pointer. */
|
111
128
|
|
112
129
|
typedef struct _ffi_type
|
113
130
|
{
|
@@ -117,6 +134,30 @@ typedef struct _ffi_type
|
|
117
134
|
struct _ffi_type **elements;
|
118
135
|
} ffi_type;
|
119
136
|
|
137
|
+
/* Need minimal decorations for DLLs to work on Windows. GCC has
|
138
|
+
autoimport and autoexport. Always mark externally visible symbols
|
139
|
+
as dllimport for MSVC clients, even if it means an extra indirection
|
140
|
+
when using the static version of the library.
|
141
|
+
Besides, as a workaround, they can define FFI_BUILDING if they
|
142
|
+
*know* they are going to link with the static library. */
|
143
|
+
#if defined _MSC_VER && !defined(FFI_STATIC_BUILD)
|
144
|
+
# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */
|
145
|
+
# define FFI_API __declspec(dllexport)
|
146
|
+
# else /* Importing libffi.DLL */
|
147
|
+
# define FFI_API __declspec(dllimport)
|
148
|
+
# endif
|
149
|
+
#else
|
150
|
+
# define FFI_API
|
151
|
+
#endif
|
152
|
+
|
153
|
+
/* The externally visible type declarations also need the MSVC DLL
|
154
|
+
decorations, or they will not be exported from the object file. */
|
155
|
+
#if defined LIBFFI_HIDE_BASIC_TYPES
|
156
|
+
# define FFI_EXTERN FFI_API
|
157
|
+
#else
|
158
|
+
# define FFI_EXTERN extern FFI_API
|
159
|
+
#endif
|
160
|
+
|
120
161
|
#ifndef LIBFFI_HIDE_BASIC_TYPES
|
121
162
|
#if SCHAR_MAX == 127
|
122
163
|
# define ffi_type_uchar ffi_type_uint8
|
@@ -166,35 +207,35 @@ typedef struct _ffi_type
|
|
166
207
|
#error "long size not supported"
|
167
208
|
#endif
|
168
209
|
|
169
|
-
/* These are defined in types.c
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
210
|
+
/* These are defined in types.c. */
|
211
|
+
FFI_EXTERN ffi_type ffi_type_void;
|
212
|
+
FFI_EXTERN ffi_type ffi_type_uint8;
|
213
|
+
FFI_EXTERN ffi_type ffi_type_sint8;
|
214
|
+
FFI_EXTERN ffi_type ffi_type_uint16;
|
215
|
+
FFI_EXTERN ffi_type ffi_type_sint16;
|
216
|
+
FFI_EXTERN ffi_type ffi_type_uint32;
|
217
|
+
FFI_EXTERN ffi_type ffi_type_sint32;
|
218
|
+
FFI_EXTERN ffi_type ffi_type_uint64;
|
219
|
+
FFI_EXTERN ffi_type ffi_type_sint64;
|
220
|
+
FFI_EXTERN ffi_type ffi_type_float;
|
221
|
+
FFI_EXTERN ffi_type ffi_type_double;
|
222
|
+
FFI_EXTERN ffi_type ffi_type_pointer;
|
223
|
+
FFI_EXTERN ffi_type ffi_type_longdouble;
|
224
|
+
|
225
|
+
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
|
226
|
+
FFI_EXTERN ffi_type ffi_type_complex_float;
|
227
|
+
FFI_EXTERN ffi_type ffi_type_complex_double;
|
228
|
+
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
|
187
229
|
#endif
|
188
230
|
#endif /* LIBFFI_HIDE_BASIC_TYPES */
|
189
231
|
|
190
232
|
typedef enum {
|
191
233
|
FFI_OK = 0,
|
192
234
|
FFI_BAD_TYPEDEF,
|
193
|
-
FFI_BAD_ABI
|
235
|
+
FFI_BAD_ABI,
|
236
|
+
FFI_BAD_ARGTYPE
|
194
237
|
} ffi_status;
|
195
238
|
|
196
|
-
typedef unsigned FFI_TYPE;
|
197
|
-
|
198
239
|
typedef struct {
|
199
240
|
ffi_abi abi;
|
200
241
|
unsigned nargs;
|
@@ -244,27 +285,34 @@ typedef ffi_raw ffi_java_raw;
|
|
244
285
|
#endif
|
245
286
|
|
246
287
|
|
288
|
+
FFI_API
|
247
289
|
void ffi_raw_call (ffi_cif *cif,
|
248
290
|
void (*fn)(void),
|
249
291
|
void *rvalue,
|
250
292
|
ffi_raw *avalue);
|
251
293
|
|
252
|
-
void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
253
|
-
void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
254
|
-
size_t ffi_raw_size (ffi_cif *cif);
|
294
|
+
FFI_API void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
295
|
+
FFI_API void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
296
|
+
FFI_API size_t ffi_raw_size (ffi_cif *cif);
|
255
297
|
|
256
|
-
/* This is analogous to the raw API, except it uses Java parameter
|
257
|
-
|
258
|
-
|
298
|
+
/* This is analogous to the raw API, except it uses Java parameter
|
299
|
+
packing, even on 64-bit machines. I.e. on 64-bit machines longs
|
300
|
+
and doubles are followed by an empty 64-bit word. */
|
259
301
|
|
302
|
+
#if !FFI_NATIVE_RAW_API
|
303
|
+
FFI_API
|
260
304
|
void ffi_java_raw_call (ffi_cif *cif,
|
261
305
|
void (*fn)(void),
|
262
306
|
void *rvalue,
|
263
|
-
ffi_java_raw *avalue);
|
307
|
+
ffi_java_raw *avalue) __attribute__((deprecated));
|
308
|
+
#endif
|
264
309
|
|
265
|
-
|
266
|
-
void
|
267
|
-
|
310
|
+
FFI_API
|
311
|
+
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
|
312
|
+
FFI_API
|
313
|
+
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) __attribute__((deprecated));
|
314
|
+
FFI_API
|
315
|
+
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
|
268
316
|
|
269
317
|
/* ---- Definitions for closures ----------------------------------------- */
|
270
318
|
|
@@ -274,48 +322,72 @@ size_t ffi_java_raw_size (ffi_cif *cif);
|
|
274
322
|
__declspec(align(8))
|
275
323
|
#endif
|
276
324
|
typedef struct {
|
277
|
-
|
325
|
+
#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
326
|
+
void *trampoline_table;
|
327
|
+
void *trampoline_table_entry;
|
328
|
+
#else
|
329
|
+
union {
|
330
|
+
char tramp[FFI_TRAMPOLINE_SIZE];
|
331
|
+
void *ftramp;
|
332
|
+
};
|
333
|
+
#endif
|
278
334
|
ffi_cif *cif;
|
279
335
|
void (*fun)(ffi_cif*,void*,void**,void*);
|
280
336
|
void *user_data;
|
337
|
+
#if defined(_MSC_VER) && defined(_M_IX86)
|
338
|
+
void *padding;
|
339
|
+
#endif
|
340
|
+
} ffi_closure
|
281
341
|
#ifdef __GNUC__
|
282
|
-
|
283
|
-
#
|
284
|
-
|
342
|
+
__attribute__((aligned (8)))
|
343
|
+
#endif
|
344
|
+
;
|
345
|
+
|
346
|
+
#ifndef __GNUC__
|
285
347
|
# ifdef __sgi
|
286
348
|
# pragma pack 0
|
287
349
|
# endif
|
288
350
|
#endif
|
289
351
|
|
290
|
-
void *ffi_closure_alloc (size_t size, void **code);
|
291
|
-
void ffi_closure_free (void *);
|
352
|
+
FFI_API void *ffi_closure_alloc (size_t size, void **code);
|
353
|
+
FFI_API void ffi_closure_free (void *);
|
292
354
|
|
293
|
-
ffi_status
|
355
|
+
FFI_API ffi_status
|
294
356
|
ffi_prep_closure (ffi_closure*,
|
295
357
|
ffi_cif *,
|
296
358
|
void (*fun)(ffi_cif*,void*,void**,void*),
|
297
|
-
void *user_data)
|
359
|
+
void *user_data)
|
360
|
+
#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 405)
|
361
|
+
__attribute__((deprecated ("use ffi_prep_closure_loc instead")))
|
362
|
+
#elif defined(__GNUC__) && __GNUC__ >= 3
|
363
|
+
__attribute__((deprecated))
|
364
|
+
#endif
|
365
|
+
;
|
298
366
|
|
299
|
-
ffi_status
|
367
|
+
FFI_API ffi_status
|
300
368
|
ffi_prep_closure_loc (ffi_closure*,
|
301
369
|
ffi_cif *,
|
302
370
|
void (*fun)(ffi_cif*,void*,void**,void*),
|
303
371
|
void *user_data,
|
304
|
-
void*codeloc);
|
372
|
+
void *codeloc);
|
305
373
|
|
306
374
|
#ifdef __sgi
|
307
375
|
# pragma pack 8
|
308
376
|
#endif
|
309
377
|
typedef struct {
|
378
|
+
#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
379
|
+
void *trampoline_table;
|
380
|
+
void *trampoline_table_entry;
|
381
|
+
#else
|
310
382
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
311
|
-
|
383
|
+
#endif
|
312
384
|
ffi_cif *cif;
|
313
385
|
|
314
386
|
#if !FFI_NATIVE_RAW_API
|
315
387
|
|
316
|
-
/*
|
317
|
-
as a regular closure. We use this to install an intermediate
|
318
|
-
handler to do the
|
388
|
+
/* If this is enabled, then a raw closure has the same layout
|
389
|
+
as a regular closure. We use this to install an intermediate
|
390
|
+
handler to do the translation, void** -> ffi_raw*. */
|
319
391
|
|
320
392
|
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
321
393
|
void *this_closure;
|
@@ -328,15 +400,20 @@ typedef struct {
|
|
328
400
|
} ffi_raw_closure;
|
329
401
|
|
330
402
|
typedef struct {
|
403
|
+
#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
404
|
+
void *trampoline_table;
|
405
|
+
void *trampoline_table_entry;
|
406
|
+
#else
|
331
407
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
408
|
+
#endif
|
332
409
|
|
333
410
|
ffi_cif *cif;
|
334
411
|
|
335
412
|
#if !FFI_NATIVE_RAW_API
|
336
413
|
|
337
|
-
/*
|
338
|
-
as a regular closure. We use this to install an intermediate
|
339
|
-
handler to do the
|
414
|
+
/* If this is enabled, then a raw closure has the same layout
|
415
|
+
as a regular closure. We use this to install an intermediate
|
416
|
+
handler to do the translation, void** -> ffi_raw*. */
|
340
417
|
|
341
418
|
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
342
419
|
void *this_closure;
|
@@ -348,78 +425,92 @@ typedef struct {
|
|
348
425
|
|
349
426
|
} ffi_java_raw_closure;
|
350
427
|
|
351
|
-
ffi_status
|
428
|
+
FFI_API ffi_status
|
352
429
|
ffi_prep_raw_closure (ffi_raw_closure*,
|
353
430
|
ffi_cif *cif,
|
354
431
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
355
432
|
void *user_data);
|
356
433
|
|
357
|
-
ffi_status
|
434
|
+
FFI_API ffi_status
|
358
435
|
ffi_prep_raw_closure_loc (ffi_raw_closure*,
|
359
436
|
ffi_cif *cif,
|
360
437
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
361
438
|
void *user_data,
|
362
439
|
void *codeloc);
|
363
440
|
|
364
|
-
|
441
|
+
#if !FFI_NATIVE_RAW_API
|
442
|
+
FFI_API ffi_status
|
365
443
|
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
|
366
444
|
ffi_cif *cif,
|
367
445
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
368
|
-
void *user_data);
|
446
|
+
void *user_data) __attribute__((deprecated));
|
369
447
|
|
370
|
-
ffi_status
|
448
|
+
FFI_API ffi_status
|
371
449
|
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
|
372
450
|
ffi_cif *cif,
|
373
451
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
374
452
|
void *user_data,
|
375
|
-
void *codeloc);
|
453
|
+
void *codeloc) __attribute__((deprecated));
|
454
|
+
#endif
|
376
455
|
|
377
456
|
#endif /* FFI_CLOSURES */
|
378
457
|
|
458
|
+
#ifdef FFI_GO_CLOSURES
|
459
|
+
|
460
|
+
typedef struct {
|
461
|
+
void *tramp;
|
462
|
+
ffi_cif *cif;
|
463
|
+
void (*fun)(ffi_cif*,void*,void**,void*);
|
464
|
+
} ffi_go_closure;
|
465
|
+
|
466
|
+
FFI_API ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *,
|
467
|
+
void (*fun)(ffi_cif*,void*,void**,void*));
|
468
|
+
|
469
|
+
FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
|
470
|
+
void **avalue, void *closure);
|
471
|
+
|
472
|
+
#endif /* FFI_GO_CLOSURES */
|
473
|
+
|
379
474
|
/* ---- Public interface definition -------------------------------------- */
|
380
475
|
|
476
|
+
FFI_API
|
381
477
|
ffi_status ffi_prep_cif(ffi_cif *cif,
|
382
478
|
ffi_abi abi,
|
383
479
|
unsigned int nargs,
|
384
480
|
ffi_type *rtype,
|
385
481
|
ffi_type **atypes);
|
386
482
|
|
483
|
+
FFI_API
|
484
|
+
ffi_status ffi_prep_cif_var(ffi_cif *cif,
|
485
|
+
ffi_abi abi,
|
486
|
+
unsigned int nfixedargs,
|
487
|
+
unsigned int ntotalargs,
|
488
|
+
ffi_type *rtype,
|
489
|
+
ffi_type **atypes);
|
490
|
+
|
491
|
+
FFI_API
|
387
492
|
void ffi_call(ffi_cif *cif,
|
388
493
|
void (*fn)(void),
|
389
494
|
void *rvalue,
|
390
495
|
void **avalue);
|
391
496
|
|
392
|
-
|
497
|
+
FFI_API
|
498
|
+
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
|
499
|
+
size_t *offsets);
|
500
|
+
|
501
|
+
/* Convert between closure and function pointers. */
|
502
|
+
#if defined(PA_LINUX) || defined(PA_HPUX)
|
503
|
+
#define FFI_FN(f) ((void (*)(void))((unsigned int)(f) | 2))
|
504
|
+
#define FFI_CL(f) ((void *)((unsigned int)(f) & ~3))
|
505
|
+
#else
|
393
506
|
#define FFI_FN(f) ((void (*)(void))f)
|
507
|
+
#define FFI_CL(f) ((void *)(f))
|
508
|
+
#endif
|
394
509
|
|
395
510
|
/* ---- Definitions shared with assembly code ---------------------------- */
|
396
511
|
|
397
512
|
#endif
|
398
513
|
|
399
|
-
/* If these change, update src/mips/ffitarget.h. */
|
400
|
-
#define FFI_TYPE_VOID 0
|
401
|
-
#define FFI_TYPE_INT 1
|
402
|
-
#define FFI_TYPE_FLOAT 2
|
403
|
-
#define FFI_TYPE_DOUBLE 3
|
404
|
-
#if @HAVE_LONG_DOUBLE@
|
405
|
-
#define FFI_TYPE_LONGDOUBLE 4
|
406
|
-
#else
|
407
|
-
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
408
|
-
#endif
|
409
|
-
#define FFI_TYPE_UINT8 5
|
410
|
-
#define FFI_TYPE_SINT8 6
|
411
|
-
#define FFI_TYPE_UINT16 7
|
412
|
-
#define FFI_TYPE_SINT16 8
|
413
|
-
#define FFI_TYPE_UINT32 9
|
414
|
-
#define FFI_TYPE_SINT32 10
|
415
|
-
#define FFI_TYPE_UINT64 11
|
416
|
-
#define FFI_TYPE_SINT64 12
|
417
|
-
#define FFI_TYPE_STRUCT 13
|
418
|
-
#define FFI_TYPE_POINTER 14
|
419
|
-
|
420
|
-
/* This should always refer to the last type code (for sanity checks) */
|
421
|
-
#define FFI_TYPE_LAST FFI_TYPE_POINTER
|
422
|
-
|
423
514
|
#ifdef __cplusplus
|
424
515
|
}
|
425
516
|
#endif
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
ffi_cfi.h - Copyright (c) 2014 Red Hat, Inc.
|
3
|
+
|
4
|
+
Conditionally assemble cfi directives. Only necessary for building libffi.
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
7
|
+
obtaining a copy of this software and associated documentation
|
8
|
+
files (the ``Software''), to deal in the Software without
|
9
|
+
restriction, including without limitation the rights to use, copy,
|
10
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies
|
11
|
+
of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
24
|
+
DEALINGS IN THE SOFTWARE.
|
25
|
+
|
26
|
+
----------------------------------------------------------------------- */
|
27
|
+
|
28
|
+
#ifndef FFI_CFI_H
|
29
|
+
#define FFI_CFI_H
|
30
|
+
|
31
|
+
#ifdef HAVE_AS_CFI_PSEUDO_OP
|
32
|
+
|
33
|
+
# define cfi_startproc .cfi_startproc
|
34
|
+
# define cfi_endproc .cfi_endproc
|
35
|
+
# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
|
36
|
+
# define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
|
37
|
+
# define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
|
38
|
+
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
39
|
+
# define cfi_offset(reg, off) .cfi_offset reg, off
|
40
|
+
# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
|
41
|
+
# define cfi_register(r1, r2) .cfi_register r1, r2
|
42
|
+
# define cfi_return_column(reg) .cfi_return_column reg
|
43
|
+
# define cfi_restore(reg) .cfi_restore reg
|
44
|
+
# define cfi_same_value(reg) .cfi_same_value reg
|
45
|
+
# define cfi_undefined(reg) .cfi_undefined reg
|
46
|
+
# define cfi_remember_state .cfi_remember_state
|
47
|
+
# define cfi_restore_state .cfi_restore_state
|
48
|
+
# define cfi_window_save .cfi_window_save
|
49
|
+
# define cfi_personality(enc, exp) .cfi_personality enc, exp
|
50
|
+
# define cfi_lsda(enc, exp) .cfi_lsda enc, exp
|
51
|
+
# define cfi_escape(...) .cfi_escape __VA_ARGS__
|
52
|
+
|
53
|
+
#else
|
54
|
+
|
55
|
+
# define cfi_startproc
|
56
|
+
# define cfi_endproc
|
57
|
+
# define cfi_def_cfa(reg, off)
|
58
|
+
# define cfi_def_cfa_register(reg)
|
59
|
+
# define cfi_def_cfa_offset(off)
|
60
|
+
# define cfi_adjust_cfa_offset(off)
|
61
|
+
# define cfi_offset(reg, off)
|
62
|
+
# define cfi_rel_offset(reg, off)
|
63
|
+
# define cfi_register(r1, r2)
|
64
|
+
# define cfi_return_column(reg)
|
65
|
+
# define cfi_restore(reg)
|
66
|
+
# define cfi_same_value(reg)
|
67
|
+
# define cfi_undefined(reg)
|
68
|
+
# define cfi_remember_state
|
69
|
+
# define cfi_restore_state
|
70
|
+
# define cfi_window_save
|
71
|
+
# define cfi_personality(enc, exp)
|
72
|
+
# define cfi_lsda(enc, exp)
|
73
|
+
# define cfi_escape(...)
|
74
|
+
|
75
|
+
#endif /* HAVE_AS_CFI_PSEUDO_OP */
|
76
|
+
#endif /* FFI_CFI_H */
|
@@ -1,10 +1,31 @@
|
|
1
1
|
/* -----------------------------------------------------------------------
|
2
|
-
ffi_common.h - Copyright (C) 2011 Anthony Green
|
2
|
+
ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green
|
3
3
|
Copyright (C) 2007 Free Software Foundation, Inc
|
4
4
|
Copyright (c) 1996 Red Hat, Inc.
|
5
5
|
|
6
6
|
Common internal definitions and macros. Only necessary for building
|
7
7
|
libffi.
|
8
|
+
|
9
|
+
Permission is hereby granted, free of charge, to any person
|
10
|
+
obtaining a copy of this software and associated documentation
|
11
|
+
files (the ``Software''), to deal in the Software without
|
12
|
+
restriction, including without limitation the rights to use, copy,
|
13
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies
|
14
|
+
of the Software, and to permit persons to whom the Software is
|
15
|
+
furnished to do so, subject to the following conditions:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be
|
18
|
+
included in all copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
27
|
+
DEALINGS IN THE SOFTWARE.
|
28
|
+
|
8
29
|
----------------------------------------------------------------------- */
|
9
30
|
|
10
31
|
#ifndef FFI_COMMON_H
|
@@ -19,28 +40,34 @@ extern "C" {
|
|
19
40
|
/* Do not move this. Some versions of AIX are very picky about where
|
20
41
|
this is positioned. */
|
21
42
|
#ifdef __GNUC__
|
22
|
-
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
43
|
+
# if HAVE_ALLOCA_H
|
44
|
+
# include <alloca.h>
|
45
|
+
# else
|
46
|
+
/* mingw64 defines this already in malloc.h. */
|
47
|
+
# ifndef alloca
|
48
|
+
# define alloca __builtin_alloca
|
49
|
+
# endif
|
50
|
+
# endif
|
26
51
|
# define MAYBE_UNUSED __attribute__((__unused__))
|
52
|
+
# define NORETURN __attribute__((__noreturn__))
|
27
53
|
#else
|
28
54
|
# define MAYBE_UNUSED
|
55
|
+
# define NORETURN
|
29
56
|
# if HAVE_ALLOCA_H
|
30
57
|
# include <alloca.h>
|
31
58
|
# else
|
32
59
|
# ifdef _AIX
|
33
|
-
|
60
|
+
# pragma alloca
|
34
61
|
# else
|
35
62
|
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
36
63
|
# ifdef _MSC_VER
|
37
64
|
# define alloca _alloca
|
38
65
|
# else
|
39
66
|
char *alloca ();
|
40
|
-
# endif
|
41
67
|
# endif
|
42
68
|
# endif
|
43
69
|
# endif
|
70
|
+
# endif
|
44
71
|
#endif
|
45
72
|
|
46
73
|
/* Check for the existence of memcpy. */
|
@@ -57,9 +84,9 @@ char *alloca ();
|
|
57
84
|
#endif
|
58
85
|
|
59
86
|
#ifdef FFI_DEBUG
|
60
|
-
void ffi_assert(char *expr, char *file, int line);
|
87
|
+
NORETURN void ffi_assert(const char *expr, const char *file, int line);
|
61
88
|
void ffi_stop_here(void);
|
62
|
-
void ffi_type_test(ffi_type *a, char *file, int line);
|
89
|
+
void ffi_type_test(ffi_type *a, const char *file, int line);
|
63
90
|
|
64
91
|
#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
|
65
92
|
#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
|
@@ -70,11 +97,42 @@ void ffi_type_test(ffi_type *a, char *file, int line);
|
|
70
97
|
#define FFI_ASSERT_VALID_TYPE(x)
|
71
98
|
#endif
|
72
99
|
|
73
|
-
|
74
|
-
#define
|
100
|
+
/* v cast to size_t and aligned up to a multiple of a */
|
101
|
+
#define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
|
102
|
+
/* v cast to size_t and aligned down to a multiple of a */
|
103
|
+
#define FFI_ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
|
75
104
|
|
76
105
|
/* Perform machine dependent cif processing */
|
77
106
|
ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
|
107
|
+
ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
|
108
|
+
unsigned int nfixedargs, unsigned int ntotalargs);
|
109
|
+
|
110
|
+
|
111
|
+
#if HAVE_LONG_DOUBLE_VARIANT
|
112
|
+
/* Used to adjust size/alignment of ffi types. */
|
113
|
+
void ffi_prep_types (ffi_abi abi);
|
114
|
+
#endif
|
115
|
+
|
116
|
+
/* Used internally, but overridden by some architectures */
|
117
|
+
ffi_status ffi_prep_cif_core(ffi_cif *cif,
|
118
|
+
ffi_abi abi,
|
119
|
+
unsigned int isvariadic,
|
120
|
+
unsigned int nfixedargs,
|
121
|
+
unsigned int ntotalargs,
|
122
|
+
ffi_type *rtype,
|
123
|
+
ffi_type **atypes);
|
124
|
+
|
125
|
+
/* Translate a data pointer to a code pointer. Needed for closures on
|
126
|
+
some targets. */
|
127
|
+
void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;
|
128
|
+
|
129
|
+
/* The arch code calls this to determine if a given closure has a
|
130
|
+
static trampoline. */
|
131
|
+
int ffi_tramp_is_present (void *closure) FFI_HIDDEN;
|
132
|
+
|
133
|
+
/* Return a file descriptor of a temporary zero-sized file in a
|
134
|
+
writable and executable filesystem. */
|
135
|
+
int open_temp_exec_file(void) FFI_HIDDEN;
|
78
136
|
|
79
137
|
/* Extended cif, used in callback from assembly routine */
|
80
138
|
typedef struct
|
@@ -85,7 +143,7 @@ typedef struct
|
|
85
143
|
} extended_cif;
|
86
144
|
|
87
145
|
/* Terse sized type definitions. */
|
88
|
-
#if defined(_MSC_VER) || defined(__sgi)
|
146
|
+
#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C)
|
89
147
|
typedef unsigned char UINT8;
|
90
148
|
typedef signed char SINT8;
|
91
149
|
typedef unsigned short UINT16;
|
@@ -116,8 +174,8 @@ typedef float FLOAT32;
|
|
116
174
|
#ifndef __GNUC__
|
117
175
|
#define __builtin_expect(x, expected_value) (x)
|
118
176
|
#endif
|
119
|
-
#define LIKELY(x) __builtin_expect((x),1)
|
120
|
-
#define UNLIKELY(x) __builtin_expect((x),
|
177
|
+
#define LIKELY(x) __builtin_expect(!!(x),1)
|
178
|
+
#define UNLIKELY(x) __builtin_expect((x)!=0,0)
|
121
179
|
|
122
180
|
#ifdef __cplusplus
|
123
181
|
}
|