ffi 1.9.25 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (339) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +212 -0
  3. data/Gemfile +3 -4
  4. data/README.md +38 -18
  5. data/Rakefile +55 -146
  6. data/ext/ffi_c/AbstractMemory.c +29 -34
  7. data/ext/ffi_c/Buffer.c +4 -9
  8. data/ext/ffi_c/Call.c +16 -49
  9. data/ext/ffi_c/Call.h +4 -7
  10. data/ext/ffi_c/ClosurePool.c +75 -25
  11. data/ext/ffi_c/ClosurePool.h +3 -1
  12. data/ext/ffi_c/DynamicLibrary.c +2 -7
  13. data/ext/ffi_c/Function.c +47 -131
  14. data/ext/ffi_c/Function.h +0 -4
  15. data/ext/ffi_c/FunctionInfo.c +3 -8
  16. data/ext/ffi_c/LastError.c +49 -8
  17. data/ext/ffi_c/LongDouble.c +12 -10
  18. data/ext/ffi_c/LongDouble.h +0 -4
  19. data/ext/ffi_c/MemoryPointer.c +3 -8
  20. data/ext/ffi_c/MemoryPointer.h +0 -4
  21. data/ext/ffi_c/MethodHandle.c +21 -31
  22. data/ext/ffi_c/MethodHandle.h +3 -2
  23. data/ext/ffi_c/Platform.c +3 -54
  24. data/ext/ffi_c/Pointer.c +25 -26
  25. data/ext/ffi_c/Pointer.h +0 -4
  26. data/ext/ffi_c/Struct.c +49 -56
  27. data/ext/ffi_c/Struct.h +12 -6
  28. data/ext/ffi_c/StructByValue.c +2 -7
  29. data/ext/ffi_c/StructLayout.c +22 -20
  30. data/ext/ffi_c/Thread.c +4 -228
  31. data/ext/ffi_c/Thread.h +1 -20
  32. data/ext/ffi_c/Type.c +1 -19
  33. data/ext/ffi_c/Type.h +0 -1
  34. data/ext/ffi_c/Types.c +7 -8
  35. data/ext/ffi_c/Types.h +3 -4
  36. data/ext/ffi_c/Variadic.c +23 -24
  37. data/ext/ffi_c/compat.h +4 -0
  38. data/ext/ffi_c/extconf.rb +53 -30
  39. data/ext/ffi_c/ffi.c +3 -8
  40. data/ext/ffi_c/libffi.darwin.mk +1 -1
  41. data/ext/ffi_c/libffi/.appveyor.yml +29 -13
  42. data/ext/ffi_c/libffi/.gitattributes +4 -0
  43. data/ext/ffi_c/libffi/.travis.yml +51 -2
  44. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
  45. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
  46. data/ext/ffi_c/libffi/.travis/build-in-container.sh +12 -0
  47. data/ext/ffi_c/libffi/.travis/build.sh +116 -8
  48. data/ext/ffi_c/libffi/.travis/install.sh +65 -16
  49. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
  50. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
  51. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
  52. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
  53. data/ext/ffi_c/libffi/.travis/site.exp +10 -1
  54. data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
  55. data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
  56. data/ext/ffi_c/libffi/LICENSE +1 -1
  57. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
  58. data/ext/ffi_c/libffi/Makefile.am +56 -72
  59. data/ext/ffi_c/libffi/README.md +33 -8
  60. data/ext/ffi_c/libffi/config.guess +552 -331
  61. data/ext/ffi_c/libffi/config.sub +1321 -1306
  62. data/ext/ffi_c/libffi/configure.ac +37 -12
  63. data/ext/ffi_c/libffi/configure.host +56 -27
  64. data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
  65. data/ext/ffi_c/libffi/doc/libffi.texi +997 -0
  66. data/ext/ffi_c/libffi/doc/version.texi +4 -0
  67. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +2 -4
  68. data/ext/ffi_c/libffi/include/ffi.h.in +19 -7
  69. data/ext/ffi_c/libffi/include/ffi_common.h +5 -1
  70. data/ext/ffi_c/libffi/libffi.map.in +8 -12
  71. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
  72. data/ext/ffi_c/libffi/libtool-version +1 -1
  73. data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
  74. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
  75. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
  76. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
  77. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
  78. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
  79. data/ext/ffi_c/libffi/make_sunver.pl +333 -0
  80. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
  81. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
  82. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
  83. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
  84. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
  85. data/ext/ffi_c/libffi/msvcc.sh +38 -13
  86. data/ext/ffi_c/libffi/src/aarch64/ffi.c +153 -69
  87. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +19 -3
  88. data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
  89. data/ext/ffi_c/libffi/src/aarch64/sysv.S +22 -9
  90. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
  91. data/ext/ffi_c/libffi/src/arm/ffi.c +62 -5
  92. data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
  93. data/ext/ffi_c/libffi/src/arm/sysv.S +6 -4
  94. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
  95. data/ext/ffi_c/libffi/src/closures.c +69 -14
  96. data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
  97. data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
  98. data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
  99. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  100. data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
  101. data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
  102. data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
  103. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
  104. data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
  105. data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
  106. data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
  107. data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
  108. data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
  109. data/ext/ffi_c/libffi/src/moxie/ffi.c +1 -1
  110. data/ext/ffi_c/libffi/src/pa/ffi.c +46 -91
  111. data/ext/ffi_c/libffi/src/pa/ffitarget.h +1 -6
  112. data/ext/ffi_c/libffi/src/pa/hpux32.S +4 -2
  113. data/ext/ffi_c/libffi/src/pa/linux.S +27 -4
  114. data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
  115. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
  116. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
  117. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
  118. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
  119. data/ext/ffi_c/libffi/src/powerpc/linux64.S +91 -28
  120. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +81 -5
  121. data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
  122. data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
  123. data/ext/ffi_c/libffi/src/riscv/ffi.c +42 -6
  124. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
  125. data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
  126. data/ext/ffi_c/libffi/src/x86/ffi.c +29 -12
  127. data/ext/ffi_c/libffi/src/x86/ffi64.c +22 -11
  128. data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
  129. data/ext/ffi_c/libffi/src/x86/ffiw64.c +20 -10
  130. data/ext/ffi_c/libffi/src/x86/sysv.S +105 -10
  131. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
  132. data/ext/ffi_c/libffi/src/x86/unix64.S +100 -4
  133. data/ext/ffi_c/libffi/src/x86/win64.S +12 -3
  134. data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
  135. data/ext/ffi_c/libffi/testsuite/Makefile.am +114 -109
  136. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +32 -8
  137. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
  138. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
  139. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
  140. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
  141. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
  142. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
  143. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
  144. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
  145. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
  146. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
  147. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
  148. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
  149. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
  150. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
  151. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
  152. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
  153. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
  154. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
  155. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
  156. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
  157. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
  158. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
  159. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
  160. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
  161. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
  162. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
  163. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
  164. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
  165. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
  166. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
  167. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
  168. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
  169. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
  170. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
  171. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
  172. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
  173. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
  174. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
  175. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
  176. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
  177. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
  178. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
  179. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
  180. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
  181. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
  182. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
  183. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
  184. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
  185. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
  186. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
  187. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
  188. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
  189. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
  190. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
  191. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
  192. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
  193. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
  194. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
  195. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
  196. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
  197. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
  198. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
  199. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
  200. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
  201. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
  202. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
  203. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
  204. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
  205. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
  206. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
  207. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
  208. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
  209. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
  210. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
  211. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
  212. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
  213. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
  214. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
  215. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
  216. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
  217. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
  218. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
  219. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
  220. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +3 -1
  221. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
  222. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
  223. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
  224. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
  225. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
  226. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
  227. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
  228. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
  229. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
  230. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
  231. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
  232. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
  233. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
  234. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
  235. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
  236. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
  237. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
  238. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
  239. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
  240. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
  241. data/ext/ffi_c/rbffi.h +0 -2
  242. data/ffi.gemspec +13 -6
  243. data/lib/ffi.rb +10 -2
  244. data/lib/ffi/abstract_memory.rb +44 -0
  245. data/lib/ffi/autopointer.rb +1 -1
  246. data/lib/ffi/data_converter.rb +67 -0
  247. data/lib/ffi/ffi.rb +3 -0
  248. data/lib/ffi/io.rb +3 -3
  249. data/lib/ffi/library.rb +12 -8
  250. data/lib/ffi/managedstruct.rb +2 -2
  251. data/lib/ffi/platform.rb +34 -10
  252. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  253. data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
  254. data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
  255. data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
  256. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  257. data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
  258. data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
  259. data/lib/ffi/platform/arm-linux/types.conf +110 -82
  260. data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
  261. data/lib/ffi/platform/i386-darwin/types.conf +63 -63
  262. data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
  263. data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
  264. data/lib/ffi/platform/i386-gnu/types.conf +84 -84
  265. data/lib/ffi/platform/i386-linux/types.conf +77 -77
  266. data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
  267. data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
  268. data/lib/ffi/platform/i386-solaris/types.conf +96 -96
  269. data/lib/ffi/platform/i386-windows/types.conf +43 -96
  270. data/lib/ffi/platform/ia64-linux/types.conf +79 -79
  271. data/lib/ffi/platform/mips-linux/types.conf +79 -79
  272. data/lib/ffi/platform/mips64-linux/types.conf +81 -81
  273. data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
  274. data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
  275. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
  276. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
  277. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
  278. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
  279. data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
  280. data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
  281. data/lib/ffi/platform/powerpc-linux/types.conf +108 -78
  282. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  283. data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
  284. data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
  285. data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
  286. data/lib/ffi/platform/s390-linux/types.conf +79 -79
  287. data/lib/ffi/platform/s390x-linux/types.conf +79 -79
  288. data/lib/ffi/platform/sparc-linux/types.conf +79 -79
  289. data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
  290. data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
  291. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  292. data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
  293. data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
  294. data/lib/ffi/platform/x86_64-darwin/types.conf +88 -84
  295. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
  296. data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
  297. data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
  298. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  299. data/lib/ffi/platform/x86_64-linux/types.conf +107 -77
  300. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  301. data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
  302. data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
  303. data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
  304. data/lib/ffi/platform/x86_64-windows/types.conf +42 -110
  305. data/lib/ffi/pointer.rb +26 -20
  306. data/lib/ffi/struct.rb +13 -68
  307. data/lib/ffi/struct_by_reference.rb +72 -0
  308. data/lib/ffi/struct_layout.rb +96 -0
  309. data/lib/ffi/tools/const_generator.rb +5 -4
  310. data/lib/ffi/tools/generator.rb +47 -2
  311. data/lib/ffi/tools/generator_task.rb +13 -17
  312. data/lib/ffi/tools/struct_generator.rb +4 -4
  313. data/lib/ffi/tools/types_generator.rb +7 -4
  314. data/lib/ffi/types.rb +1 -1
  315. data/lib/ffi/variadic.rb +1 -10
  316. data/lib/ffi/version.rb +1 -1
  317. data/rakelib/ffi_gem_helper.rb +65 -0
  318. data/samples/getlogin.rb +1 -1
  319. data/samples/getpid.rb +1 -1
  320. data/samples/gettimeofday.rb +8 -8
  321. data/samples/hello.rb +2 -1
  322. data/samples/inotify.rb +1 -1
  323. data/samples/pty.rb +1 -2
  324. data/samples/qsort.rb +0 -1
  325. metadata +160 -122
  326. data/.gitignore +0 -22
  327. data/.gitmodules +0 -3
  328. data/.travis.yml +0 -52
  329. data/.yardopts +0 -5
  330. data/appveyor.yml +0 -22
  331. data/ext/ffi_c/DataConverter.c +0 -91
  332. data/ext/ffi_c/StructByReference.c +0 -190
  333. data/ext/ffi_c/StructByReference.h +0 -50
  334. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  335. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  336. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
  337. data/ext/ffi_c/win32/stdbool.h +0 -8
  338. data/ext/ffi_c/win32/stdint.h +0 -201
  339. data/samples/sample_helper.rb +0 -6
