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,950 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
- ffi64.c - Copyright (c) 2011, 2018, 2022 Anthony Green
3
- Copyright (c) 2013 The Written Word, Inc.
4
- Copyright (c) 2008, 2010 Red Hat, Inc.
5
- Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de>
6
-
7
- x86-64 Foreign Function Interface
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining
10
- a copy of this software and associated documentation files (the
11
- ``Software''), to deal in the Software without restriction, including
12
- without limitation the rights to use, copy, modify, merge, publish,
13
- distribute, sublicense, and/or sell copies of the Software, and to
14
- permit persons to whom the Software is furnished to do so, subject to
15
- the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included
18
- in all copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
21
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
- DEALINGS IN THE SOFTWARE.
28
- ----------------------------------------------------------------------- */
29
-
30
- #include <ffi.h>
31
- #include <ffi_common.h>
32
-
33
- #include <stdlib.h>
34
- #include <stdarg.h>
35
- #include <stdint.h>
36
- #include <tramp.h>
37
- #include "internal64.h"
38
-
39
- #ifdef __x86_64__
40
-
41
- #define MAX_GPR_REGS 6
42
- #define MAX_SSE_REGS 8
43
-
44
- #if defined(__INTEL_COMPILER)
45
- #include "xmmintrin.h"
46
- #define UINT128 __m128
47
- #else
48
- #if defined(__SUNPRO_C)
49
- #include <sunmedia_types.h>
50
- #define UINT128 __m128i
51
- #else
52
- #define UINT128 __int128_t
53
- #endif
54
- #endif
55
-
56
- union big_int_union
57
- {
58
- UINT32 i32;
59
- UINT64 i64;
60
- UINT128 i128;
61
- };
62
-
63
- struct register_args
64
- {
65
- /* Registers for argument passing. */
66
- UINT64 gpr[MAX_GPR_REGS];
67
- union big_int_union sse[MAX_SSE_REGS];
68
- UINT64 rax; /* ssecount */
69
- UINT64 r10; /* static chain */
70
- };
71
-
72
- extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
73
- void *raddr, void (*fnaddr)(void)) FFI_HIDDEN;
74
-
75
- /* All reference to register classes here is identical to the code in
76
- gcc/config/i386/i386.c. Do *not* change one without the other. */
77
-
78
- /* Register class used for passing given 64bit part of the argument.
79
- These represent classes as documented by the PS ABI, with the
80
- exception of SSESF, SSEDF classes, that are basically SSE class,
81
- just gcc will use SF or DFmode move instead of DImode to avoid
82
- reformatting penalties.
83
-
84
- Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves
85
- whenever possible (upper half does contain padding). */
86
- enum x86_64_reg_class
87
- {
88
- X86_64_NO_CLASS,
89
- X86_64_INTEGER_CLASS,
90
- X86_64_INTEGERSI_CLASS,
91
- X86_64_SSE_CLASS,
92
- X86_64_SSESF_CLASS,
93
- X86_64_SSEDF_CLASS,
94
- X86_64_SSEUP_CLASS,
95
- X86_64_X87_CLASS,
96
- X86_64_X87UP_CLASS,
97
- X86_64_COMPLEX_X87_CLASS,
98
- X86_64_MEMORY_CLASS
99
- };
100
-
101
- #define MAX_CLASSES 4
102
-
103
- #define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS)
104
-
105
- /* x86-64 register passing implementation. See x86-64 ABI for details. Goal
106
- of this code is to classify each 8bytes of incoming argument by the register
107
- class and assign registers accordingly. */
108
-
109
- /* Return the union class of CLASS1 and CLASS2.
110
- See the x86-64 PS ABI for details. */
111
-
112
- static enum x86_64_reg_class
113
- merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
114
- {
115
- /* Rule #1: If both classes are equal, this is the resulting class. */
116
- if (class1 == class2)
117
- return class1;
118
-
119
- /* Rule #2: If one of the classes is NO_CLASS, the resulting class is
120
- the other class. */
121
- if (class1 == X86_64_NO_CLASS)
122
- return class2;
123
- if (class2 == X86_64_NO_CLASS)
124
- return class1;
125
-
126
- /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */
127
- if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS)
128
- return X86_64_MEMORY_CLASS;
129
-
130
- /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */
131
- if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS)
132
- || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS))
133
- return X86_64_INTEGERSI_CLASS;
134
- if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS
135
- || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS)
136
- return X86_64_INTEGER_CLASS;
137
-
138
- /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class,
139
- MEMORY is used. */
140
- if (class1 == X86_64_X87_CLASS
141
- || class1 == X86_64_X87UP_CLASS
142
- || class1 == X86_64_COMPLEX_X87_CLASS
143
- || class2 == X86_64_X87_CLASS
144
- || class2 == X86_64_X87UP_CLASS
145
- || class2 == X86_64_COMPLEX_X87_CLASS)
146
- return X86_64_MEMORY_CLASS;
147
-
148
- /* Rule #6: Otherwise class SSE is used. */
149
- return X86_64_SSE_CLASS;
150
- }
151
-
152
- /* Classify the argument of type TYPE and mode MODE.
153
- CLASSES will be filled by the register class used to pass each word
154
- of the operand. The number of words is returned. In case the parameter
155
- should be passed in memory, 0 is returned. As a special case for zero
156
- sized containers, classes[0] will be NO_CLASS and 1 is returned.
157
-
158
- See the x86-64 PS ABI for details.
159
- */
160
- static size_t
161
- classify_argument (ffi_type *type, enum x86_64_reg_class classes[],
162
- size_t byte_offset)
163
- {
164
- switch (type->type)
165
- {
166
- case FFI_TYPE_UINT8:
167
- case FFI_TYPE_SINT8:
168
- case FFI_TYPE_UINT16:
169
- case FFI_TYPE_SINT16:
170
- case FFI_TYPE_UINT32:
171
- case FFI_TYPE_SINT32:
172
- case FFI_TYPE_UINT64:
173
- case FFI_TYPE_SINT64:
174
- case FFI_TYPE_POINTER:
175
- do_integer:
176
- {
177
- size_t size = byte_offset + type->size;
178
-
179
- if (size <= 4)
180
- {
181
- classes[0] = X86_64_INTEGERSI_CLASS;
182
- return 1;
183
- }
184
- else if (size <= 8)
185
- {
186
- classes[0] = X86_64_INTEGER_CLASS;
187
- return 1;
188
- }
189
- else if (size <= 12)
190
- {
191
- classes[0] = X86_64_INTEGER_CLASS;
192
- classes[1] = X86_64_INTEGERSI_CLASS;
193
- return 2;
194
- }
195
- else if (size <= 16)
196
- {
197
- classes[0] = classes[1] = X86_64_INTEGER_CLASS;
198
- return 2;
199
- }
200
- else
201
- FFI_ASSERT (0);
202
- }
203
- case FFI_TYPE_FLOAT:
204
- if (!(byte_offset % 8))
205
- classes[0] = X86_64_SSESF_CLASS;
206
- else
207
- classes[0] = X86_64_SSE_CLASS;
208
- return 1;
209
- case FFI_TYPE_DOUBLE:
210
- classes[0] = X86_64_SSEDF_CLASS;
211
- return 1;
212
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
213
- case FFI_TYPE_LONGDOUBLE:
214
- classes[0] = X86_64_X87_CLASS;
215
- classes[1] = X86_64_X87UP_CLASS;
216
- return 2;
217
- #endif
218
- case FFI_TYPE_STRUCT:
219
- {
220
- const size_t UNITS_PER_WORD = 8;
221
- size_t words = (type->size + byte_offset + UNITS_PER_WORD - 1)
222
- / UNITS_PER_WORD;
223
- ffi_type **ptr;
224
- unsigned int i;
225
- enum x86_64_reg_class subclasses[MAX_CLASSES];
226
-
227
- /* If the struct is larger than 32 bytes, pass it on the stack. */
228
- if (type->size > 32)
229
- return 0;
230
-
231
- for (i = 0; i < words; i++)
232
- classes[i] = X86_64_NO_CLASS;
233
-
234
- /* Zero sized arrays or structures are NO_CLASS. We return 0 to
235
- signalize memory class, so handle it as special case. */
236
- if (!words)
237
- {
238
- case FFI_TYPE_VOID:
239
- classes[0] = X86_64_NO_CLASS;
240
- return 1;
241
- }
242
-
243
- /* Merge the fields of structure. */
244
- for (ptr = type->elements; *ptr != NULL; ptr++)
245
- {
246
- size_t num, pos;
247
-
248
- byte_offset = FFI_ALIGN (byte_offset, (*ptr)->alignment);
249
-
250
- num = classify_argument (*ptr, subclasses, byte_offset % 8);
251
- if (num == 0)
252
- return 0;
253
- pos = byte_offset / 8;
254
- for (i = 0; i < num && (i + pos) < words; i++)
255
- {
256
- size_t pos = byte_offset / 8;
257
- classes[i + pos] =
258
- merge_classes (subclasses[i], classes[i + pos]);
259
- }
260
-
261
- byte_offset += (*ptr)->size;
262
- }
263
-
264
- if (words > 2)
265
- {
266
- /* When size > 16 bytes, if the first one isn't
267
- X86_64_SSE_CLASS or any other ones aren't
268
- X86_64_SSEUP_CLASS, everything should be passed in
269
- memory. */
270
- if (classes[0] != X86_64_SSE_CLASS)
271
- return 0;
272
-
273
- for (i = 1; i < words; i++)
274
- if (classes[i] != X86_64_SSEUP_CLASS)
275
- return 0;
276
- }
277
-
278
- /* Final merger cleanup. */
279
- for (i = 0; i < words; i++)
280
- {
281
- /* If one class is MEMORY, everything should be passed in
282
- memory. */
283
- if (classes[i] == X86_64_MEMORY_CLASS)
284
- return 0;
285
-
286
- /* The X86_64_SSEUP_CLASS should be always preceded by
287
- X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */
288
- if (i > 1 && classes[i] == X86_64_SSEUP_CLASS
289
- && classes[i - 1] != X86_64_SSE_CLASS
290
- && classes[i - 1] != X86_64_SSEUP_CLASS)
291
- {
292
- /* The first one should never be X86_64_SSEUP_CLASS. */
293
- FFI_ASSERT (i != 0);
294
- classes[i] = X86_64_SSE_CLASS;
295
- }
296
-
297
- /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS,
298
- everything should be passed in memory. */
299
- if (i > 1 && classes[i] == X86_64_X87UP_CLASS
300
- && (classes[i - 1] != X86_64_X87_CLASS))
301
- {
302
- /* The first one should never be X86_64_X87UP_CLASS. */
303
- FFI_ASSERT (i != 0);
304
- return 0;
305
- }
306
- }
307
- return words;
308
- }
309
- case FFI_TYPE_COMPLEX:
310
- {
311
- ffi_type *inner = type->elements[0];
312
- switch (inner->type)
313
- {
314
- case FFI_TYPE_INT:
315
- case FFI_TYPE_UINT8:
316
- case FFI_TYPE_SINT8:
317
- case FFI_TYPE_UINT16:
318
- case FFI_TYPE_SINT16:
319
- case FFI_TYPE_UINT32:
320
- case FFI_TYPE_SINT32:
321
- case FFI_TYPE_UINT64:
322
- case FFI_TYPE_SINT64:
323
- goto do_integer;
324
-
325
- case FFI_TYPE_FLOAT:
326
- classes[0] = X86_64_SSE_CLASS;
327
- if (byte_offset % 8)
328
- {
329
- classes[1] = X86_64_SSESF_CLASS;
330
- return 2;
331
- }
332
- return 1;
333
- case FFI_TYPE_DOUBLE:
334
- classes[0] = classes[1] = X86_64_SSEDF_CLASS;
335
- return 2;
336
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
337
- case FFI_TYPE_LONGDOUBLE:
338
- classes[0] = X86_64_COMPLEX_X87_CLASS;
339
- return 1;
340
- #endif
341
- }
342
- }
343
- }
344
- abort();
345
- }
346
-
347
- /* Examine the argument and return set number of register required in each
348
- class. Return zero iff parameter should be passed in memory, otherwise
349
- the number of registers. */
350
-
351
- static size_t
352
- examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES],
353
- _Bool in_return, int *pngpr, int *pnsse)
354
- {
355
- size_t n;
356
- unsigned int i;
357
- int ngpr, nsse;
358
-
359
- n = classify_argument (type, classes, 0);
360
- if (n == 0)
361
- return 0;
362
-
363
- ngpr = nsse = 0;
364
- for (i = 0; i < n; ++i)
365
- switch (classes[i])
366
- {
367
- case X86_64_INTEGER_CLASS:
368
- case X86_64_INTEGERSI_CLASS:
369
- ngpr++;
370
- break;
371
- case X86_64_SSE_CLASS:
372
- case X86_64_SSESF_CLASS:
373
- case X86_64_SSEDF_CLASS:
374
- nsse++;
375
- break;
376
- case X86_64_NO_CLASS:
377
- case X86_64_SSEUP_CLASS:
378
- break;
379
- case X86_64_X87_CLASS:
380
- case X86_64_X87UP_CLASS:
381
- case X86_64_COMPLEX_X87_CLASS:
382
- return in_return != 0;
383
- default:
384
- abort ();
385
- }
386
-
387
- *pngpr = ngpr;
388
- *pnsse = nsse;
389
-
390
- return n;
391
- }
392
-
393
- /* Perform machine dependent cif processing. */
394
-
395
- #ifndef __ILP32__
396
- extern ffi_status
397
- ffi_prep_cif_machdep_efi64(ffi_cif *cif);
398
- #endif
399
-
400
- ffi_status FFI_HIDDEN
401
- ffi_prep_cif_machdep (ffi_cif *cif)
402
- {
403
- int gprcount, ssecount, i, avn, ngpr, nsse;
404
- unsigned flags;
405
- enum x86_64_reg_class classes[MAX_CLASSES];
406
- size_t bytes, n, rtype_size;
407
- ffi_type *rtype;
408
-
409
- #ifndef __ILP32__
410
- if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
411
- return ffi_prep_cif_machdep_efi64(cif);
412
- #endif
413
- if (cif->abi != FFI_UNIX64)
414
- return FFI_BAD_ABI;
415
-
416
- gprcount = ssecount = 0;
417
-
418
- rtype = cif->rtype;
419
- rtype_size = rtype->size;
420
- switch (rtype->type)
421
- {
422
- case FFI_TYPE_VOID:
423
- flags = UNIX64_RET_VOID;
424
- break;
425
- case FFI_TYPE_UINT8:
426
- flags = UNIX64_RET_UINT8;
427
- break;
428
- case FFI_TYPE_SINT8:
429
- flags = UNIX64_RET_SINT8;
430
- break;
431
- case FFI_TYPE_UINT16:
432
- flags = UNIX64_RET_UINT16;
433
- break;
434
- case FFI_TYPE_SINT16:
435
- flags = UNIX64_RET_SINT16;
436
- break;
437
- case FFI_TYPE_UINT32:
438
- flags = UNIX64_RET_UINT32;
439
- break;
440
- case FFI_TYPE_INT:
441
- case FFI_TYPE_SINT32:
442
- flags = UNIX64_RET_SINT32;
443
- break;
444
- case FFI_TYPE_UINT64:
445
- case FFI_TYPE_SINT64:
446
- flags = UNIX64_RET_INT64;
447
- break;
448
- case FFI_TYPE_POINTER:
449
- flags = (sizeof(void *) == 4 ? UNIX64_RET_UINT32 : UNIX64_RET_INT64);
450
- break;
451
- case FFI_TYPE_FLOAT:
452
- flags = UNIX64_RET_XMM32;
453
- break;
454
- case FFI_TYPE_DOUBLE:
455
- flags = UNIX64_RET_XMM64;
456
- break;
457
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
458
- case FFI_TYPE_LONGDOUBLE:
459
- flags = UNIX64_RET_X87;
460
- break;
461
- #endif
462
- case FFI_TYPE_STRUCT:
463
- n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse);
464
- if (n == 0)
465
- {
466
- /* The return value is passed in memory. A pointer to that
467
- memory is the first argument. Allocate a register for it. */
468
- gprcount++;
469
- /* We don't have to do anything in asm for the return. */
470
- flags = UNIX64_RET_VOID | UNIX64_FLAG_RET_IN_MEM;
471
- }
472
- else
473
- {
474
- _Bool sse0 = SSE_CLASS_P (classes[0]);
475
-
476
- if (rtype_size == 4 && sse0)
477
- flags = UNIX64_RET_XMM32;
478
- else if (rtype_size == 8)
479
- flags = sse0 ? UNIX64_RET_XMM64 : UNIX64_RET_INT64;
480
- else
481
- {
482
- _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]);
483
- if (sse0 && sse1)
484
- flags = UNIX64_RET_ST_XMM0_XMM1;
485
- else if (sse0)
486
- flags = UNIX64_RET_ST_XMM0_RAX;
487
- else if (sse1)
488
- flags = UNIX64_RET_ST_RAX_XMM0;
489
- else
490
- flags = UNIX64_RET_ST_RAX_RDX;
491
- flags |= rtype_size << UNIX64_SIZE_SHIFT;
492
- }
493
- }
494
- break;
495
- case FFI_TYPE_COMPLEX:
496
- switch (rtype->elements[0]->type)
497
- {
498
- case FFI_TYPE_UINT8:
499
- case FFI_TYPE_SINT8:
500
- case FFI_TYPE_UINT16:
501
- case FFI_TYPE_SINT16:
502
- case FFI_TYPE_INT:
503
- case FFI_TYPE_UINT32:
504
- case FFI_TYPE_SINT32:
505
- case FFI_TYPE_UINT64:
506
- case FFI_TYPE_SINT64:
507
- flags = UNIX64_RET_ST_RAX_RDX | ((unsigned) rtype_size << UNIX64_SIZE_SHIFT);
508
- break;
509
- case FFI_TYPE_FLOAT:
510
- flags = UNIX64_RET_XMM64;
511
- break;
512
- case FFI_TYPE_DOUBLE:
513
- flags = UNIX64_RET_ST_XMM0_XMM1 | (16 << UNIX64_SIZE_SHIFT);
514
- break;
515
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
516
- case FFI_TYPE_LONGDOUBLE:
517
- flags = UNIX64_RET_X87_2;
518
- break;
519
- #endif
520
- default:
521
- return FFI_BAD_TYPEDEF;
522
- }
523
- break;
524
- default:
525
- return FFI_BAD_TYPEDEF;
526
- }
527
-
528
- /* Go over all arguments and determine the way they should be passed.
529
- If it's in a register and there is space for it, let that be so. If
530
- not, add it's size to the stack byte count. */
531
- for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++)
532
- {
533
- if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0
534
- || gprcount + ngpr > MAX_GPR_REGS
535
- || ssecount + nsse > MAX_SSE_REGS)
536
- {
537
- long align = cif->arg_types[i]->alignment;
538
-
539
- if (align < 8)
540
- align = 8;
541
-
542
- bytes = FFI_ALIGN (bytes, align);
543
- bytes += cif->arg_types[i]->size;
544
- }
545
- else
546
- {
547
- gprcount += ngpr;
548
- ssecount += nsse;
549
- }
550
- }
551
- if (ssecount)
552
- flags |= UNIX64_FLAG_XMM_ARGS;
553
-
554
- cif->flags = flags;
555
- cif->bytes = (unsigned) FFI_ALIGN (bytes, 8);
556
-
557
- return FFI_OK;
558
- }
559
-
560
- static void
561
- ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
562
- void **avalue, void *closure)
563
- {
564
- enum x86_64_reg_class classes[MAX_CLASSES];
565
- char *stack, *argp;
566
- ffi_type **arg_types;
567
- int gprcount, ssecount, ngpr, nsse, i, avn, flags;
568
- struct register_args *reg_args;
569
-
570
- /* Can't call 32-bit mode from 64-bit mode. */
571
- FFI_ASSERT (cif->abi == FFI_UNIX64);
572
-
573
- /* If the return value is a struct and we don't have a return value
574
- address then we need to make one. Otherwise we can ignore it. */
575
- flags = cif->flags;
576
- if (rvalue == NULL)
577
- {
578
- if (flags & UNIX64_FLAG_RET_IN_MEM)
579
- rvalue = alloca (cif->rtype->size);
580
- else
581
- flags = UNIX64_RET_VOID;
582
- }
583
-
584
- arg_types = cif->arg_types;
585
- avn = cif->nargs;
586
-
587
- /* Allocate the space for the arguments, plus 4 words of temp space. */
588
- stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8);
589
- reg_args = (struct register_args *) stack;
590
- argp = stack + sizeof (struct register_args);
591
-
592
- reg_args->r10 = (uintptr_t) closure;
593
-
594
- gprcount = ssecount = 0;
595
-
596
- /* If the return value is passed in memory, add the pointer as the
597
- first integer argument. */
598
- if (flags & UNIX64_FLAG_RET_IN_MEM)
599
- reg_args->gpr[gprcount++] = (unsigned long) rvalue;
600
-
601
- for (i = 0; i < avn; ++i)
602
- {
603
- size_t n, size = arg_types[i]->size;
604
-
605
- n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse);
606
- if (n == 0
607
- || gprcount + ngpr > MAX_GPR_REGS
608
- || ssecount + nsse > MAX_SSE_REGS)
609
- {
610
- long align = arg_types[i]->alignment;
611
-
612
- /* Stack arguments are *always* at least 8 byte aligned. */
613
- if (align < 8)
614
- align = 8;
615
-
616
- /* Pass this argument in memory. */
617
- argp = (void *) FFI_ALIGN (argp, align);
618
- memcpy (argp, avalue[i], size);
619
-
620
- argp += size;
621
- }
622
- else
623
- {
624
- /* The argument is passed entirely in registers. */
625
- char *a = (char *) avalue[i];
626
- unsigned int j;
627
-
628
- for (j = 0; j < n; j++, a += 8, size -= 8)
629
- {
630
- switch (classes[j])
631
- {
632
- case X86_64_NO_CLASS:
633
- case X86_64_SSEUP_CLASS:
634
- break;
635
- case X86_64_INTEGER_CLASS:
636
- case X86_64_INTEGERSI_CLASS:
637
- /* Sign-extend integer arguments passed in general
638
- purpose registers, to cope with the fact that
639
- LLVM incorrectly assumes that this will be done
640
- (the x86-64 PS ABI does not specify this). */
641
- switch (arg_types[i]->type)
642
- {
643
- case FFI_TYPE_SINT8:
644
- reg_args->gpr[gprcount] = (SINT64) *((SINT8 *) a);
645
- break;
646
- case FFI_TYPE_SINT16:
647
- reg_args->gpr[gprcount] = (SINT64) *((SINT16 *) a);
648
- break;
649
- case FFI_TYPE_SINT32:
650
- reg_args->gpr[gprcount] = (SINT64) *((SINT32 *) a);
651
- break;
652
- default:
653
- reg_args->gpr[gprcount] = 0;
654
- memcpy (&reg_args->gpr[gprcount], a, size);
655
- }
656
- gprcount++;
657
- break;
658
- case X86_64_SSE_CLASS:
659
- case X86_64_SSEDF_CLASS:
660
- memcpy (&reg_args->sse[ssecount++].i64, a, sizeof(UINT64));
661
- break;
662
- case X86_64_SSESF_CLASS:
663
- memcpy (&reg_args->sse[ssecount++].i32, a, sizeof(UINT32));
664
- break;
665
- default:
666
- abort();
667
- }
668
- }
669
- }
670
- }
671
- reg_args->rax = ssecount;
672
-
673
- ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args),
674
- flags, rvalue, fn);
675
- }
676
-
677
- #ifndef __ILP32__
678
- extern void
679
- ffi_call_efi64(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue);
680
- #endif
681
-
682
- void
683
- ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
684
- {
685
- ffi_type **arg_types = cif->arg_types;
686
- int i, nargs = cif->nargs;
687
- const int max_reg_struct_size = cif->abi == FFI_GNUW64 ? 8 : 16;
688
-
689
- /* If we have any large structure arguments, make a copy so we are passing
690
- by value. */
691
- for (i = 0; i < nargs; i++)
692
- {
693
- ffi_type *at = arg_types[i];
694
- int size = at->size;
695
- if (at->type == FFI_TYPE_STRUCT && size > max_reg_struct_size)
696
- {
697
- char *argcopy = alloca (size);
698
- memcpy (argcopy, avalue[i], size);
699
- avalue[i] = argcopy;
700
- }
701
- }
702
-
703
- #ifndef __ILP32__
704
- if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
705
- {
706
- ffi_call_efi64(cif, fn, rvalue, avalue);
707
- return;
708
- }
709
- #endif
710
- ffi_call_int (cif, fn, rvalue, avalue, NULL);
711
- }
712
-
713
- #ifdef FFI_GO_CLOSURES
714
-
715
- #ifndef __ILP32__
716
- extern void
717
- ffi_call_go_efi64(ffi_cif *cif, void (*fn)(void), void *rvalue,
718
- void **avalue, void *closure);
719
- #endif
720
-
721
- void
722
- ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
723
- void **avalue, void *closure)
724
- {
725
- #ifndef __ILP32__
726
- if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
727
- {
728
- ffi_call_go_efi64(cif, fn, rvalue, avalue, closure);
729
- return;
730
- }
731
- #endif
732
- ffi_call_int (cif, fn, rvalue, avalue, closure);
733
- }
734
-
735
- #endif /* FFI_GO_CLOSURES */
736
-
737
- extern void ffi_closure_unix64(void) FFI_HIDDEN;
738
- extern void ffi_closure_unix64_sse(void) FFI_HIDDEN;
739
- #if defined(FFI_EXEC_STATIC_TRAMP)
740
- extern void ffi_closure_unix64_alt(void) FFI_HIDDEN;
741
- extern void ffi_closure_unix64_sse_alt(void) FFI_HIDDEN;
742
- #endif
743
-
744
- #ifndef __ILP32__
745
- extern ffi_status
746
- ffi_prep_closure_loc_efi64(ffi_closure* closure,
747
- ffi_cif* cif,
748
- void (*fun)(ffi_cif*, void*, void**, void*),
749
- void *user_data,
750
- void *codeloc);
751
- #endif
752
-
753
- ffi_status
754
- ffi_prep_closure_loc (ffi_closure* closure,
755
- ffi_cif* cif,
756
- void (*fun)(ffi_cif*, void*, void**, void*),
757
- void *user_data,
758
- void *codeloc)
759
- {
760
- static const unsigned char trampoline[24] = {
761
- /* endbr64 */
762
- 0xf3, 0x0f, 0x1e, 0xfa,
763
- /* leaq -0xb(%rip),%r10 # 0x0 */
764
- 0x4c, 0x8d, 0x15, 0xf5, 0xff, 0xff, 0xff,
765
- /* jmpq *0x7(%rip) # 0x18 */
766
- 0xff, 0x25, 0x07, 0x00, 0x00, 0x00,
767
- /* nopl 0(%rax) */
768
- 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00
769
- };
770
- void (*dest)(void);
771
- char *tramp = closure->tramp;
772
-
773
- #ifndef __ILP32__
774
- if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
775
- return ffi_prep_closure_loc_efi64(closure, cif, fun, user_data, codeloc);
776
- #endif
777
- if (cif->abi != FFI_UNIX64)
778
- return FFI_BAD_ABI;
779
-
780
- if (cif->flags & UNIX64_FLAG_XMM_ARGS)
781
- dest = ffi_closure_unix64_sse;
782
- else
783
- dest = ffi_closure_unix64;
784
-
785
- #if defined(FFI_EXEC_STATIC_TRAMP)
786
- if (ffi_tramp_is_present(closure))
787
- {
788
- /* Initialize the static trampoline's parameters. */
789
- if (dest == ffi_closure_unix64_sse)
790
- dest = ffi_closure_unix64_sse_alt;
791
- else
792
- dest = ffi_closure_unix64_alt;
793
- ffi_tramp_set_parms (closure->ftramp, dest, closure);
794
- goto out;
795
- }
796
- #endif
797
-
798
- /* Initialize the dynamic trampoline. */
799
- memcpy (tramp, trampoline, sizeof(trampoline));
800
- *(UINT64 *)(tramp + sizeof (trampoline)) = (uintptr_t)dest;
801
-
802
- #if defined(FFI_EXEC_STATIC_TRAMP)
803
- out:
804
- #endif
805
- closure->cif = cif;
806
- closure->fun = fun;
807
- closure->user_data = user_data;
808
-
809
- return FFI_OK;
810
- }
811
-
812
- int FFI_HIDDEN
813
- ffi_closure_unix64_inner(ffi_cif *cif,
814
- void (*fun)(ffi_cif*, void*, void**, void*),
815
- void *user_data,
816
- void *rvalue,
817
- struct register_args *reg_args,
818
- char *argp)
819
- {
820
- void **avalue;
821
- ffi_type **arg_types;
822
- long i, avn;
823
- int gprcount, ssecount, ngpr, nsse;
824
- int flags;
825
-
826
- avn = cif->nargs;
827
- flags = cif->flags;
828
- avalue = alloca(avn * sizeof(void *));
829
- gprcount = ssecount = 0;
830
-
831
- if (flags & UNIX64_FLAG_RET_IN_MEM)
832
- {
833
- /* On return, %rax will contain the address that was passed
834
- by the caller in %rdi. */
835
- void *r = (void *)(uintptr_t)reg_args->gpr[gprcount++];
836
- *(void **)rvalue = r;
837
- rvalue = r;
838
- flags = (sizeof(void *) == 4 ? UNIX64_RET_UINT32 : UNIX64_RET_INT64);
839
- }
840
-
841
- arg_types = cif->arg_types;
842
- for (i = 0; i < avn; ++i)
843
- {
844
- enum x86_64_reg_class classes[MAX_CLASSES];
845
- size_t n;
846
-
847
- n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse);
848
- if (n == 0
849
- || gprcount + ngpr > MAX_GPR_REGS
850
- || ssecount + nsse > MAX_SSE_REGS)
851
- {
852
- long align = arg_types[i]->alignment;
853
-
854
- /* Stack arguments are *always* at least 8 byte aligned. */
855
- if (align < 8)
856
- align = 8;
857
-
858
- /* Pass this argument in memory. */
859
- argp = (void *) FFI_ALIGN (argp, align);
860
- avalue[i] = argp;
861
- argp += arg_types[i]->size;
862
- }
863
- /* If the argument is in a single register, or two consecutive
864
- integer registers, then we can use that address directly. */
865
- else if (n == 1
866
- || (n == 2 && !(SSE_CLASS_P (classes[0])
867
- || SSE_CLASS_P (classes[1]))))
868
- {
869
- /* The argument is in a single register. */
870
- if (SSE_CLASS_P (classes[0]))
871
- {
872
- avalue[i] = &reg_args->sse[ssecount];
873
- ssecount += n;
874
- }
875
- else
876
- {
877
- avalue[i] = &reg_args->gpr[gprcount];
878
- gprcount += n;
879
- }
880
- }
881
- /* Otherwise, allocate space to make them consecutive. */
882
- else
883
- {
884
- char *a = alloca (16);
885
- unsigned int j;
886
-
887
- avalue[i] = a;
888
- for (j = 0; j < n; j++, a += 8)
889
- {
890
- if (SSE_CLASS_P (classes[j]))
891
- memcpy (a, &reg_args->sse[ssecount++], 8);
892
- else
893
- memcpy (a, &reg_args->gpr[gprcount++], 8);
894
- }
895
- }
896
- }
897
-
898
- /* Invoke the closure. */
899
- fun (cif, rvalue, avalue, user_data);
900
-
901
- /* Tell assembly how to perform return type promotions. */
902
- return flags;
903
- }
904
-
905
- #ifdef FFI_GO_CLOSURES
906
-
907
- extern void ffi_go_closure_unix64(void) FFI_HIDDEN;
908
- extern void ffi_go_closure_unix64_sse(void) FFI_HIDDEN;
909
-
910
- #ifndef __ILP32__
911
- extern ffi_status
912
- ffi_prep_go_closure_efi64(ffi_go_closure* closure, ffi_cif* cif,
913
- void (*fun)(ffi_cif*, void*, void**, void*));
914
- #endif
915
-
916
- ffi_status
917
- ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif,
918
- void (*fun)(ffi_cif*, void*, void**, void*))
919
- {
920
- #ifndef __ILP32__
921
- if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
922
- return ffi_prep_go_closure_efi64(closure, cif, fun);
923
- #endif
924
- if (cif->abi != FFI_UNIX64)
925
- return FFI_BAD_ABI;
926
-
927
- closure->tramp = (cif->flags & UNIX64_FLAG_XMM_ARGS
928
- ? ffi_go_closure_unix64_sse
929
- : ffi_go_closure_unix64);
930
- closure->cif = cif;
931
- closure->fun = fun;
932
-
933
- return FFI_OK;
934
- }
935
-
936
- #endif /* FFI_GO_CLOSURES */
937
-
938
- #if defined(FFI_EXEC_STATIC_TRAMP)
939
- void *
940
- ffi_tramp_arch (size_t *tramp_size, size_t *map_size)
941
- {
942
- extern void *trampoline_code_table;
943
-
944
- *map_size = UNIX64_TRAMP_MAP_SIZE;
945
- *tramp_size = UNIX64_TRAMP_SIZE;
946
- return &trampoline_code_table;
947
- }
948
- #endif
949
-
950
- #endif /* __x86_64__ */