ffi 1.16.3 → 1.17.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (550) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +42 -0
  4. data/Gemfile +9 -2
  5. data/README.md +1 -1
  6. data/Rakefile +17 -5
  7. data/lib/ffi/autopointer.rb +1 -9
  8. data/lib/ffi/dynamic_library.rb +34 -5
  9. data/lib/ffi/enum.rb +0 -1
  10. data/lib/ffi/function.rb +1 -1
  11. data/lib/ffi/io.rb +2 -2
  12. data/lib/ffi/library.rb +23 -23
  13. data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
  14. data/lib/ffi/pointer.rb +6 -6
  15. data/lib/ffi/struct.rb +4 -4
  16. data/lib/ffi/struct_layout.rb +2 -2
  17. data/lib/ffi/struct_layout_builder.rb +8 -8
  18. data/lib/ffi/types.rb +51 -49
  19. data/lib/ffi/version.rb +1 -1
  20. data/sig/ffi/abstract_memory.rbs +165 -0
  21. data/sig/ffi/auto_pointer.rbs +27 -0
  22. data/sig/ffi/buffer.rbs +18 -0
  23. data/sig/ffi/data_converter.rbs +10 -0
  24. data/sig/ffi/dynamic_library.rbs +9 -0
  25. data/sig/ffi/enum.rbs +38 -0
  26. data/sig/ffi/function.rbs +39 -0
  27. data/sig/ffi/library.rbs +42 -0
  28. data/sig/ffi/native_type.rbs +86 -0
  29. data/sig/ffi/pointer.rbs +42 -0
  30. data/sig/ffi/struct.rbs +76 -0
  31. data/sig/ffi/struct_by_reference.rbs +11 -0
  32. data/sig/ffi/struct_by_value.rbs +7 -0
  33. data/sig/ffi/struct_layout.rbs +9 -0
  34. data/sig/ffi/struct_layout_builder.rbs +5 -0
  35. data/sig/ffi/type.rbs +39 -0
  36. data/sig/ffi.rbs +26 -0
  37. data.tar.gz.sig +0 -0
  38. metadata +34 -532
  39. metadata.gz.sig +0 -0
  40. data/ext/ffi_c/AbstractMemory.c +0 -1128
  41. data/ext/ffi_c/AbstractMemory.h +0 -176
  42. data/ext/ffi_c/ArrayType.c +0 -198
  43. data/ext/ffi_c/ArrayType.h +0 -60
  44. data/ext/ffi_c/Buffer.c +0 -417
  45. data/ext/ffi_c/Call.c +0 -498
  46. data/ext/ffi_c/Call.h +0 -107
  47. data/ext/ffi_c/ClosurePool.c +0 -333
  48. data/ext/ffi_c/ClosurePool.h +0 -59
  49. data/ext/ffi_c/DynamicLibrary.c +0 -397
  50. data/ext/ffi_c/DynamicLibrary.h +0 -98
  51. data/ext/ffi_c/Function.c +0 -1063
  52. data/ext/ffi_c/Function.h +0 -84
  53. data/ext/ffi_c/FunctionInfo.c +0 -322
  54. data/ext/ffi_c/LastError.c +0 -243
  55. data/ext/ffi_c/LastError.h +0 -47
  56. data/ext/ffi_c/LongDouble.c +0 -65
  57. data/ext/ffi_c/LongDouble.h +0 -47
  58. data/ext/ffi_c/MappedType.c +0 -211
  59. data/ext/ffi_c/MappedType.h +0 -57
  60. data/ext/ffi_c/MemoryPointer.c +0 -219
  61. data/ext/ffi_c/MemoryPointer.h +0 -49
  62. data/ext/ffi_c/MethodHandle.c +0 -350
  63. data/ext/ffi_c/MethodHandle.h +0 -56
  64. data/ext/ffi_c/Platform.c +0 -78
  65. data/ext/ffi_c/Platform.h +0 -45
  66. data/ext/ffi_c/Pointer.c +0 -546
  67. data/ext/ffi_c/Pointer.h +0 -60
  68. data/ext/ffi_c/Struct.c +0 -897
  69. data/ext/ffi_c/Struct.h +0 -115
  70. data/ext/ffi_c/StructByValue.c +0 -177
  71. data/ext/ffi_c/StructByValue.h +0 -55
  72. data/ext/ffi_c/StructLayout.c +0 -769
  73. data/ext/ffi_c/Thread.c +0 -129
  74. data/ext/ffi_c/Thread.h +0 -76
  75. data/ext/ffi_c/Type.c +0 -447
  76. data/ext/ffi_c/Type.h +0 -63
  77. data/ext/ffi_c/Types.c +0 -138
  78. data/ext/ffi_c/Types.h +0 -88
  79. data/ext/ffi_c/Variadic.c +0 -345
  80. data/ext/ffi_c/compat.h +0 -82
  81. data/ext/ffi_c/extconf.rb +0 -115
  82. data/ext/ffi_c/ffi.c +0 -97
  83. data/ext/ffi_c/libffi/.appveyor/site.exp +0 -16
  84. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +0 -7
  85. data/ext/ffi_c/libffi/.appveyor.yml +0 -84
  86. data/ext/ffi_c/libffi/.ci/ar-lib +0 -270
  87. data/ext/ffi_c/libffi/.ci/bfin-sim.exp +0 -58
  88. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +0 -18
  89. data/ext/ffi_c/libffi/.ci/build-in-container.sh +0 -10
  90. data/ext/ffi_c/libffi/.ci/build.sh +0 -124
  91. data/ext/ffi_c/libffi/.ci/compile +0 -351
  92. data/ext/ffi_c/libffi/.ci/install.sh +0 -78
  93. data/ext/ffi_c/libffi/.ci/m32r-sim.exp +0 -58
  94. data/ext/ffi_c/libffi/.ci/moxie-sim.exp +0 -60
  95. data/ext/ffi_c/libffi/.ci/msvs-detect +0 -1103
  96. data/ext/ffi_c/libffi/.ci/or1k-sim.exp +0 -58
  97. data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +0 -58
  98. data/ext/ffi_c/libffi/.ci/site.exp +0 -29
  99. data/ext/ffi_c/libffi/.ci/wine-sim.exp +0 -55
  100. data/ext/ffi_c/libffi/.circleci/config.yml +0 -156
  101. data/ext/ffi_c/libffi/.gitattributes +0 -4
  102. data/ext/ffi_c/libffi/.github/issue_template.md +0 -10
  103. data/ext/ffi_c/libffi/.github/workflows/build.yml +0 -460
  104. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +0 -171
  105. data/ext/ffi_c/libffi/.gitignore +0 -46
  106. data/ext/ffi_c/libffi/ChangeLog.old +0 -7407
  107. data/ext/ffi_c/libffi/LICENSE +0 -21
  108. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +0 -353
  109. data/ext/ffi_c/libffi/Makefile.am +0 -157
  110. data/ext/ffi_c/libffi/Makefile.in +0 -2127
  111. data/ext/ffi_c/libffi/README.md +0 -526
  112. data/ext/ffi_c/libffi/acinclude.m4 +0 -377
  113. data/ext/ffi_c/libffi/autogen.sh +0 -2
  114. data/ext/ffi_c/libffi/compile +0 -348
  115. data/ext/ffi_c/libffi/config.guess +0 -1754
  116. data/ext/ffi_c/libffi/config.sub +0 -1892
  117. data/ext/ffi_c/libffi/configure +0 -22791
  118. data/ext/ffi_c/libffi/configure.ac +0 -451
  119. data/ext/ffi_c/libffi/configure.host +0 -337
  120. data/ext/ffi_c/libffi/doc/Makefile.am +0 -3
  121. data/ext/ffi_c/libffi/doc/Makefile.in +0 -818
  122. data/ext/ffi_c/libffi/doc/libffi.texi +0 -1046
  123. data/ext/ffi_c/libffi/doc/version.texi +0 -4
  124. data/ext/ffi_c/libffi/fficonfig.h.in +0 -188
  125. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +0 -312
  126. data/ext/ffi_c/libffi/include/Makefile.am +0 -9
  127. data/ext/ffi_c/libffi/include/Makefile.in +0 -609
  128. data/ext/ffi_c/libffi/include/ffi.h.in +0 -527
  129. data/ext/ffi_c/libffi/include/ffi_cfi.h +0 -76
  130. data/ext/ffi_c/libffi/include/ffi_common.h +0 -182
  131. data/ext/ffi_c/libffi/include/tramp.h +0 -45
  132. data/ext/ffi_c/libffi/install-sh +0 -541
  133. data/ext/ffi_c/libffi/libffi.map.in +0 -76
  134. data/ext/ffi_c/libffi/libffi.pc.in +0 -11
  135. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +0 -997
  136. data/ext/ffi_c/libffi/libtool-ldflags +0 -106
  137. data/ext/ffi_c/libffi/libtool-version +0 -29
  138. data/ext/ffi_c/libffi/ltmain.sh +0 -11448
  139. data/ext/ffi_c/libffi/m4/asmcfi.m4 +0 -13
  140. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +0 -50
  141. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +0 -198
  142. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +0 -158
  143. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +0 -53
  144. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +0 -119
  145. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +0 -49
  146. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +0 -302
  147. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +0 -267
  148. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +0 -89
  149. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +0 -51
  150. data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +0 -37
  151. data/ext/ffi_c/libffi/make_sunver.pl +0 -333
  152. data/ext/ffi_c/libffi/man/Makefile.am +0 -8
  153. data/ext/ffi_c/libffi/man/Makefile.in +0 -565
  154. data/ext/ffi_c/libffi/man/ffi.3 +0 -41
  155. data/ext/ffi_c/libffi/man/ffi_call.3 +0 -103
  156. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +0 -68
  157. data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +0 -73
  158. data/ext/ffi_c/libffi/missing +0 -215
  159. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +0 -33
  160. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +0 -130
  161. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +0 -57
  162. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +0 -4
  163. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +0 -511
  164. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +0 -219
  165. data/ext/ffi_c/libffi/msvcc.sh +0 -353
  166. data/ext/ffi_c/libffi/src/aarch64/ffi.c +0 -1129
  167. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +0 -97
  168. data/ext/ffi_c/libffi/src/aarch64/internal.h +0 -100
  169. data/ext/ffi_c/libffi/src/aarch64/sysv.S +0 -543
  170. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +0 -506
  171. data/ext/ffi_c/libffi/src/alpha/ffi.c +0 -521
  172. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +0 -57
  173. data/ext/ffi_c/libffi/src/alpha/internal.h +0 -23
  174. data/ext/ffi_c/libffi/src/alpha/osf.S +0 -282
  175. data/ext/ffi_c/libffi/src/arc/arcompact.S +0 -210
  176. data/ext/ffi_c/libffi/src/arc/ffi.c +0 -443
  177. data/ext/ffi_c/libffi/src/arc/ffitarget.h +0 -67
  178. data/ext/ffi_c/libffi/src/arm/ffi.c +0 -921
  179. data/ext/ffi_c/libffi/src/arm/ffitarget.h +0 -89
  180. data/ext/ffi_c/libffi/src/arm/internal.h +0 -17
  181. data/ext/ffi_c/libffi/src/arm/sysv.S +0 -456
  182. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +0 -311
  183. data/ext/ffi_c/libffi/src/avr32/ffi.c +0 -423
  184. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +0 -55
  185. data/ext/ffi_c/libffi/src/avr32/sysv.S +0 -208
  186. data/ext/ffi_c/libffi/src/bfin/ffi.c +0 -196
  187. data/ext/ffi_c/libffi/src/bfin/ffitarget.h +0 -43
  188. data/ext/ffi_c/libffi/src/bfin/sysv.S +0 -179
  189. data/ext/ffi_c/libffi/src/closures.c +0 -1107
  190. data/ext/ffi_c/libffi/src/cris/ffi.c +0 -386
  191. data/ext/ffi_c/libffi/src/cris/ffitarget.h +0 -56
  192. data/ext/ffi_c/libffi/src/cris/sysv.S +0 -215
  193. data/ext/ffi_c/libffi/src/csky/ffi.c +0 -395
  194. data/ext/ffi_c/libffi/src/csky/ffitarget.h +0 -63
  195. data/ext/ffi_c/libffi/src/csky/sysv.S +0 -371
  196. data/ext/ffi_c/libffi/src/debug.c +0 -64
  197. data/ext/ffi_c/libffi/src/dlmalloc.c +0 -5171
  198. data/ext/ffi_c/libffi/src/frv/eabi.S +0 -128
  199. data/ext/ffi_c/libffi/src/frv/ffi.c +0 -292
  200. data/ext/ffi_c/libffi/src/frv/ffitarget.h +0 -62
  201. data/ext/ffi_c/libffi/src/ia64/ffi.c +0 -616
  202. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +0 -56
  203. data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +0 -40
  204. data/ext/ffi_c/libffi/src/ia64/unix.S +0 -585
  205. data/ext/ffi_c/libffi/src/java_raw_api.c +0 -374
  206. data/ext/ffi_c/libffi/src/kvx/asm.h +0 -5
  207. data/ext/ffi_c/libffi/src/kvx/ffi.c +0 -273
  208. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +0 -75
  209. data/ext/ffi_c/libffi/src/kvx/sysv.S +0 -127
  210. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +0 -621
  211. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +0 -82
  212. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +0 -327
  213. data/ext/ffi_c/libffi/src/m32r/ffi.c +0 -249
  214. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +0 -53
  215. data/ext/ffi_c/libffi/src/m32r/sysv.S +0 -121
  216. data/ext/ffi_c/libffi/src/m68k/ffi.c +0 -362
  217. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +0 -54
  218. data/ext/ffi_c/libffi/src/m68k/sysv.S +0 -357
  219. data/ext/ffi_c/libffi/src/m88k/ffi.c +0 -400
  220. data/ext/ffi_c/libffi/src/m88k/ffitarget.h +0 -49
  221. data/ext/ffi_c/libffi/src/m88k/obsd.S +0 -209
  222. data/ext/ffi_c/libffi/src/metag/ffi.c +0 -330
  223. data/ext/ffi_c/libffi/src/metag/ffitarget.h +0 -53
  224. data/ext/ffi_c/libffi/src/metag/sysv.S +0 -311
  225. data/ext/ffi_c/libffi/src/microblaze/ffi.c +0 -321
  226. data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +0 -53
  227. data/ext/ffi_c/libffi/src/microblaze/sysv.S +0 -302
  228. data/ext/ffi_c/libffi/src/mips/ffi.c +0 -1309
  229. data/ext/ffi_c/libffi/src/mips/ffitarget.h +0 -251
  230. data/ext/ffi_c/libffi/src/mips/n32.S +0 -772
  231. data/ext/ffi_c/libffi/src/mips/o32.S +0 -561
  232. data/ext/ffi_c/libffi/src/moxie/eabi.S +0 -101
  233. data/ext/ffi_c/libffi/src/moxie/ffi.c +0 -310
  234. data/ext/ffi_c/libffi/src/moxie/ffitarget.h +0 -52
  235. data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
  236. data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
  237. data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
  238. data/ext/ffi_c/libffi/src/or1k/ffi.c +0 -341
  239. data/ext/ffi_c/libffi/src/or1k/ffitarget.h +0 -58
  240. data/ext/ffi_c/libffi/src/or1k/sysv.S +0 -107
  241. data/ext/ffi_c/libffi/src/pa/ffi.c +0 -673
  242. data/ext/ffi_c/libffi/src/pa/ffi64.c +0 -614
  243. data/ext/ffi_c/libffi/src/pa/ffitarget.h +0 -94
  244. data/ext/ffi_c/libffi/src/pa/hpux32.S +0 -417
  245. data/ext/ffi_c/libffi/src/pa/hpux64.S +0 -681
  246. data/ext/ffi_c/libffi/src/pa/linux.S +0 -427
  247. data/ext/ffi_c/libffi/src/powerpc/aix.S +0 -566
  248. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +0 -694
  249. data/ext/ffi_c/libffi/src/powerpc/asm.h +0 -125
  250. data/ext/ffi_c/libffi/src/powerpc/darwin.S +0 -378
  251. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +0 -571
  252. data/ext/ffi_c/libffi/src/powerpc/ffi.c +0 -175
  253. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +0 -1452
  254. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +0 -1153
  255. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +0 -105
  256. data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +0 -923
  257. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +0 -204
  258. data/ext/ffi_c/libffi/src/powerpc/linux64.S +0 -293
  259. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +0 -566
  260. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +0 -397
  261. data/ext/ffi_c/libffi/src/powerpc/sysv.S +0 -173
  262. data/ext/ffi_c/libffi/src/powerpc/t-aix +0 -5
  263. data/ext/ffi_c/libffi/src/prep_cif.c +0 -283
  264. data/ext/ffi_c/libffi/src/raw_api.c +0 -267
  265. data/ext/ffi_c/libffi/src/riscv/ffi.c +0 -514
  266. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +0 -69
  267. data/ext/ffi_c/libffi/src/riscv/sysv.S +0 -293
  268. data/ext/ffi_c/libffi/src/s390/ffi.c +0 -756
  269. data/ext/ffi_c/libffi/src/s390/ffitarget.h +0 -70
  270. data/ext/ffi_c/libffi/src/s390/internal.h +0 -11
  271. data/ext/ffi_c/libffi/src/s390/sysv.S +0 -325
  272. data/ext/ffi_c/libffi/src/sh/ffi.c +0 -717
  273. data/ext/ffi_c/libffi/src/sh/ffitarget.h +0 -54
  274. data/ext/ffi_c/libffi/src/sh/sysv.S +0 -850
  275. data/ext/ffi_c/libffi/src/sh64/ffi.c +0 -469
  276. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +0 -58
  277. data/ext/ffi_c/libffi/src/sh64/sysv.S +0 -539
  278. data/ext/ffi_c/libffi/src/sparc/ffi.c +0 -468
  279. data/ext/ffi_c/libffi/src/sparc/ffi64.c +0 -624
  280. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +0 -81
  281. data/ext/ffi_c/libffi/src/sparc/internal.h +0 -26
  282. data/ext/ffi_c/libffi/src/sparc/v8.S +0 -443
  283. data/ext/ffi_c/libffi/src/sparc/v9.S +0 -440
  284. data/ext/ffi_c/libffi/src/tile/ffi.c +0 -355
  285. data/ext/ffi_c/libffi/src/tile/ffitarget.h +0 -65
  286. data/ext/ffi_c/libffi/src/tile/tile.S +0 -360
  287. data/ext/ffi_c/libffi/src/tramp.c +0 -716
  288. data/ext/ffi_c/libffi/src/types.c +0 -108
  289. data/ext/ffi_c/libffi/src/vax/elfbsd.S +0 -195
  290. data/ext/ffi_c/libffi/src/vax/ffi.c +0 -276
  291. data/ext/ffi_c/libffi/src/vax/ffitarget.h +0 -49
  292. data/ext/ffi_c/libffi/src/wasm32/ffi.c +0 -934
  293. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +0 -62
  294. data/ext/ffi_c/libffi/src/x86/asmnames.h +0 -30
  295. data/ext/ffi_c/libffi/src/x86/ffi.c +0 -832
  296. data/ext/ffi_c/libffi/src/x86/ffi64.c +0 -950
  297. data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -164
  298. data/ext/ffi_c/libffi/src/x86/ffiw64.c +0 -361
  299. data/ext/ffi_c/libffi/src/x86/internal.h +0 -43
  300. data/ext/ffi_c/libffi/src/x86/internal64.h +0 -36
  301. data/ext/ffi_c/libffi/src/x86/sysv.S +0 -1272
  302. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +0 -998
  303. data/ext/ffi_c/libffi/src/x86/unix64.S +0 -711
  304. data/ext/ffi_c/libffi/src/x86/win64.S +0 -254
  305. data/ext/ffi_c/libffi/src/x86/win64_intel.S +0 -238
  306. data/ext/ffi_c/libffi/src/xtensa/ffi.c +0 -306
  307. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +0 -57
  308. data/ext/ffi_c/libffi/src/xtensa/sysv.S +0 -268
  309. data/ext/ffi_c/libffi/stamp-h.in +0 -1
  310. data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -135
  311. data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -664
  312. data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
  313. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +0 -54
  314. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +0 -63
  315. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +0 -80
  316. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +0 -48
  317. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +0 -7
  318. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +0 -51
  319. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -682
  320. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
  321. data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
  322. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +0 -28
  323. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +0 -78
  324. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +0 -50
  325. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +0 -63
  326. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +0 -1746
  327. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +0 -2885
  328. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +0 -747
  329. data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
  330. data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +0 -46
  331. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +0 -41
  332. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -54
  333. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
  334. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -163
  335. data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
  336. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
  337. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -61
  338. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
  339. data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
  340. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -110
  341. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
  342. data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
  343. data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
  344. data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
  345. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
  346. data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
  347. data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
  348. data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
  349. data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc_tc.c +0 -114
  350. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
  351. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
  352. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
  353. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
  354. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
  355. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
  356. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
  357. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
  358. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
  359. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -48
  360. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
  361. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -42
  362. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
  363. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -42
  364. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +0 -60
  365. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -43
  366. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
  367. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
  368. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
  369. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
  370. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +0 -57
  371. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
  372. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
  373. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
  374. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
  375. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
  376. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
  377. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
  378. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
  379. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +0 -63
  380. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +0 -65
  381. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +0 -65
  382. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +0 -67
  383. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +0 -67
  384. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +0 -93
  385. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +0 -61
  386. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +0 -63
  387. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +0 -90
  388. data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
  389. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -78
  390. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +0 -220
  391. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +0 -154
  392. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -134
  393. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -134
  394. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -140
  395. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +0 -67
  396. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +0 -90
  397. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +0 -83
  398. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +0 -83
  399. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +0 -102
  400. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +0 -91
  401. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +0 -94
  402. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +0 -92
  403. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +0 -96
  404. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +0 -61
  405. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +0 -112
  406. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +0 -117
  407. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +0 -120
  408. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +0 -131
  409. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +0 -93
  410. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +0 -109
  411. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +0 -113
  412. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +0 -145
  413. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +0 -103
  414. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +0 -114
  415. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +0 -103
  416. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +0 -103
  417. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +0 -113
  418. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +0 -120
  419. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +0 -103
  420. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +0 -137
  421. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +0 -116
  422. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +0 -148
  423. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +0 -140
  424. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +0 -121
  425. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +0 -155
  426. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +0 -121
  427. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +0 -102
  428. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +0 -103
  429. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +0 -103
  430. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +0 -111
  431. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +0 -109
  432. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +0 -111
  433. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +0 -147
  434. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +0 -152
  435. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +0 -113
  436. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +0 -108
  437. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +0 -106
  438. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +0 -109
  439. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +0 -108
  440. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +0 -109
  441. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +0 -111
  442. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +0 -68
  443. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double.c +0 -43
  444. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +0 -69
  445. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +0 -46
  446. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +0 -115
  447. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +0 -80
  448. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +0 -70
  449. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +0 -55
  450. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +0 -78
  451. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +0 -79
  452. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +0 -94
  453. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +0 -99
  454. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +0 -78
  455. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +0 -94
  456. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +0 -79
  457. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +0 -152
  458. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +0 -47
  459. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +0 -44
  460. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +0 -45
  461. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +0 -125
  462. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +0 -45
  463. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +0 -47
  464. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +0 -49
  465. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +0 -49
  466. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +0 -49
  467. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +0 -46
  468. data/ext/ffi_c/libffi/testsuite/libffi.closures/err_bad_abi.c +0 -36
  469. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +0 -1
  470. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +0 -343
  471. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +0 -175
  472. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +0 -161
  473. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +0 -146
  474. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +0 -137
  475. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +0 -86
  476. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +0 -115
  477. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +0 -119
  478. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +0 -120
  479. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +0 -120
  480. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +0 -121
  481. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +0 -142
  482. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +0 -120
  483. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +0 -142
  484. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +0 -142
  485. data/ext/ffi_c/libffi/testsuite/libffi.closures/problem1.c +0 -90
  486. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +0 -86
  487. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +0 -102
  488. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +0 -101
  489. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large.c +0 -145
  490. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large2.c +0 -148
  491. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +0 -124
  492. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +0 -125
  493. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +0 -75
  494. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +0 -118
  495. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +0 -55
  496. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
  497. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
  498. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
  499. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
  500. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
  501. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
  502. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
  503. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
  504. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
  505. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
  506. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
  507. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
  508. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
  509. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
  510. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
  511. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
  512. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
  513. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
  514. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
  515. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
  516. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
  517. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
  518. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
  519. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
  520. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
  521. data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
  522. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
  523. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
  524. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
  525. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
  526. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
  527. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
  528. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
  529. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
  530. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
  531. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
  532. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
  533. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
  534. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
  535. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
  536. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
  537. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
  538. data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
  539. data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
  540. data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
  541. data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
  542. data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
  543. data/ext/ffi_c/libffi.bsd.mk +0 -40
  544. data/ext/ffi_c/libffi.darwin.mk +0 -105
  545. data/ext/ffi_c/libffi.gnu.mk +0 -32
  546. data/ext/ffi_c/libffi.mk +0 -18
  547. data/ext/ffi_c/libffi.vc.mk +0 -26
  548. data/ext/ffi_c/libffi.vc64.mk +0 -26
  549. data/ext/ffi_c/rbffi.h +0 -55
  550. data/ext/ffi_c/rbffi_endian.h +0 -59