@@ -60,7 +60,7 @@ do
60
60
  case $1
61
61
  in
62
62
  --verbose)
63
- $verbose=1
63
+ verbose=1
64
64
  shift 1
65
65
  ;;
66
66
  --version)
@@ -80,6 +80,16 @@ do
80
80
  safeseh=
81
81
  shift 1
82
82
  ;;
83
+ -marm)
84
+ ml='armasm'
85
+ safeseh=
86
+ shift 1
87
+ ;;
88
+ -marm64)
89
+ ml='armasm64'
90
+ safeseh=
91
+ shift 1
92
+ ;;
83
93
  -clang-cl)
84
94
  cl="clang-cl"
85
95
  shift 1
@@ -155,24 +165,24 @@ do
155
165
  shift 1
156
166
  ;;
157
167
  -I)
158
- p=$(cygpath -m $2)
159
- args="$args -I$p"
160
- includes="$includes -I$p"
168
+ p=$(cygpath -ma "$2")
169
+ args="$args -I\"$p\""
170
+ includes="$includes -I\"$p\""
161
171
  shift 2
162
172
  ;;
163
173
  -I*)
164
- p=$(cygpath -m ${1#-I})
165
- args="$args -I$p"
166
- includes="$includes -I$p"
174
+ p=$(cygpath -ma "${1#-I}")
175
+ args="$args -I\"$p\""
176
+ includes="$includes -I\"$p\""
167
177
  shift 1
168
178
  ;;
169
179
  -L)
170
- p=$(cygpath -m $2)
180
+ p=$(cygpath -ma $2)
171
181
  linkargs="$linkargs -LIBPATH:$p"
172
182
  shift 2
173
183
  ;;
174
184
  -L*)
