ffi 1.15.5 → 1.17.0
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 +118 -0
- data/Gemfile +10 -3
- data/README.md +4 -3
- data/Rakefile +25 -10
- data/ext/ffi_c/AbstractMemory.c +99 -74
- data/ext/ffi_c/AbstractMemory.h +3 -2
- data/ext/ffi_c/ArrayType.c +51 -15
- data/ext/ffi_c/ArrayType.h +1 -0
- data/ext/ffi_c/Buffer.c +90 -33
- data/ext/ffi_c/Call.c +29 -12
- data/ext/ffi_c/Call.h +3 -2
- data/ext/ffi_c/DynamicLibrary.c +90 -27
- data/ext/ffi_c/Function.c +244 -98
- data/ext/ffi_c/Function.h +1 -0
- data/ext/ffi_c/FunctionInfo.c +81 -25
- data/ext/ffi_c/LastError.c +29 -11
- data/ext/ffi_c/MappedType.c +66 -23
- data/ext/ffi_c/MappedType.h +0 -2
- data/ext/ffi_c/MemoryPointer.c +36 -9
- data/ext/ffi_c/MethodHandle.c +3 -1
- data/ext/ffi_c/Pointer.c +82 -40
- data/ext/ffi_c/Pointer.h +1 -0
- data/ext/ffi_c/Struct.c +166 -84
- data/ext/ffi_c/Struct.h +7 -4
- data/ext/ffi_c/StructByValue.c +48 -16
- data/ext/ffi_c/StructLayout.c +130 -61
- data/ext/ffi_c/Type.c +120 -51
- data/ext/ffi_c/Type.h +3 -1
- data/ext/ffi_c/Types.c +8 -2
- data/ext/ffi_c/Types.h +0 -1
- data/ext/ffi_c/Variadic.c +71 -26
- data/ext/ffi_c/compat.h +22 -22
- data/ext/ffi_c/extconf.rb +19 -2
- data/ext/ffi_c/ffi.c +4 -0
- 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 +27 -9
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/build-in-container.sh +4 -6
- data/ext/ffi_c/libffi/.ci/build.sh +124 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/install.sh +14 -7
- data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/site.exp +5 -3
- data/ext/ffi_c/libffi/.circleci/config.yml +156 -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 +10 -2
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/Makefile.am +12 -5
- data/ext/ffi_c/libffi/Makefile.in +118 -51
- data/ext/ffi_c/libffi/README.md +150 -105
- data/ext/ffi_c/libffi/acinclude.m4 +10 -112
- data/ext/ffi_c/libffi/compile +348 -0
- data/ext/ffi_c/libffi/config.guess +623 -556
- data/ext/ffi_c/libffi/config.sub +75 -34
- data/ext/ffi_c/libffi/configure +4571 -3830
- data/ext/ffi_c/libffi/configure.ac +64 -28
- data/ext/ffi_c/libffi/configure.host +26 -7
- data/ext/ffi_c/libffi/doc/Makefile.in +9 -6
- data/ext/ffi_c/libffi/doc/libffi.texi +82 -33
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +12 -47
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +163 -52
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +10 -9
- data/ext/ffi_c/libffi/include/ffi.h.in +55 -60
- data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +33 -2
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +92 -69
- data/ext/ffi_c/libffi/libffi.map.in +5 -0
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +518 -333
- 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_compiler_vendor.m4 +76 -45
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/man/Makefile.in +9 -6
- data/ext/ffi_c/libffi/missing +1 -1
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +2 -2
- data/ext/ffi_c/libffi/msvcc.sh +1 -1
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +172 -55
- data/ext/ffi_c/libffi/src/aarch64/internal.h +32 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +331 -87
- 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 +62 -17
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
- data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +113 -42
- data/ext/ffi_c/libffi/src/closures.c +136 -50
- data/ext/ffi_c/libffi/src/debug.c +2 -2
- data/ext/ffi_c/libffi/src/dlmalloc.c +6 -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/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 +31 -14
- data/ext/ffi_c/libffi/src/mips/ffi.c +250 -67
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -0
- data/ext/ffi_c/libffi/src/mips/n32.S +193 -33
- data/ext/ffi_c/libffi/src/mips/o32.S +61 -4
- data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
- data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
- data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
- data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +82 -35
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1 -1
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +2 -0
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +22 -2
- data/ext/ffi_c/libffi/src/riscv/ffi.c +37 -4
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +23 -1
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/types.c +4 -6
- 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/ffi.c +99 -37
- data/ext/ffi_c/libffi/src/x86/ffi64.c +67 -12
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +9 -5
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +44 -1
- 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 +172 -38
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +91 -88
- data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
- data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
- 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 +79 -114
- data/ext/ffi_c/libffi/testsuite/Makefile.in +89 -121
- 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 +43 -21
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -0
- 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/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/ffitest.h +28 -3
- 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_fn0.c +3 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +21 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +7 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +6 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +18 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +29 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +21 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +35 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +19 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +18 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +29 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +28 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +24 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +39 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +25 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +14 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +14 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +14 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +20 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +40 -25
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +40 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +18 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +18 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +11 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +22 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +5 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +6 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +6 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -138
- data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +21 -21
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +32 -9
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +12 -0
- data/ext/ffi_c/libffi/testsuite/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.closures/nested_struct2.c +10 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +10 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +9 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +9 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +9 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +11 -0
- data/ext/ffi_c/libffi/testsuite/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.closures/stret_medium.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +6 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +1 -0
- data/ext/ffi_c/libffi.bsd.mk +2 -2
- data/ext/ffi_c/libffi.darwin.mk +2 -2
- data/ext/ffi_c/libffi.gnu.mk +2 -2
- data/ext/ffi_c/rbffi.h +1 -1
- data/ffi.gemspec +3 -3
- data/lib/ffi/autopointer.rb +8 -31
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +2 -2
- data/lib/ffi/dynamic_library.rb +118 -0
- data/lib/ffi/enum.rb +18 -12
- data/lib/ffi/ffi.rb +3 -0
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +72 -88
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +1 -1
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
- 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/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform.rb +15 -13
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +6 -5
- data/lib/ffi/struct_layout.rb +3 -3
- data/lib/ffi/struct_layout_builder.rb +9 -9
- data/lib/ffi/types.rb +65 -37
- data/lib/ffi/variadic.rb +19 -8
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +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 +122 -28
- metadata.gz.sig +1 -0
- data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
- data/ext/ffi_c/libffi/.travis/build.sh +0 -142
- data/ext/ffi_c/libffi/.travis.yml +0 -83
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
- /data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/bfin-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/m32r-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/or1k-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/powerpc-eabisim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/wine-sim.exp +0 -0
- /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
- /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
@@ -34,9 +34,10 @@
|
|
34
34
|
#include <ffi_common.h>
|
35
35
|
#include <stdint.h>
|
36
36
|
#include <stdlib.h>
|
37
|
+
#include <tramp.h>
|
37
38
|
#include "internal.h"
|
38
39
|
|
39
|
-
#if defined(
|
40
|
+
#if defined(_WIN32)
|
40
41
|
#define WIN32_LEAN_AND_MEAN
|
41
42
|
#include <windows.h>
|
42
43
|
#endif
|
@@ -48,10 +49,13 @@
|
|
48
49
|
#endif
|
49
50
|
|
50
51
|
#else
|
51
|
-
#ifndef
|
52
|
+
#ifndef _WIN32
|
52
53
|
extern unsigned int ffi_arm_trampoline[2] FFI_HIDDEN;
|
53
54
|
#else
|
54
|
-
|
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;
|
55
59
|
#endif
|
56
60
|
#endif
|
57
61
|
|
@@ -60,6 +64,10 @@ extern unsigned int ffi_arm_trampoline[3] FFI_HIDDEN;
|
|
60
64
|
#include <machine/sysarch.h>
|
61
65
|
#endif
|
62
66
|
|
67
|
+
#if defined(__QNX__)
|
68
|
+
#include <sys/mman.h>
|
69
|
+
#endif
|
70
|
+
|
63
71
|
/* Forward declares. */
|
64
72
|
static int vfp_type_p (const ffi_type *);
|
65
73
|
static void layout_vfp_args (ffi_cif *);
|
@@ -103,13 +111,13 @@ ffi_put_arg (ffi_type *ty, void *src, void *dst)
|
|
103
111
|
case FFI_TYPE_SINT32:
|
104
112
|
case FFI_TYPE_UINT32:
|
105
113
|
case FFI_TYPE_POINTER:
|
106
|
-
#ifndef
|
114
|
+
#ifndef _WIN32
|
107
115
|
case FFI_TYPE_FLOAT:
|
108
116
|
#endif
|
109
117
|
*(UINT32 *)dst = *(UINT32 *)src;
|
110
118
|
break;
|
111
119
|
|
112
|
-
#ifdef
|
120
|
+
#ifdef _WIN32
|
113
121
|
// casting a float* to a UINT32* doesn't work on Windows
|
114
122
|
case FFI_TYPE_FLOAT:
|
115
123
|
*(uintptr_t *)dst = 0;
|
@@ -536,6 +544,8 @@ ffi_prep_incoming_args_VFP (ffi_cif *cif, void *rvalue, char *stack,
|
|
536
544
|
return rvalue;
|
537
545
|
}
|
538
546
|
|
547
|
+
#if FFI_CLOSURES
|
548
|
+
|
539
549
|
struct closure_frame
|
540
550
|
{
|
541
551
|
char vfp_space[8*8] __attribute__((aligned(8)));
|
@@ -571,6 +581,10 @@ ffi_closure_inner_VFP (ffi_cif *cif,
|
|
571
581
|
|
572
582
|
void ffi_closure_SYSV (void) FFI_HIDDEN;
|
573
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
|
574
588
|
|
575
589
|
#ifdef FFI_GO_CLOSURES
|
576
590
|
void ffi_go_closure_SYSV (void) FFI_HIDDEN;
|
@@ -612,27 +626,44 @@ ffi_prep_closure_loc (ffi_closure * closure,
|
|
612
626
|
config[1] = closure_func;
|
613
627
|
#else
|
614
628
|
|
615
|
-
#
|
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
|
616
644
|
memcpy(closure->tramp, ffi_arm_trampoline, 8);
|
617
|
-
#else
|
645
|
+
# else
|
618
646
|
// cast away function type so MSVC doesn't set the lower bit of the function pointer
|
619
647
|
memcpy(closure->tramp, (void*)((uintptr_t)ffi_arm_trampoline & 0xFFFFFFFE), FFI_TRAMPOLINE_CLOSURE_OFFSET);
|
620
|
-
#endif
|
648
|
+
# endif
|
621
649
|
|
622
|
-
#if defined
|
623
|
-
msync(closure->tramp, 8,
|
624
|
-
msync(codeloc, 8,
|
625
|
-
#elif defined(
|
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)
|
626
654
|
FlushInstructionCache(GetCurrentProcess(), closure->tramp, FFI_TRAMPOLINE_SIZE);
|
627
|
-
#else
|
655
|
+
# else
|
628
656
|
__clear_cache(closure->tramp, closure->tramp + 8); /* clear data map */
|
629
657
|
__clear_cache(codeloc, codeloc + 8); /* clear insn map */
|
630
|
-
#endif
|
631
|
-
#ifdef
|
658
|
+
# endif
|
659
|
+
# ifdef _WIN32
|
632
660
|
*(void(**)(void))(closure->tramp + FFI_TRAMPOLINE_CLOSURE_FUNCTION) = closure_func;
|
633
|
-
#else
|
661
|
+
# else
|
634
662
|
*(void (**)(void))(closure->tramp + 8) = closure_func;
|
635
|
-
#endif
|
663
|
+
# endif
|
664
|
+
# if defined(FFI_EXEC_STATIC_TRAMP)
|
665
|
+
out:
|
666
|
+
# endif
|
636
667
|
#endif
|
637
668
|
|
638
669
|
closure->cif = cif;
|
@@ -666,6 +697,8 @@ ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif,
|
|
666
697
|
}
|
667
698
|
#endif
|
668
699
|
|
700
|
+
#endif /* FFI_CLOSURES */
|
701
|
+
|
669
702
|
/* Below are routines for VFP hard-float support. */
|
670
703
|
|
671
704
|
/* A subroutine of vfp_type_p. Given a structure type, return the type code
|
@@ -873,4 +906,16 @@ layout_vfp_args (ffi_cif * cif)
|
|
873
906
|
}
|
874
907
|
}
|
875
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
|
+
|
876
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
|
-
#if defined(__ARM_PCS_VFP) || defined(
|
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,7 @@ typedef enum ffi_abi {
|
|
57
57
|
signed char vfp_args[16] \
|
58
58
|
|
59
59
|
#define FFI_TARGET_SPECIFIC_VARIADIC
|
60
|
-
#ifndef
|
60
|
+
#ifndef _WIN32
|
61
61
|
#define FFI_TARGET_HAS_COMPLEX_TYPE
|
62
62
|
#endif
|
63
63
|
|
@@ -77,7 +77,7 @@ typedef enum ffi_abi {
|
|
77
77
|
#endif
|
78
78
|
|
79
79
|
#else
|
80
|
-
#ifdef
|
80
|
+
#ifdef _WIN32
|
81
81
|
#define FFI_TRAMPOLINE_SIZE 16
|
82
82
|
#define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12
|
83
83
|
#else
|
@@ -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
|
@@ -92,9 +92,25 @@
|
|
92
92
|
#define ARM_FUNC_END(name) \
|
93
93
|
SIZE(name)
|
94
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
|
+
|
95
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__)
|
96
113
|
/* ??? The clang assembler doesn't handle .if with symbolic expressions. */
|
97
|
-
#ifdef __clang__
|
98
114
|
# define E(index)
|
99
115
|
#else
|
100
116
|
# define E(index) \
|
@@ -103,9 +119,6 @@
|
|
103
119
|
.endif
|
104
120
|
#endif
|
105
121
|
|
106
|
-
.text
|
107
|
-
.syntax unified
|
108
|
-
.arm
|
109
122
|
|
110
123
|
#ifndef __clang__
|
111
124
|
/* We require interworking on LDM, which implies ARMv5T,
|
@@ -128,13 +141,9 @@ ARM_FUNC_START(ffi_call_VFP)
|
|
128
141
|
cfi_startproc
|
129
142
|
|
130
143
|
cmp r3, #3 @ load only d0 if possible
|
131
|
-
|
132
|
-
vldrle d0, [r0]
|
133
|
-
vldmgt r0, {d0-d7}
|
134
|
-
#else
|
144
|
+
ite le
|
135
145
|
ldcle p11, cr0, [r0] @ vldrle d0, [r0]
|
136
146
|
ldcgt p11, cr0, [r0], {16} @ vldmgt r0, {d0-d7}
|
137
|
-
#endif
|
138
147
|
add r0, r0, #64 @ discard the vfp register args
|
139
148
|
/* FALLTHRU */
|
140
149
|
ARM_FUNC_END(ffi_call_VFP)
|
@@ -167,30 +176,25 @@ ARM_FUNC_START(ffi_call_SYSV)
|
|
167
176
|
cfi_def_cfa_register(sp)
|
168
177
|
|
169
178
|
@ Store values stored in registers.
|
179
|
+
#ifndef __thumb__
|
170
180
|
.align 3
|
171
181
|
add pc, pc, r3, lsl #3
|
172
182
|
nop
|
183
|
+
#else
|
184
|
+
adr ip, 0f
|
185
|
+
add ip, ip, r3, lsl #3
|
186
|
+
mov pc, ip
|
187
|
+
.align 3
|
188
|
+
#endif
|
173
189
|
0:
|
174
190
|
E(ARM_TYPE_VFP_S)
|
175
|
-
#ifdef __clang__
|
176
|
-
vstr s0, [r2]
|
177
|
-
#else
|
178
191
|
stc p10, cr0, [r2] @ vstr s0, [r2]
|
179
|
-
#endif
|
180
192
|
pop {fp,pc}
|
181
193
|
E(ARM_TYPE_VFP_D)
|
182
|
-
#ifdef __clang__
|
183
|
-
vstr d0, [r2]
|
184
|
-
#else
|
185
194
|
stc p11, cr0, [r2] @ vstr d0, [r2]
|
186
|
-
#endif
|
187
195
|
pop {fp,pc}
|
188
196
|
E(ARM_TYPE_VFP_N)
|
189
|
-
#ifdef __clang__
|
190
|
-
vstm r2, {d0-d3}
|
191
|
-
#else
|
192
197
|
stc p11, cr0, [r2], {8} @ vstm r2, {d0-d3}
|
193
|
-
#endif
|
194
198
|
pop {fp,pc}
|
195
199
|
E(ARM_TYPE_INT64)
|
196
200
|
str r1, [r2, #4]
|
@@ -208,6 +212,7 @@ E(ARM_TYPE_STRUCT)
|
|
208
212
|
UNWIND(.fnend)
|
209
213
|
ARM_FUNC_END(ffi_call_SYSV)
|
210
214
|
|
215
|
+
#if FFI_CLOSURES
|
211
216
|
|
212
217
|
/*
|
213
218
|
int ffi_closure_inner_* (cif, fun, user_data, frame)
|
@@ -227,6 +232,9 @@ ARM_FUNC_END(ffi_go_closure_SYSV)
|
|
227
232
|
ARM_FUNC_START(ffi_closure_SYSV)
|
228
233
|
UNWIND(.fnstart)
|
229
234
|
cfi_startproc
|
235
|
+
#ifdef _WIN32
|
236
|
+
ldmfd sp!, {r0, ip} @ restore fp (r0 is used for stack alignment)
|
237
|
+
#endif
|
230
238
|
stmdb sp!, {r0-r3} @ save argument regs
|
231
239
|
cfi_adjust_cfa_offset(16)
|
232
240
|
|
@@ -255,7 +263,12 @@ ARM_FUNC_START(ffi_closure_SYSV)
|
|
255
263
|
@ Load values returned in registers.
|
256
264
|
add r2, sp, #8+64 @ load result
|
257
265
|
adr r3, CNAME(ffi_closure_ret)
|
266
|
+
#ifndef __thumb__
|
258
267
|
add pc, r3, r0, lsl #3
|
268
|
+
#else
|
269
|
+
add r3, r3, r0, lsl #3
|
270
|
+
mov pc, r3
|
271
|
+
#endif
|
259
272
|
cfi_endproc
|
260
273
|
UNWIND(.fnend)
|
261
274
|
ARM_FUNC_END(ffi_closure_SYSV)
|
@@ -274,6 +287,9 @@ ARM_FUNC_END(ffi_go_closure_VFP)
|
|
274
287
|
ARM_FUNC_START(ffi_closure_VFP)
|
275
288
|
UNWIND(.fnstart)
|
276
289
|
cfi_startproc
|
290
|
+
#ifdef _WIN32
|
291
|
+
ldmfd sp!, {r0, ip} @ restore fp (r0 is used for stack alignment)
|
292
|
+
#endif
|
277
293
|
stmdb sp!, {r0-r3} @ save argument regs
|
278
294
|
cfi_adjust_cfa_offset(16)
|
279
295
|
|
@@ -287,11 +303,7 @@ ARM_FUNC_START(ffi_closure_VFP)
|
|
287
303
|
add ip, sp, #16
|
288
304
|
sub sp, sp, #64+32 @ allocate frame
|
289
305
|
cfi_adjust_cfa_offset(64+32)
|
290
|
-
#ifdef __clang__
|
291
|
-
vstm sp, {d0-d7}
|
292
|
-
#else
|
293
306
|
stc p11, cr0, [sp], {16} @ vstm sp, {d0-d7}
|
294
|
-
#endif
|
295
307
|
stmdb sp!, {ip,lr}
|
296
308
|
|
297
309
|
/* See above. */
|
@@ -305,7 +317,12 @@ ARM_FUNC_START(ffi_closure_VFP)
|
|
305
317
|
@ Load values returned in registers.
|
306
318
|
add r2, sp, #8+64 @ load result
|
307
319
|
adr r3, CNAME(ffi_closure_ret)
|
320
|
+
#ifndef __thumb__
|
308
321
|
add pc, r3, r0, lsl #3
|
322
|
+
#else
|
323
|
+
add r3, r3, r0, lsl #3
|
324
|
+
mov pc, r3
|
325
|
+
#endif
|
309
326
|
cfi_endproc
|
310
327
|
UNWIND(.fnend)
|
311
328
|
ARM_FUNC_END(ffi_closure_VFP)
|
@@ -320,40 +337,85 @@ ARM_FUNC_START_LOCAL(ffi_closure_ret)
|
|
320
337
|
cfi_rel_offset(lr, 4)
|
321
338
|
0:
|
322
339
|
E(ARM_TYPE_VFP_S)
|
323
|
-
#ifdef __clang__
|
324
|
-
vldr s0, [r2]
|
325
|
-
#else
|
326
340
|
ldc p10, cr0, [r2] @ vldr s0, [r2]
|
327
|
-
|
328
|
-
ldm sp, {sp,pc}
|
341
|
+
b call_epilogue
|
329
342
|
E(ARM_TYPE_VFP_D)
|
330
|
-
#ifdef __clang__
|
331
|
-
vldr d0, [r2]
|
332
|
-
#else
|
333
343
|
ldc p11, cr0, [r2] @ vldr d0, [r2]
|
334
|
-
|
335
|
-
ldm sp, {sp,pc}
|
344
|
+
b call_epilogue
|
336
345
|
E(ARM_TYPE_VFP_N)
|
337
|
-
#ifdef __clang__
|
338
|
-
vldm r2, {d0-d3}
|
339
|
-
#else
|
340
346
|
ldc p11, cr0, [r2], {8} @ vldm r2, {d0-d3}
|
341
|
-
|
342
|
-
ldm sp, {sp,pc}
|
347
|
+
b call_epilogue
|
343
348
|
E(ARM_TYPE_INT64)
|
344
349
|
ldr r1, [r2, #4]
|
345
350
|
nop
|
346
351
|
E(ARM_TYPE_INT)
|
347
352
|
ldr r0, [r2]
|
348
|
-
|
353
|
+
b call_epilogue
|
349
354
|
E(ARM_TYPE_VOID)
|
350
|
-
|
355
|
+
b call_epilogue
|
351
356
|
nop
|
352
357
|
E(ARM_TYPE_STRUCT)
|
358
|
+
b call_epilogue
|
359
|
+
call_epilogue:
|
360
|
+
#ifndef __thumb__
|
353
361
|
ldm sp, {sp,pc}
|
362
|
+
#else
|
363
|
+
ldm sp, {ip,lr}
|
364
|
+
mov sp, ip
|
365
|
+
bx lr
|
366
|
+
#endif
|
354
367
|
cfi_endproc
|
355
368
|
ARM_FUNC_END(ffi_closure_ret)
|
356
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
|
+
|
357
419
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
358
420
|
|
359
421
|
#ifdef __MACH__
|
@@ -369,6 +431,15 @@ ARM_FUNC_START(ffi_closure_trampoline_table_page)
|
|
369
431
|
ARM_FUNC_END(ffi_closure_trampoline_table_page)
|
370
432
|
#endif
|
371
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
|
+
|
372
443
|
#else
|
373
444
|
|
374
445
|
ARM_FUNC_START(ffi_arm_trampoline)
|