@@ -1,1129 +0,0 @@
1
- /* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- ``Software''), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
21
-
22
- #if defined(__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)
23
- #include <stdio.h>
24
- #include <stdlib.h>
25
- #include <stdint.h>
26
- #include <fficonfig.h>
27
- #include <ffi.h>
28
- #include <ffi_common.h>
29
- #include "internal.h"
30
- #ifdef _WIN32
31
- #include <windows.h> /* FlushInstructionCache */
32
- #endif
33
- #include <tramp.h>
34
-
35
- /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
36
- all further uses in this file will refer to the 128-bit type. */
37
- #if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE
38
- # if FFI_TYPE_LONGDOUBLE != 4
39
- # error FFI_TYPE_LONGDOUBLE out of date
40
- # endif
41
- #else
42
- # undef FFI_TYPE_LONGDOUBLE
43
- # define FFI_TYPE_LONGDOUBLE 4
44
- #endif
45
-
46
- union _d
47
- {
48
- UINT64 d;
49
- UINT32 s[2];
50
- };
51
-
52
- struct _v
53
- {
54
- union _d d[2] __attribute__((aligned(16)));
55
- };
56
-
57
- struct call_context
58
- {
59
- struct _v v[N_V_ARG_REG];
60
- UINT64 x[N_X_ARG_REG];
61
- };
62
-
63
- #if FFI_EXEC_TRAMPOLINE_TABLE
64
-
65
- #ifdef __MACH__
66
- #ifdef HAVE_PTRAUTH
67
- #include <ptrauth.h>
68
- #endif
69
- #include <mach/vm_param.h>
70
- #endif
71
-
72
- #else
73
-
74
- #if defined (__clang__) && defined (__APPLE__)
75
- extern void sys_icache_invalidate (void *start, size_t len);
76
- #endif
77
-
78
- static inline void
79
- ffi_clear_cache (void *start, void *end)
80
- {
81
- #if defined (__clang__) && defined (__APPLE__)
82
- sys_icache_invalidate (start, (char *)end - (char *)start);
83
- #elif defined (__GNUC__)
84
- __builtin___clear_cache (start, end);
85
- #elif defined (_WIN32)
86
- FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start);
87
- #else
88
- #error "Missing builtin to flush instruction cache"
89
- #endif
90
- }
91
-
92
- #endif
93
-
94
- /* A subroutine of is_vfp_type. Given a structure type, return the type code
95
- of the first non-structure element. Recurse for structure elements.
96
- Return -1 if the structure is in fact empty, i.e. no nested elements. */
97
-
98
- static int
99
- is_hfa0 (const ffi_type *ty)
100
- {
101
- ffi_type **elements = ty->elements;
102
- int i, ret = -1;
103
-
104
- if (elements != NULL)
105
- for (i = 0; elements[i]; ++i)
106
- {
107
- ret = elements[i]->type;
108
- if (ret == FFI_TYPE_STRUCT || ret == FFI_TYPE_COMPLEX)
109
- {
110
- ret = is_hfa0 (elements[i]);
111
- if (ret < 0)
112
- continue;
113
- }
114
- break;
115
- }
116
-
117
- return ret;
118
- }
119
-
120
- /* A subroutine of is_vfp_type. Given a structure type, return true if all
121
- of the non-structure elements are the same as CANDIDATE. */
122
-
123
- static int
124
- is_hfa1 (const ffi_type *ty, int candidate)
125
- {
126
- ffi_type **elements = ty->elements;
127
- int i;
128
-
129
- if (elements != NULL)
130
- for (i = 0; elements[i]; ++i)
131
- {
132
- int t = elements[i]->type;
133
- if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX)
134
- {
135
- if (!is_hfa1 (elements[i], candidate))
136
- return 0;
137
- }
138
- else if (t != candidate)
139
- return 0;
140
- }
141
-
142
- return 1;
143
- }
144
-
145
- /* Determine if TY may be allocated to the FP registers. This is both an
146
- fp scalar type as well as an homogenous floating point aggregate (HFA).
147
- That is, a structure consisting of 1 to 4 members of all the same type,
148
- where that type is an fp scalar.
149
-
150
- Returns non-zero iff TY is an HFA. The result is the AARCH64_RET_*
151
- constant for the type. */
152
-
153
- static int
154
- is_vfp_type (const ffi_type *ty)
155
- {
156
- ffi_type **elements;
157
- int candidate, i;
158
- size_t size, ele_count;
159
-
160
- /* Quickest tests first. */
161
- candidate = ty->type;
162
- switch (candidate)
163
- {
164
- default:
165
- return 0;
166
- case FFI_TYPE_FLOAT:
167
- case FFI_TYPE_DOUBLE:
168
- case FFI_TYPE_LONGDOUBLE:
169
- ele_count = 1;
170
- goto done;
171
- case FFI_TYPE_COMPLEX:
172
- candidate = ty->elements[0]->type;
173
- switch (candidate)
174
- {
175
- case FFI_TYPE_FLOAT:
176
- case FFI_TYPE_DOUBLE:
177
- case FFI_TYPE_LONGDOUBLE:
178
- ele_count = 2;
179
- goto done;
180
- }
181
- return 0;
182
- case FFI_TYPE_STRUCT:
183
- break;
184
- }
185
-
186
- /* No HFA types are smaller than 4 bytes, or larger than 64 bytes. */
187
- size = ty->size;
188
- if (size < 4 || size > 64)
189
- return 0;
190
-
191
- /* Find the type of the first non-structure member. */
192
- elements = ty->elements;
193
- candidate = elements[0]->type;
194
- if (candidate == FFI_TYPE_STRUCT || candidate == FFI_TYPE_COMPLEX)
195
- {
196
- for (i = 0; ; ++i)
197
- {
198
- candidate = is_hfa0 (elements[i]);
199
- if (candidate >= 0)
200
- break;
201
- }
202
- }
203
-
204
- /* If the first member is not a floating point type, it's not an HFA.
205
- Also quickly re-check the size of the structure. */
206
- switch (candidate)
207
- {
208
- case FFI_TYPE_FLOAT:
209
- ele_count = size / sizeof(float);
210
- if (size != ele_count * sizeof(float))
211
- return 0;
212
- break;
213
- case FFI_TYPE_DOUBLE:
214
- ele_count = size / sizeof(double);
215
- if (size != ele_count * sizeof(double))
216
- return 0;
217
- break;
218
- case FFI_TYPE_LONGDOUBLE:
219
- ele_count = size / sizeof(long double);
220
- if (size != ele_count * sizeof(long double))
221
- return 0;
222
- break;
223
- default:
224
- return 0;
225
- }
226
- if (ele_count > 4)
227
- return 0;
228
-
229
- /* Finally, make sure that all scalar elements are the same type. */
230
- for (i = 0; elements[i]; ++i)
231
- {
232
- int t = elements[i]->type;
233
- if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX)
234
- {
235
- if (!is_hfa1 (elements[i], candidate))
236
- return 0;
237
- }
238
- else if (t != candidate)
239
- return 0;
240
- }
241
-
242
- /* All tests succeeded. Encode the result. */
243
- done:
244
- return candidate * 4 + (4 - (int)ele_count);
245
- }
246
-
247
- /* Representation of the procedure call argument marshalling
248
- state.
249
-
250
- The terse state variable names match the names used in the AARCH64
251
- PCS.
252
-
253
- The struct area is allocated downwards from the top of the argument
254
- area. It is used to hold copies of structures passed by value that are
255
- bigger than 16 bytes. */
256
-
257
- struct arg_state
258
- {
259
- unsigned ngrn; /* Next general-purpose register number. */
260
- unsigned nsrn; /* Next vector register number. */
261
- size_t nsaa; /* Next stack offset. */
262
- size_t next_struct_area; /* Place to allocate big structs. */
263
-
264
- #if defined (__APPLE__)
265
- unsigned allocating_variadic;
266
- #endif
267
- };
268
-
269
- /* Initialize a procedure call argument marshalling state. */
270
- static void
271
- arg_init (struct arg_state *state, size_t size)
272
- {
273
- state->ngrn = 0;
274
- state->nsrn = 0;
275
- state->nsaa = 0;
276
- state->next_struct_area = size;
277
- #if defined (__APPLE__)
278
- state->allocating_variadic = 0;
279
- #endif
280
- }
281
-
282
- /* Allocate an aligned slot on the stack and return a pointer to it. */
283
- static void *
284
- allocate_to_stack (struct arg_state *state, void *stack,
285
- size_t alignment, size_t size)
286
- {
287
- size_t nsaa = state->nsaa;
288
-
289
- /* Round up the NSAA to the larger of 8 or the natural
290
- alignment of the argument's type. */
291
- #if defined (__APPLE__)
292
- if (state->allocating_variadic && alignment < 8)
293
- alignment = 8;
294
- #else
295
- if (alignment < 8)
296
- alignment = 8;
297
- #endif
298
-
299
- nsaa = FFI_ALIGN (nsaa, alignment);
300
- state->nsaa = nsaa + size;
301
-
302
- return (char *)stack + nsaa;
303
- }
304
-
305
- /* Allocate and copy a structure that is passed by value on the stack and
306
- return a pointer to it. */
307
- static void *
308
- allocate_and_copy_struct_to_stack (struct arg_state *state, void *stack,
309
- size_t alignment, size_t size, void *value)
310
- {
311
- size_t dest = state->next_struct_area - size;
312
-
313
- /* Round down to the natural alignment of the value. */
314
- dest = FFI_ALIGN_DOWN (dest, alignment);
315
- state->next_struct_area = dest;
316
-
317
- return memcpy ((char *) stack + dest, value, size);
318
- }
319
-
320
- static ffi_arg
321
- extend_integer_type (void *source, int type)
322
- {
323
- switch (type)
324
- {
325
- case FFI_TYPE_UINT8:
326
- {
327
- UINT8 u8;
328
- memcpy (&u8, source, sizeof (u8));
329
- return u8;
330
- }
331
- case FFI_TYPE_SINT8:
332
- {
333
- SINT8 s8;
334
- memcpy (&s8, source, sizeof (s8));
335
- return s8;
336
- }
337
- case FFI_TYPE_UINT16:
338
- {
339
- UINT16 u16;
340
- memcpy (&u16, source, sizeof (u16));
341
- return u16;
342
- }
343
- case FFI_TYPE_SINT16:
344
- {
345
- SINT16 s16;
346
- memcpy (&s16, source, sizeof (s16));
347
- return s16;
348
- }
349
- case FFI_TYPE_UINT32:
350
- {
351
- UINT32 u32;
352
- memcpy (&u32, source, sizeof (u32));
353
- return u32;
354
- }
355
- case FFI_TYPE_INT:
356
- case FFI_TYPE_SINT32:
357
- {
358
- SINT32 s32;
359
- memcpy (&s32, source, sizeof (s32));
360
- return s32;
361
- }
362
- case FFI_TYPE_UINT64:
363
- case FFI_TYPE_SINT64:
364
- {
365
- UINT64 u64;
366
- memcpy (&u64, source, sizeof (u64));
367
- return u64;
368
- }
369
- case FFI_TYPE_POINTER:
370
- {
371
- uintptr_t uptr;
372
- memcpy (&uptr, source, sizeof (uptr));
373
- return uptr;
374
- }
375
- default:
376
- abort();
377
- }
378
- }
379
-
380
- #if defined(_MSC_VER)
381
- void extend_hfa_type (void *dest, void *src, int h);
382
- #else
383
- static void
384
- extend_hfa_type (void *dest, void *src, int h)
385
- {
386
- ssize_t f = h - AARCH64_RET_S4;
387
- void *x0;
388
-
389
- asm volatile (
390
- "adr %0, 0f\n"
391
- " add %0, %0, %1\n"
392
- " br %0\n"
393
- "0: ldp s16, s17, [%3]\n" /* S4 */
394
- " ldp s18, s19, [%3, #8]\n"
395
- " b 4f\n"
396
- " ldp s16, s17, [%3]\n" /* S3 */
397
- " ldr s18, [%3, #8]\n"
398
- " b 3f\n"
399
- " ldp s16, s17, [%3]\n" /* S2 */
400
- " b 2f\n"
401
- " nop\n"
402
- " ldr s16, [%3]\n" /* S1 */
403
- " b 1f\n"
404
- " nop\n"
405
- " ldp d16, d17, [%3]\n" /* D4 */
406
- " ldp d18, d19, [%3, #16]\n"
407
- " b 4f\n"
408
- " ldp d16, d17, [%3]\n" /* D3 */
409
- " ldr d18, [%3, #16]\n"
410
- " b 3f\n"
411
- " ldp d16, d17, [%3]\n" /* D2 */
412
- " b 2f\n"
413
- " nop\n"
414
- " ldr d16, [%3]\n" /* D1 */
415
- " b 1f\n"
416
- " nop\n"
417
- " ldp q16, q17, [%3]\n" /* Q4 */
418
- " ldp q18, q19, [%3, #32]\n"
419
- " b 4f\n"
420
- " ldp q16, q17, [%3]\n" /* Q3 */
421
- " ldr q18, [%3, #32]\n"
422
- " b 3f\n"
423
- " ldp q16, q17, [%3]\n" /* Q2 */
424
- " b 2f\n"
425
- " nop\n"
426
- " ldr q16, [%3]\n" /* Q1 */
427
- " b 1f\n"
428
- "4: str q19, [%2, #48]\n"
429
- "3: str q18, [%2, #32]\n"
430
- "2: str q17, [%2, #16]\n"
431
- "1: str q16, [%2]"
432
- : "=&r"(x0)
433
- : "r"(f * 12), "r"(dest), "r"(src)
434
- : "memory", "v16", "v17", "v18", "v19");
435
- }
436
- #endif
437
-
438
- #if defined(_MSC_VER)
439
- void* compress_hfa_type (void *dest, void *src, int h);
440
- #else
441
- static void *
442
- compress_hfa_type (void *dest, void *reg, int h)
443
- {
444
- switch (h)
445
- {
446
- case AARCH64_RET_S1:
447
- if (dest == reg)
448
- {
449
- #ifdef __AARCH64EB__
450
- dest += 12;
451
- #endif
452
- }
453
- else
454
- *(float *)dest = *(float *)reg;
455
- break;
456
- case AARCH64_RET_S2:
457
- asm ("ldp q16, q17, [%1]\n\t"
458
- "st2 { v16.s, v17.s }[0], [%0]"
459
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17");
460
- break;
461
- case AARCH64_RET_S3:
462
- asm ("ldp q16, q17, [%1]\n\t"
463
- "ldr q18, [%1, #32]\n\t"
464
- "st3 { v16.s, v17.s, v18.s }[0], [%0]"
465
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18");
466
- break;
467
- case AARCH64_RET_S4:
468
- asm ("ldp q16, q17, [%1]\n\t"
469
- "ldp q18, q19, [%1, #32]\n\t"
470
- "st4 { v16.s, v17.s, v18.s, v19.s }[0], [%0]"
471
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18", "v19");
472
- break;
473
-
474
- case AARCH64_RET_D1:
475
- if (dest == reg)
476
- {
477
- #ifdef __AARCH64EB__
478
- dest += 8;
479
- #endif
480
- }
481
- else
482
- *(double *)dest = *(double *)reg;
483
- break;
484
- case AARCH64_RET_D2:
485
- asm ("ldp q16, q17, [%1]\n\t"
486
- "st2 { v16.d, v17.d }[0], [%0]"
487
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17");
488
- break;
489
- case AARCH64_RET_D3:
490
- asm ("ldp q16, q17, [%1]\n\t"
491
- "ldr q18, [%1, #32]\n\t"
492
- "st3 { v16.d, v17.d, v18.d }[0], [%0]"
493
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18");
494
- break;
495
- case AARCH64_RET_D4:
496
- asm ("ldp q16, q17, [%1]\n\t"
497
- "ldp q18, q19, [%1, #32]\n\t"
498
- "st4 { v16.d, v17.d, v18.d, v19.d }[0], [%0]"
499
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18", "v19");
500
- break;
501
-
502
- default:
503
- if (dest != reg)
504
- return memcpy (dest, reg, 16 * (4 - (h & 3)));
505
- break;
506
- }
507
- return dest;
508
- }
509
- #endif
510
-
511
- /* Either allocate an appropriate register for the argument type, or if
512
- none are available, allocate a stack slot and return a pointer
513
- to the allocated space. */
514
-
515
- static void *
516
- allocate_int_to_reg_or_stack (struct call_context *context,
517
- struct arg_state *state,
518
- void *stack, size_t size)
519
- {
520
- if (state->ngrn < N_X_ARG_REG)
521
- return &context->x[state->ngrn++];
522
-
523
- state->ngrn = N_X_ARG_REG;
524
- return allocate_to_stack (state, stack, size, size);
525
- }
526
-
527
- ffi_status FFI_HIDDEN
528
- ffi_prep_cif_machdep (ffi_cif *cif)
529
- {
530
- ffi_type *rtype = cif->rtype;
531
- size_t bytes = cif->bytes;
532
- int flags, i, n;
533
-
534
- switch (rtype->type)
535
- {
536
- case FFI_TYPE_VOID:
537
- flags = AARCH64_RET_VOID;
538
- break;
539
- case FFI_TYPE_UINT8:
540
- flags = AARCH64_RET_UINT8;
541
- break;
542
- case FFI_TYPE_UINT16:
543
- flags = AARCH64_RET_UINT16;
544
- break;
545
- case FFI_TYPE_UINT32:
546
- flags = AARCH64_RET_UINT32;
547
- break;
548
- case FFI_TYPE_SINT8:
549
- flags = AARCH64_RET_SINT8;
550
- break;
551
- case FFI_TYPE_SINT16:
552
- flags = AARCH64_RET_SINT16;
553
- break;
554
- case FFI_TYPE_INT:
555
- case FFI_TYPE_SINT32:
556
- flags = AARCH64_RET_SINT32;
557
- break;
558
- case FFI_TYPE_SINT64:
559
- case FFI_TYPE_UINT64:
560
- flags = AARCH64_RET_INT64;
561
- break;
562
- case FFI_TYPE_POINTER:
563
- flags = (sizeof(void *) == 4 ? AARCH64_RET_UINT32 : AARCH64_RET_INT64);
564
- break;
565
-
566
- case FFI_TYPE_FLOAT:
567
- case FFI_TYPE_DOUBLE:
568
- case FFI_TYPE_LONGDOUBLE:
569
- case FFI_TYPE_STRUCT:
570
- case FFI_TYPE_COMPLEX:
571
- flags = is_vfp_type (rtype);
572
- if (flags == 0)
573
- {
574
- size_t s = rtype->size;
575
- if (s > 16)
576
- {
577
- flags = AARCH64_RET_VOID | AARCH64_RET_IN_MEM;
578
- bytes += 8;
579
- }
580
- else if (s == 16)
581
- flags = AARCH64_RET_INT128;
582
- else if (s == 8)
583
- flags = AARCH64_RET_INT64;
584
- else
585
- flags = AARCH64_RET_INT128 | AARCH64_RET_NEED_COPY;
586
- }
587
- break;
588
-
589
- default:
590
- abort();
591
- }
592
-
593
- for (i = 0, n = cif->nargs; i < n; i++)
594
- if (is_vfp_type (cif->arg_types[i]))
595
- {
596
- flags |= AARCH64_FLAG_ARG_V;
597
- break;
598
- }
599
-
600
- /* Round the stack up to a multiple of the stack alignment requirement. */
601
- cif->bytes = (unsigned) FFI_ALIGN(bytes, 16);
602
- cif->flags = flags;
603
- #if defined (__APPLE__)
604
- cif->aarch64_nfixedargs = 0;
605
- #endif
606
-
607
- return FFI_OK;
608
- }
609
-
610
- #if defined (__APPLE__)
611
- /* Perform Apple-specific cif processing for variadic calls */
612
- ffi_status FFI_HIDDEN
613
- ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs,
614
- unsigned int ntotalargs)
615
- {
616
- ffi_status status = ffi_prep_cif_machdep (cif);
617
- cif->aarch64_nfixedargs = nfixedargs;
618
- return status;
619
- }
620
- #else
621
- ffi_status FFI_HIDDEN
622
- ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs, unsigned int ntotalargs)
623
- {
624
- ffi_status status = ffi_prep_cif_machdep (cif);
625
- cif->flags |= AARCH64_FLAG_VARARG;
626
- return status;
627
- }
628
- #endif /* __APPLE__ */
629
-
630
- extern void ffi_call_SYSV (struct call_context *context, void *frame,
631
- void (*fn)(void), void *rvalue, int flags,
632
- void *closure) FFI_HIDDEN;
633
-
634
- /* Call a function with the provided arguments and capture the return
635
- value. */
636
- static void
637
- ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
638
- void **avalue, void *closure)
639
- {
640
- struct call_context *context;
641
- void *stack, *frame, *rvalue;
642
- struct arg_state state;
643
- size_t stack_bytes, rtype_size, rsize;
644
- int i, nargs, flags, isvariadic = 0;
645
- ffi_type *rtype;
646
-
647
- flags = cif->flags;
648
- rtype = cif->rtype;
649
- rtype_size = rtype->size;
650
- stack_bytes = cif->bytes;
651
-
652
- if (flags & AARCH64_FLAG_VARARG)
653
- {
654
- isvariadic = 1;
655
- flags &= ~AARCH64_FLAG_VARARG;
656
- }
657
-
658
- /* If the target function returns a structure via hidden pointer,
659
- then we cannot allow a null rvalue. Otherwise, mash a null
660
- rvalue to void return type. */
661
- rsize = 0;
662
- if (flags & AARCH64_RET_IN_MEM)
663
- {
664
- if (orig_rvalue == NULL)
665
- rsize = rtype_size;
666
- }
667
- else if (orig_rvalue == NULL)
668
- flags &= AARCH64_FLAG_ARG_V;
669
- else if (flags & AARCH64_RET_NEED_COPY)
670
- rsize = 16;
671
-
672
- /* Allocate consectutive stack for everything we'll need.
673
- The frame uses 40 bytes for: lr, fp, rvalue, flags, sp */
674
- context = alloca (sizeof(struct call_context) + stack_bytes + 40 + rsize);
675
- stack = context + 1;
676
- frame = (void*)((uintptr_t)stack + (uintptr_t)stack_bytes);
677
- rvalue = (rsize ? (void*)((uintptr_t)frame + 40) : orig_rvalue);
678
-
679
- arg_init (&state, stack_bytes);
680
- for (i = 0, nargs = cif->nargs; i < nargs; i++)
681
- {
682
- ffi_type *ty = cif->arg_types[i];
683
- size_t s = ty->size;
684
- void *a = avalue[i];
685
- int h, t;
686
- void *dest;
687
-
688
- t = ty->type;
689
- switch (t)
690
- {
691
- case FFI_TYPE_VOID:
692
- FFI_ASSERT (0);
693
- break;
694
-
695
- /* If the argument is a basic type the argument is allocated to an
696
- appropriate register, or if none are available, to the stack. */
697
- case FFI_TYPE_INT:
698
- case FFI_TYPE_UINT8:
699
- case FFI_TYPE_SINT8:
700
- case FFI_TYPE_UINT16:
701
- case FFI_TYPE_SINT16:
702
- case FFI_TYPE_UINT32:
703
- case FFI_TYPE_SINT32:
704
- case FFI_TYPE_UINT64:
705
- case FFI_TYPE_SINT64:
706
- case FFI_TYPE_POINTER:
707
- do_pointer:
708
- {
709
- ffi_arg ext = extend_integer_type (a, t);
710
- if (state.ngrn < N_X_ARG_REG)
711
- context->x[state.ngrn++] = ext;
712
- else
713
- {
714
- void *d = allocate_to_stack (&state, stack, ty->alignment, s);
715
- state.ngrn = N_X_ARG_REG;
716
- /* Note that the default abi extends each argument
717
- to a full 64-bit slot, while the iOS abi allocates
718
- only enough space. */
719
- #ifdef __APPLE__
720
- memcpy(d, a, s);
721
- #else
722
- *(ffi_arg *)d = ext;
723
- #endif
724
- }
725
- }
726
- break;
727
-
728
- case FFI_TYPE_FLOAT:
729
- case FFI_TYPE_DOUBLE:
730
- case FFI_TYPE_LONGDOUBLE:
731
- case FFI_TYPE_STRUCT:
732
- case FFI_TYPE_COMPLEX:
733
- {
734
- h = is_vfp_type (ty);
735
- if (h)
736
- {
737
- int elems = 4 - (h & 3);
738
- if (cif->abi == FFI_WIN64 && isvariadic)
739
- {
740
- if (state.ngrn + elems <= N_X_ARG_REG)
741
- {
742
- dest = &context->x[state.ngrn];
743
- state.ngrn += elems;
744
- extend_hfa_type(dest, a, h);
745
- break;
746
- }
747
- state.nsrn = N_X_ARG_REG;
748
- dest = allocate_to_stack(&state, stack, ty->alignment, s);
749
- }
750
- else
751
- {
752
- if (state.nsrn + elems <= N_V_ARG_REG)
753
- {
754
- dest = &context->v[state.nsrn];
755
- state.nsrn += elems;
756
- extend_hfa_type (dest, a, h);
757
- break;
758
- }
759
- state.nsrn = N_V_ARG_REG;
760
- dest = allocate_to_stack (&state, stack, ty->alignment, s);
761
- }
762
- }
763
- else if (s > 16)
764
- {
765
- /* If the argument is a composite type that is larger than 16
766
- bytes, then the argument is copied to memory, and
767
- the argument is replaced by a pointer to the copy. */
768
- dest = allocate_and_copy_struct_to_stack (&state, stack,
769
- ty->alignment, s,
770
- avalue[i]);
771
- a = &dest;
772
- t = FFI_TYPE_POINTER;
773
- s = sizeof (void *);
774
- goto do_pointer;
775
- }
776
- else
777
- {
778
- size_t n = (s + 7) / 8;
779
- if (state.ngrn + n <= N_X_ARG_REG)
780
- {
781
- /* If the argument is a composite type and the size in
782
- double-words is not more than the number of available
783
- X registers, then the argument is copied into
784
- consecutive X registers. */
785
- dest = &context->x[state.ngrn];
786
- state.ngrn += (unsigned int)n;
787
- }
788
- else
789
- {
790
- /* Otherwise, there are insufficient X registers. Further
791
- X register allocations are prevented, the NSAA is
792
- adjusted and the argument is copied to memory at the
793
- adjusted NSAA. */
794
- state.ngrn = N_X_ARG_REG;
795
- dest = allocate_to_stack (&state, stack, ty->alignment, s);
796
- }
797
- }
798
- memcpy (dest, a, s);
799
- }
800
- break;
801
-
802
- default:
803
- abort();
804
- }
805
-
806
- #if defined (__APPLE__)
807
- if (i + 1 == cif->aarch64_nfixedargs)
808
- {
809
- state.ngrn = N_X_ARG_REG;
810
- state.nsrn = N_V_ARG_REG;
811
- state.allocating_variadic = 1;
812
- }
813
- #endif
814
- }
815
-
816
- ffi_call_SYSV (context, frame, fn, rvalue, flags, closure);
817
-
818
- if (flags & AARCH64_RET_NEED_COPY)
819
- memcpy (orig_rvalue, rvalue, rtype_size);
820
- }
821
-
822
- void
823
- ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue)
824
- {
825
- ffi_call_int (cif, fn, rvalue, avalue, NULL);
826
- }
827
-
828
- #if FFI_CLOSURES
829
-
830
- #ifdef FFI_GO_CLOSURES
831
- void
832
- ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue,
833
- void **avalue, void *closure)
834
- {
835
- ffi_call_int (cif, fn, rvalue, avalue, closure);
836
- }
837
- #endif /* FFI_GO_CLOSURES */
838
-
839
- /* Build a trampoline. */
840
-
841
- extern void ffi_closure_SYSV (void) FFI_HIDDEN;
842
- extern void ffi_closure_SYSV_V (void) FFI_HIDDEN;
843
- #if defined(FFI_EXEC_STATIC_TRAMP)
844
- extern void ffi_closure_SYSV_alt (void) FFI_HIDDEN;
845
- extern void ffi_closure_SYSV_V_alt (void) FFI_HIDDEN;
846
- #endif
847
-
848
- ffi_status
849
- ffi_prep_closure_loc (ffi_closure *closure,
850
- ffi_cif* cif,
851
- void (*fun)(ffi_cif*,void*,void**,void*),
852
- void *user_data,
853
- void *codeloc)
854
- {
855
- if (cif->abi != FFI_SYSV && cif->abi != FFI_WIN64)
856
- return FFI_BAD_ABI;
857
-
858
- void (*start)(void);
859
-
860
- if (cif->flags & AARCH64_FLAG_ARG_V)
861
- start = ffi_closure_SYSV_V;
862
- else
863
- start = ffi_closure_SYSV;
864
-
865
- #if FFI_EXEC_TRAMPOLINE_TABLE
866
- # ifdef __MACH__
867
- # ifdef HAVE_PTRAUTH
868
- codeloc = ptrauth_auth_data(codeloc, ptrauth_key_function_pointer, 0);
869
- # endif
870
- void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE);
871
- config[0] = closure;
872
- config[1] = start;
873
- # endif
874
- #else
875
- static const unsigned char trampoline[16] = {
876
- 0x90, 0x00, 0x00, 0x58, /* ldr x16, tramp+16 */
877
- 0xf1, 0xff, 0xff, 0x10, /* adr x17, tramp+0 */
878
- 0x00, 0x02, 0x1f, 0xd6 /* br x16 */
879
- };
880
- char *tramp = closure->tramp;
881
-
882
- # if defined(FFI_EXEC_STATIC_TRAMP)
883
- if (ffi_tramp_is_present(closure))
884
- {
885
- /* Initialize the static trampoline's parameters. */
886
- if (start == ffi_closure_SYSV_V)
887
- start = ffi_closure_SYSV_V_alt;
888
- else
889
- start = ffi_closure_SYSV_alt;
890
- ffi_tramp_set_parms (closure->ftramp, start, closure);
891
- goto out;
892
- }
893
- # endif
894
-
895
- /* Initialize the dynamic trampoline. */
896
- memcpy (tramp, trampoline, sizeof(trampoline));
897
-
898
- *(UINT64 *)(tramp + 16) = (uintptr_t)start;
899
-
900
- ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
901
-
902
- /* Also flush the cache for code mapping. */
903
- # ifdef _WIN32
904
- // Not using dlmalloc.c for Windows ARM64 builds
905
- // so calling ffi_data_to_code_pointer() isn't necessary
906
- unsigned char *tramp_code = tramp;
907
- # else
908
- unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
909
- # endif
910
- ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
911
- # if defined(FFI_EXEC_STATIC_TRAMP)
912
- out:
913
- # endif
914
- #endif
915
-
916
- closure->cif = cif;
917
- closure->fun = fun;
918
- closure->user_data = user_data;
919
-
920
- return FFI_OK;
921
- }
922
-
923
- #ifdef FFI_GO_CLOSURES
924
- extern void ffi_go_closure_SYSV (void) FFI_HIDDEN;
925
- extern void ffi_go_closure_SYSV_V (void) FFI_HIDDEN;
926
-
927
- ffi_status
928
- ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif* cif,
929
- void (*fun)(ffi_cif*,void*,void**,void*))
930
- {
931
- void (*start)(void);
932
-
933
- if (cif->abi != FFI_SYSV && cif->abi != FFI_WIN64)
934
- return FFI_BAD_ABI;
935
-
936
- if (cif->flags & AARCH64_FLAG_ARG_V)
937
- start = ffi_go_closure_SYSV_V;
938
- else
939
- start = ffi_go_closure_SYSV;
940
-
941
- closure->tramp = start;
942
- closure->cif = cif;
943
- closure->fun = fun;
944
-
945
- return FFI_OK;
946
- }
947
- #endif /* FFI_GO_CLOSURES */
948
-
949
- /* Primary handler to setup and invoke a function within a closure.
950
-
951
- A closure when invoked enters via the assembler wrapper
952
- ffi_closure_SYSV(). The wrapper allocates a call context on the
953
- stack, saves the interesting registers (from the perspective of
954
- the calling convention) into the context then passes control to
955
- ffi_closure_SYSV_inner() passing the saved context and a pointer to
956
- the stack at the point ffi_closure_SYSV() was invoked.
957
-
958
- On the return path the assembler wrapper will reload call context
959
- registers.
960
-
961
- ffi_closure_SYSV_inner() marshalls the call context into ffi value
962
- descriptors, invokes the wrapped function, then marshalls the return
963
- value back into the call context. */
964
-
965
- int FFI_HIDDEN
966
- ffi_closure_SYSV_inner (ffi_cif *cif,
967
- void (*fun)(ffi_cif*,void*,void**,void*),
968
- void *user_data,
969
- struct call_context *context,
970
- void *stack, void *rvalue, void *struct_rvalue)
971
- {
972
- void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
973
- int i, h, nargs, flags, isvariadic = 0;
974
- struct arg_state state;
975
-
976
- arg_init (&state, cif->bytes);
977
-
978
- flags = cif->flags;
979
- if (flags & AARCH64_FLAG_VARARG)
980
- {
981
- isvariadic = 1;
982
- flags &= ~AARCH64_FLAG_VARARG;
983
- }
984
-
985
- for (i = 0, nargs = cif->nargs; i < nargs; i++)
986
- {
987
- ffi_type *ty = cif->arg_types[i];
988
- int t = ty->type;
989
- size_t n, s = ty->size;
990
-
991
- switch (t)
992
- {
993
- case FFI_TYPE_VOID:
994
- FFI_ASSERT (0);
995
- break;
996
-
997
- case FFI_TYPE_INT:
998
- case FFI_TYPE_UINT8:
999
- case FFI_TYPE_SINT8:
1000
- case FFI_TYPE_UINT16:
1001
- case FFI_TYPE_SINT16:
1002
- case FFI_TYPE_UINT32:
1003
- case FFI_TYPE_SINT32:
1004
- case FFI_TYPE_UINT64:
1005
- case FFI_TYPE_SINT64:
1006
- case FFI_TYPE_POINTER:
1007
- avalue[i] = allocate_int_to_reg_or_stack (context, &state, stack, s);
1008
- break;
1009
-
1010
- case FFI_TYPE_FLOAT:
1011
- case FFI_TYPE_DOUBLE:
1012
- case FFI_TYPE_LONGDOUBLE:
1013
- case FFI_TYPE_STRUCT:
1014
- case FFI_TYPE_COMPLEX:
1015
- h = is_vfp_type (ty);
1016
- if (h)
1017
- {
1018
- n = 4 - (h & 3);
1019
- if (cif->abi == FFI_WIN64 && isvariadic)
1020
- {
1021
- if (state.ngrn + n <= N_X_ARG_REG)
1022
- {
1023
- void *reg = &context->x[state.ngrn];
1024
- state.ngrn += (unsigned int)n;
1025
-
1026
- /* Eeek! We need a pointer to the structure, however the
1027
- homogeneous float elements are being passed in individual
1028
- registers, therefore for float and double the structure
1029
- is not represented as a contiguous sequence of bytes in
1030
- our saved register context. We don't need the original
1031
- contents of the register storage, so we reformat the
1032
- structure into the same memory. */
1033
- avalue[i] = compress_hfa_type(reg, reg, h);
1034
- }
1035
- else
1036
- {
1037
- state.ngrn = N_X_ARG_REG;
1038
- state.nsrn = N_V_ARG_REG;
1039
- avalue[i] = allocate_to_stack(&state, stack,
1040
- ty->alignment, s);
1041
- }
1042
- }
1043
- else
1044
- {
1045
- if (state.nsrn + n <= N_V_ARG_REG)
1046
- {
1047
- void *reg = &context->v[state.nsrn];
1048
- state.nsrn += (unsigned int)n;
1049
- avalue[i] = compress_hfa_type(reg, reg, h);
1050
- }
1051
- else
1052
- {
1053
- state.nsrn = N_V_ARG_REG;
1054
- avalue[i] = allocate_to_stack(&state, stack,
1055
- ty->alignment, s);
1056
- }
1057
- }
1058
- }
1059
- else if (s > 16)
1060
- {
1061
- /* Replace Composite type of size greater than 16 with a
1062
- pointer. */
1063
- #ifdef __ILP32__
1064
- UINT64 avalue_tmp;
1065
- memcpy (&avalue_tmp,
1066
- allocate_int_to_reg_or_stack (context, &state,
1067
- stack, sizeof (void *)),
1068
- sizeof (UINT64));
1069
- avalue[i] = (void *)(UINT32)avalue_tmp;
1070
- #else
1071
- avalue[i] = *(void **)
1072
- allocate_int_to_reg_or_stack (context, &state, stack,
1073
- sizeof (void *));
1074
- #endif
1075
- }
1076
- else
1077
- {
1078
- n = (s + 7) / 8;
1079
- if (state.ngrn + n <= N_X_ARG_REG)
1080
- {
1081
- avalue[i] = &context->x[state.ngrn];
1082
- state.ngrn += (unsigned int)n;
1083
- }
1084
- else
1085
- {
1086
- state.ngrn = N_X_ARG_REG;
1087
- avalue[i] = allocate_to_stack(&state, stack,
1088
- ty->alignment, s);
1089
- }
1090
- }
1091
- break;
1092
-
1093
- default:
1094
- abort();
1095
- }
1096
-
1097
- #if defined (__APPLE__)
1098
- if (i + 1 == cif->aarch64_nfixedargs)
1099
- {
1100
- state.ngrn = N_X_ARG_REG;
1101
- state.nsrn = N_V_ARG_REG;
1102
- state.allocating_variadic = 1;
1103
- }
1104
- #endif
1105
- }
1106
-
1107
- if (flags & AARCH64_RET_IN_MEM)
1108
- rvalue = struct_rvalue;
1109
-
1110
- fun (cif, rvalue, avalue, user_data);
1111
-
1112
- return flags;
1113
- }
1114
-
1115
- #if defined(FFI_EXEC_STATIC_TRAMP)
1116
- void *
1117
- ffi_tramp_arch (size_t *tramp_size, size_t *map_size)
1118
- {
1119
- extern void *trampoline_code_table;
1120
-
1121
- *tramp_size = AARCH64_TRAMP_SIZE;
1122
- *map_size = AARCH64_TRAMP_MAP_SIZE;
1123
- return &trampoline_code_table;
1124
- }
1125
- #endif
1126
-
1127
- #endif /* FFI_CLOSURES */
1128
-
1129
- #endif /* (__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)*/