175
- p=$(cygpath -m ${1#-L})
185
+ p=$(cygpath -ma ${1#-L})
176
186
  linkargs="$linkargs -LIBPATH:$p"
177
187
  shift 1
178
188
  ;;
@@ -237,6 +247,7 @@ do
237
247
  else
238
248
  output="-Fe$2"
239
249
  fi
250
+ armasm_output="-o $2"
240
251
  if [ -n "$assembly" ]; then
241
252
  args="$args $output"
242
253
  else
@@ -245,12 +256,12 @@ do
245
256
  shift 2
246
257
  ;;
247
258
  *.S)
248
- src=$1
259
+ src="$(cygpath -ma $1)"
249
260
  assembly="true"
250
261
  shift 1
251
262
  ;;
252
263
  *.c)
253
- args="$args $1"
264
+ args="$args $(cygpath -ma $1)"
254
265
  shift 1
255
266
  ;;
256
267
  *)
@@ -289,13 +300,27 @@ if [ -n "$assembly" ]; then
289
300
  fi
290
301
  ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
291
302
 
303
+ if [ $ml = "armasm" ]; then
304
+ defines="$defines -D_M_ARM"
305
+ fi
306
+
307
+ if [ $ml = "armasm64" ]; then
308
+ defines="$defines -D_M_ARM64"
309
+ fi
310
+
292
311
  if test -n "$verbose"; then
293
312
  echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
294
313
  fi
295
314
 
296
- "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
315
+ eval "\"$cl\" -nologo -EP $includes $defines $src" > $ppsrc || exit $?
297
316
  output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
298
- args="-nologo $safeseh $single $output $ppsrc"
317
+ if [ $ml = "armasm" ]; then
318
+ args="-nologo -g -oldit $armasm_output $ppsrc -errorReport:prompt"
319
+ elif [ $ml = "armasm64" ]; then
320
+ args="-nologo -g $armasm_output $ppsrc -errorReport:prompt"
321
+ else
322
+ args="-nologo $safeseh $single $output $ppsrc"
323
+ fi
299
324
 
300
325
  if test -n "$verbose"; then
301
326
  echo "$ml $args"
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
19
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
20
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
21
21
 
22
+ #if defined(__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)
22
23
  #include <stdio.h>
23
24
  #include <stdlib.h>
24
25
  #include <stdint.h>
@@ -26,6 +27,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
26
27
  #include <ffi.h>
27
28
  #include <ffi_common.h>
28
29
  #include "internal.h"
30
+ #ifdef _WIN32
31
+ #include <windows.h> /* FlushInstructionCache */
32
+ #endif
29
33
 
30
34
  /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
31
35
  all further uses in this file will refer to the 128-bit type. */
@@ -58,6 +62,9 @@ struct call_context
58
62
  #if FFI_EXEC_TRAMPOLINE_TABLE
59
63
 
60
64
  #ifdef __MACH__
65
+ #ifdef HAVE_PTRAUTH
66
+ #include <ptrauth.h>
67
+ #endif
61
68
  #include <mach/vm_param.h>
62
69
  #endif
63
70
 
@@ -74,6 +81,8 @@ ffi_clear_cache (void *start, void *end)
74
81
  sys_icache_invalidate (start, (char *)end - (char *)start);
75
82
  #elif defined (__GNUC__)
76
83
  __builtin___clear_cache (start, end);
84
+ #elif defined (_WIN32)
85
+ FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start);
77
86
  #else
78
87
  #error "Missing builtin to flush instruction cache"
79
88
  #endif
@@ -315,6 +324,9 @@ extend_integer_type (void *source, int type)
315
324
  }
316
325
  }
317
326
 
327
+ #if defined(_MSC_VER)
328
+ void extend_hfa_type (void *dest, void *src, int h);
329
+ #else
318
330
  static void
319
331
  extend_hfa_type (void *dest, void *src, int h)
320
332
  {
@@ -350,10 +362,10 @@ extend_hfa_type (void *dest, void *src, int h)
350
362
  " b 1f\n"
351
363
  " nop\n"
352
364
  " ldp q16, q17, [%3]\n" /* Q4 */
353
- " ldp q18, q19, [%3, #16]\n"
365
+ " ldp q18, q19, [%3, #32]\n"
354
366
  " b 4f\n"
355
367
  " ldp q16, q17, [%3]\n" /* Q3 */
356
- " ldr q18, [%3, #16]\n"
368
+ " ldr q18, [%3, #32]\n"
357
369
  " b 3f\n"
358
370
  " ldp q16, q17, [%3]\n" /* Q2 */
359
371
  " b 2f\n"
@@ -368,7 +380,11 @@ extend_hfa_type (void *dest, void *src, int h)
368
380
  : "r"(f * 12), "r"(dest), "r"(src)
369
381
  : "memory", "v16", "v17", "v18", "v19");
370
382
  }
383
+ #endif
371
384
 
385
+ #if defined(_MSC_VER)
386
+ void* compress_hfa_type (void *dest, void *src, int h);
387
+ #else
372
388
  static void *
373
389
  compress_hfa_type (void *dest, void *reg, int h)
374
390
  {
@@ -437,6 +453,7 @@ compress_hfa_type (void *dest, void *reg, int h)
437
453
  }
438
454
  return dest;
439
455
  }
456
+ #endif
440
457
 
441
458
  /* Either allocate an appropriate register for the argument type, or if
442
459
  none are available, allocate a stack slot and return a pointer
@@ -454,7 +471,7 @@ allocate_int_to_reg_or_stack (struct call_context *context,
454
471
  return allocate_to_stack (state, stack, size, size);
455
472
  }
456
473
 
457
- ffi_status
474
+ ffi_status FFI_HIDDEN
458
475
  ffi_prep_cif_machdep (ffi_cif *cif)
459
476
  {
460
477
  ffi_type *rtype = cif->rtype;
@@ -539,14 +556,22 @@ ffi_prep_cif_machdep (ffi_cif *cif)
539
556
 
540
557
  #if defined (__APPLE__)
541
558
  /* Perform Apple-specific cif processing for variadic calls */
542
- ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
543
- unsigned int nfixedargs,
544
- unsigned int ntotalargs)
559
+ ffi_status FFI_HIDDEN
560
+ ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs,
561
+ unsigned int ntotalargs)
545
562
  {
546
563
  ffi_status status = ffi_prep_cif_machdep (cif);
547
564
  cif->aarch64_nfixedargs = nfixedargs;
548
565
  return status;
549
566
  }
567
+ #else
568
+ ffi_status FFI_HIDDEN
569
+ ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs, unsigned int ntotalargs)
570
+ {
571
+ ffi_status status = ffi_prep_cif_machdep (cif);
572
+ cif->flags |= AARCH64_FLAG_VARARG;
573
+ return status;
574
+ }
550
575
  #endif /* __APPLE__ */
551
576
 
552
577
  extern void ffi_call_SYSV (struct call_context *context, void *frame,
@@ -563,7 +588,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
563
588
  void *stack, *frame, *rvalue;
564
589
  struct arg_state state;
565
590
  size_t stack_bytes, rtype_size, rsize;
566
- int i, nargs, flags;
591
+ int i, nargs, flags, isvariadic = 0;
567
592
  ffi_type *rtype;
568
593
 
569
594
  flags = cif->flags;
@@ -571,6 +596,12 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
571
596
  rtype_size = rtype->size;
572
597
  stack_bytes = cif->bytes;
573
598
 
599
+ if (flags & AARCH64_FLAG_VARARG)
600
+ {
601
+ isvariadic = 1;
602
+ flags &= ~AARCH64_FLAG_VARARG;
603
+ }
604
+
574
605
  /* If the target function returns a structure via hidden pointer,
575
606
  then we cannot allow a null rvalue. Otherwise, mash a null
576
607
  rvalue to void return type. */
@@ -588,8 +619,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
588
619
  /* Allocate consectutive stack for everything we'll need. */
589
620
  context = alloca (sizeof(struct call_context) + stack_bytes + 32 + rsize);
590
621
  stack = context + 1;
591
- frame = stack + stack_bytes;
592
- rvalue = (rsize ? frame + 32 : orig_rvalue);
622
+ frame = (void*)((uintptr_t)stack + (uintptr_t)stack_bytes);
623
+ rvalue = (rsize ? (void*)((uintptr_t)frame + 32) : orig_rvalue);
593
624
 
594
625
  arg_init (&state);
595
626
  for (i = 0, nargs = cif->nargs; i < nargs; i++)
@@ -650,16 +681,31 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
650
681
  h = is_vfp_type (ty);
651
682
  if (h)
652
683
  {
653
- int elems = 4 - (h & 3);
654
- if (state.nsrn + elems <= N_V_ARG_REG)
655
- {
656
- dest = &context->v[state.nsrn];
657
- state.nsrn += elems;
658
- extend_hfa_type (dest, a, h);
659
- break;
660
- }
661
- state.nsrn = N_V_ARG_REG;
662
- dest = allocate_to_stack (&state, stack, ty->alignment, s);
684
+ int elems = 4 - (h & 3);
685
+ if (cif->abi == FFI_WIN64 && isvariadic)
686
+ {
687
+ if (state.ngrn + elems <= N_X_ARG_REG)
688
+ {
689
+ dest = &context->x[state.ngrn];
690
+ state.ngrn += elems;
691
+ extend_hfa_type(dest, a, h);
692
+ break;
693
+ }
694
+ state.nsrn = N_X_ARG_REG;
695
+ dest = allocate_to_stack(&state, stack, ty->alignment, s);
696
+ }
697
+ else
698
+ {
699
+ if (state.nsrn + elems <= N_V_ARG_REG)
700
+ {
701
+ dest = &context->v[state.nsrn];
702
+ state.nsrn += elems;
703
+ extend_hfa_type (dest, a, h);
704
+ break;
705
+ }
706
+ state.nsrn = N_V_ARG_REG;
707
+ dest = allocate_to_stack (&state, stack, ty->alignment, s);
708
+ }
663
709
  }
664
710
  else if (s > 16)
665
711
  {
@@ -681,7 +727,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
681
727
  X registers, then the argument is copied into
682
728
  consecutive X registers. */
683
729
  dest = &context->x[state.ngrn];
684
- state.ngrn += n;
730
+ state.ngrn += (unsigned int)n;
685
731
  }
686
732
  else
687
733
  {
@@ -756,6 +802,9 @@ ffi_prep_closure_loc (ffi_closure *closure,
756
802
 
757
803
  #if FFI_EXEC_TRAMPOLINE_TABLE
758
804
  #ifdef __MACH__
805
+ #ifdef HAVE_PTRAUTH
806
+ codeloc = ptrauth_strip (codeloc, ptrauth_key_asia);
807
+ #endif
759
808
  void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE);
760
809
  config[0] = closure;
761
810
  config[1] = start;
@@ -773,6 +822,16 @@ ffi_prep_closure_loc (ffi_closure *closure,
773
822
  *(UINT64 *)(tramp + 16) = (uintptr_t)start;
774
823
 
775
824
  ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
825
+
826
+ /* Also flush the cache for code mapping. */
827
+ #ifdef _WIN32
828
+ // Not using dlmalloc.c for Windows ARM64 builds
829
+ // so calling ffi_data_to_code_pointer() isn't necessary
830
+ unsigned char *tramp_code = tramp;
831
+ #else
832
+ unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
833
+ #endif
834
+ ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
776
835
  #endif
777
836
 
778
837
  closure->cif = cif;
@@ -871,55 +930,78 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
871
930
  if (h)
872
931
  {
873
932
  n = 4 - (h & 3);
874
- if (state.nsrn + n <= N_V_ARG_REG)
875
- {
876
- void *reg = &context->v[state.nsrn];
877
- state.nsrn += n;
878
-
879
- /* Eeek! We need a pointer to the structure, however the
880
- homogeneous float elements are being passed in individual
881
- registers, therefore for float and double the structure
882
- is not represented as a contiguous sequence of bytes in
883
- our saved register context. We don't need the original
884
- contents of the register storage, so we reformat the
885
- structure into the same memory. */
886
- avalue[i] = compress_hfa_type (reg, reg, h);
887
- }
888
- else
889
- {
890
- state.nsrn = N_V_ARG_REG;
891
- avalue[i] = allocate_to_stack (&state, stack,
892
- ty->alignment, s);
893
- }
894
- }
895
- else if (s > 16)
896
- {
897
- /* Replace Composite type of size greater than 16 with a
898
- pointer. */
899
- avalue[i] = *(void **)
900
- allocate_int_to_reg_or_stack (context, &state, stack,
901
- sizeof (void *));
902
- }
903
- else
904
- {
905
- n = (s + 7) / 8;
906
- if (state.ngrn + n <= N_X_ARG_REG)
907
- {
908
- avalue[i] = &context->x[state.ngrn];
909
- state.ngrn += n;
910
- }
911
- else
912
- {
913
- state.ngrn = N_X_ARG_REG;
914
- avalue[i] = allocate_to_stack (&state, stack,
915
- ty->alignment, s);
916
- }
917
- }
918
- break;
919
-
920
- default:
921
- abort();
922
- }
933
+ #ifdef _WIN32 /* for handling armasm calling convention */
934
+ if (cif->is_variadic)
935
+ {
936
+ if (state.ngrn + n <= N_X_ARG_REG)
937
+ {
938
+ void *reg = &context->x[state.ngrn];
939
+ state.ngrn += (unsigned int)n;
940
+
941
+ /* Eeek! We need a pointer to the structure, however the
942
+ homogeneous float elements are being passed in individual
943
+ registers, therefore for float and double the structure
944
+ is not represented as a contiguous sequence of bytes in
945
+ our saved register context. We don't need the original
946
+ contents of the register storage, so we reformat the
947
+ structure into the same memory. */
948
+ avalue[i] = compress_hfa_type(reg, reg, h);
949
+ }
950
+ else
951
+ {
952
+ state.ngrn = N_X_ARG_REG;
953
+ state.nsrn = N_V_ARG_REG;
954
+ avalue[i] = allocate_to_stack(&state, stack,
955
+ ty->alignment, s);
956
+ }
957
+ }
958
+ else
959
+ {
960
+ #endif /* for handling armasm calling convention */
961
+ if (state.nsrn + n <= N_V_ARG_REG)
962
+ {
963
+ void *reg = &context->v[state.nsrn];
964
+ state.nsrn += (unsigned int)n;
965
+ avalue[i] = compress_hfa_type(reg, reg, h);
966
+ }
967
+ else
968
+ {
969
+ state.nsrn = N_V_ARG_REG;
970
+ avalue[i] = allocate_to_stack(&state, stack,
971
+ ty->alignment, s);
972
+ }
973
+ #ifdef _WIN32 /* for handling armasm calling convention */
974
+ }
975
+ #endif /* for handling armasm calling convention */
976
+ }
977
+ else if (s > 16)
978
+ {
979
+ /* Replace Composite type of size greater than 16 with a
980
+ pointer. */
981
+ avalue[i] = *(void **)
982
+ allocate_int_to_reg_or_stack (context, &state, stack,
983
+ sizeof (void *));
984
+ }
985
+ else
986
+ {
987
+ n = (s + 7) / 8;
988
+ if (state.ngrn + n <= N_X_ARG_REG)
989
+ {
990
+ avalue[i] = &context->x[state.ngrn];
991
+ state.ngrn += (unsigned int)n;
992
+ }
993
+ else
994
+ {
995
+ state.ngrn = N_X_ARG_REG;
996
+ avalue[i] = allocate_to_stack(&state, stack,
997
+ ty->alignment, s);
998
+ }
999
+ }
1000
+ break;
1001
+
1002
+ default:
1003
+ abort();
1004
+ }
923
1005
 
924
1006
  #if defined (__APPLE__)
925
1007
  if (i + 1 == cif->aarch64_nfixedargs)
@@ -939,3 +1021,5 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
939
1021
 
940
1022
  return flags;
941
1023
  }
1024
+
1025
+ #endif /* (__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)*/