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,832 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
- ffi.c - Copyright (c) 2017, 2022 Anthony Green
3
- Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc.
4
- Copyright (c) 2002 Ranjit Mathew
5
- Copyright (c) 2002 Bo Thorsen
6
- Copyright (c) 2002 Roger Sayle
7
- Copyright (C) 2008, 2010 Free Software Foundation, Inc.
8
-
9
- x86 Foreign Function Interface
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining
12
- a copy of this software and associated documentation files (the
13
- ``Software''), to deal in the Software without restriction, including
14
- without limitation the rights to use, copy, modify, merge, publish,
15
- distribute, sublicense, and/or sell copies of the Software, and to
16
- permit persons to whom the Software is furnished to do so, subject to
17
- the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included
20
- in all copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
23
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29
- DEALINGS IN THE SOFTWARE.
30
- ----------------------------------------------------------------------- */
31
-
32
- #if defined(__i386__) || defined(_M_IX86)
33
- #include <ffi.h>
34
- #include <ffi_common.h>
35
- #include <stdint.h>
36
- #include <stdlib.h>
37
- #include <tramp.h>
38
- #include "internal.h"
39
-
40
- /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
41
- all further uses in this file will refer to the 80-bit type. */
42
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
43
- # if FFI_TYPE_LONGDOUBLE != 4
44
- # error FFI_TYPE_LONGDOUBLE out of date
45
- # endif
46
- #else
47
- # undef FFI_TYPE_LONGDOUBLE
48
- # define FFI_TYPE_LONGDOUBLE 4
49
- #endif
50
-
51
- #if defined(__GNUC__) && !defined(__declspec)
52
- # define __declspec(x) __attribute__((x))
53
- #endif
54
-
55
- #if defined(_MSC_VER) && defined(_M_IX86)
56
- /* Stack is not 16-byte aligned on Windows. */
57
- #define STACK_ALIGN(bytes) (bytes)
58
- #else
59
- #define STACK_ALIGN(bytes) FFI_ALIGN (bytes, 16)
60
- #endif
61
-
62
- /* Perform machine dependent cif processing. */
63
- ffi_status FFI_HIDDEN
64
- ffi_prep_cif_machdep(ffi_cif *cif)
65
- {
66
- size_t bytes = 0;
67
- int i, n, flags, cabi = cif->abi;
68
-
69
- switch (cabi)
70
- {
71
- case FFI_SYSV:
72
- case FFI_STDCALL:
73
- case FFI_THISCALL:
74
- case FFI_FASTCALL:
75
- case FFI_MS_CDECL:
76
- case FFI_PASCAL:
77
- case FFI_REGISTER:
78
- break;
79
- default:
80
- return FFI_BAD_ABI;
81
- }
82
-
83
- switch (cif->rtype->type)
84
- {
85
- case FFI_TYPE_VOID:
86
- flags = X86_RET_VOID;
87
- break;
88
- case FFI_TYPE_FLOAT:
89
- flags = X86_RET_FLOAT;
90
- break;
91
- case FFI_TYPE_DOUBLE:
92
- flags = X86_RET_DOUBLE;
93
- break;
94
- case FFI_TYPE_LONGDOUBLE:
95
- flags = X86_RET_LDOUBLE;
96
- break;
97
- case FFI_TYPE_UINT8:
98
- flags = X86_RET_UINT8;
99
- break;
100
- case FFI_TYPE_UINT16:
101
- flags = X86_RET_UINT16;
102
- break;
103
- case FFI_TYPE_SINT8:
104
- flags = X86_RET_SINT8;
105
- break;
106
- case FFI_TYPE_SINT16:
107
- flags = X86_RET_SINT16;
108
- break;
109
- case FFI_TYPE_INT:
110
- case FFI_TYPE_SINT32:
111
- case FFI_TYPE_UINT32:
112
- case FFI_TYPE_POINTER:
113
- flags = X86_RET_INT32;
114
- break;
115
- case FFI_TYPE_SINT64:
116
- case FFI_TYPE_UINT64:
117
- flags = X86_RET_INT64;
118
- break;
119
- case FFI_TYPE_STRUCT:
120
- {
121
- #ifdef X86_WIN32
122
- size_t size = cif->rtype->size;
123
- if (size == 1)
124
- flags = X86_RET_STRUCT_1B;
125
- else if (size == 2)
126
- flags = X86_RET_STRUCT_2B;
127
- else if (size == 4)
128
- flags = X86_RET_INT32;
129
- else if (size == 8)
130
- flags = X86_RET_INT64;
131
- else
132
- #endif
133
- {
134
- do_struct:
135
- switch (cabi)
136
- {
137
- case FFI_THISCALL:
138
- case FFI_FASTCALL:
139
- case FFI_STDCALL:
140
- case FFI_MS_CDECL:
141
- flags = X86_RET_STRUCTARG;
142
- break;
143
- default:
144
- flags = X86_RET_STRUCTPOP;
145
- break;
146
- }
147
- /* Allocate space for return value pointer. */
148
- bytes += FFI_ALIGN (sizeof(void*), FFI_SIZEOF_ARG);
149
- }
150
- }
151
- break;
152
- case FFI_TYPE_COMPLEX:
153
- switch (cif->rtype->elements[0]->type)
154
- {
155
- case FFI_TYPE_DOUBLE:
156
- case FFI_TYPE_LONGDOUBLE:
157
- case FFI_TYPE_SINT64:
158
- case FFI_TYPE_UINT64:
159
- goto do_struct;
160
- case FFI_TYPE_FLOAT:
161
- case FFI_TYPE_INT:
162
- case FFI_TYPE_SINT32:
163
- case FFI_TYPE_UINT32:
164
- flags = X86_RET_INT64;
165
- break;
166
- case FFI_TYPE_SINT16:
167
- case FFI_TYPE_UINT16:
168
- flags = X86_RET_INT32;
169
- break;
170
- case FFI_TYPE_SINT8:
171
- case FFI_TYPE_UINT8:
172
- flags = X86_RET_STRUCT_2B;
173
- break;
174
- default:
175
- return FFI_BAD_TYPEDEF;
176
- }
177
- break;
178
- default:
179
- return FFI_BAD_TYPEDEF;
180
- }
181
- cif->flags = flags;
182
-
183
- for (i = 0, n = cif->nargs; i < n; i++)
184
- {
185
- ffi_type *t = cif->arg_types[i];
186
-
187
- #if defined(X86_WIN32)
188
- if (cabi == FFI_STDCALL)
189
- bytes = FFI_ALIGN (bytes, FFI_SIZEOF_ARG);
190
- else
191
- #endif
192
- bytes = FFI_ALIGN (bytes, t->alignment);
193
- bytes += FFI_ALIGN (t->size, FFI_SIZEOF_ARG);
194
- }
195
- cif->bytes = bytes;
196
-
197
- return FFI_OK;
198
- }
199
-
200
- static ffi_arg
201
- extend_basic_type(void *arg, int type)
202
- {
203
- switch (type)
204
- {
205
- case FFI_TYPE_SINT8:
206
- return *(SINT8 *)arg;
207
- case FFI_TYPE_UINT8:
208
- return *(UINT8 *)arg;
209
- case FFI_TYPE_SINT16:
210
- return *(SINT16 *)arg;
211
- case FFI_TYPE_UINT16:
212
- return *(UINT16 *)arg;
213
-
214
- case FFI_TYPE_SINT32:
215
- case FFI_TYPE_UINT32:
216
- case FFI_TYPE_POINTER:
217
- case FFI_TYPE_FLOAT:
218
- return *(UINT32 *)arg;
219
-
220
- default:
221
- abort();
222
- }
223
- }
224
-
225
- struct call_frame
226
- {
227
- void *ebp; /* 0 */
228
- void *retaddr; /* 4 */
229
- void (*fn)(void); /* 8 */
230
- int flags; /* 12 */
231
- void *rvalue; /* 16 */
232
- unsigned regs[3]; /* 20-28 */
233
- };
234
-
235
- struct abi_params
236
- {
237
- int dir; /* parameter growth direction */
238
- int static_chain; /* the static chain register used by gcc */
239
- int nregs; /* number of register parameters */
240
- int regs[3];
241
- };
242
-
243
- static const struct abi_params abi_params[FFI_LAST_ABI] = {
244
- [FFI_SYSV] = { 1, R_ECX, 0 },
245
- [FFI_THISCALL] = { 1, R_EAX, 1, { R_ECX } },
246
- [FFI_FASTCALL] = { 1, R_EAX, 2, { R_ECX, R_EDX } },
247
- [FFI_STDCALL] = { 1, R_ECX, 0 },
248
- [FFI_PASCAL] = { -1, R_ECX, 0 },
249
- /* ??? No defined static chain; gcc does not support REGISTER. */
250
- [FFI_REGISTER] = { -1, R_ECX, 3, { R_EAX, R_EDX, R_ECX } },
251
- [FFI_MS_CDECL] = { 1, R_ECX, 0 }
252
- };
253
-
254
- #ifdef HAVE_FASTCALL
255
- #ifdef _MSC_VER
256
- #define FFI_DECLARE_FASTCALL __fastcall
257
- #else
258
- #define FFI_DECLARE_FASTCALL __declspec(fastcall)
259
- #endif
260
- #else
261
- #define FFI_DECLARE_FASTCALL
262
- #endif
263
-
264
- extern void FFI_DECLARE_FASTCALL ffi_call_i386(struct call_frame *, char *) FFI_HIDDEN;
265
-
266
- /* We perform some black magic here to use some of the parent's stack frame in
267
- * ffi_call_i386() that breaks with the MSVC compiler with the /RTCs or /GZ
268
- * flags. Disable the 'Stack frame run time error checking' for this function
269
- * so we don't hit weird exceptions in debug builds. */
270
- #if defined(_MSC_VER)
271
- #pragma runtime_checks("s", off)
272
- #endif
273
- static void
274
- ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
275
- void **avalue, void *closure)
276
- {
277
- size_t rsize, bytes;
278
- struct call_frame *frame;
279
- char *stack, *argp;
280
- ffi_type **arg_types;
281
- int flags, cabi, i, n, dir, narg_reg;
282
- const struct abi_params *pabi;
283
-
284
- flags = cif->flags;
285
- cabi = cif->abi;
286
- pabi = &abi_params[cabi];
287
- dir = pabi->dir;
288
-
289
- rsize = 0;
290
- if (rvalue == NULL)
291
- {
292
- switch (flags)
293
- {
294
- case X86_RET_FLOAT:
295
- case X86_RET_DOUBLE:
296
- case X86_RET_LDOUBLE:
297
- case X86_RET_STRUCTPOP:
298
- case X86_RET_STRUCTARG:
299
- /* The float cases need to pop the 387 stack.
300
- The struct cases need to pass a valid pointer to the callee. */
301
- rsize = cif->rtype->size;
302
- break;
303
- default:
304
- /* We can pretend that the callee returns nothing. */
305
- flags = X86_RET_VOID;
306
- break;
307
- }
308
- }
309
-
310
- bytes = STACK_ALIGN (cif->bytes);
311
- stack = alloca(bytes + sizeof(*frame) + rsize);
312
- argp = (dir < 0 ? stack + bytes : stack);
313
- frame = (struct call_frame *)(stack + bytes);
314
- if (rsize)
315
- rvalue = frame + 1;
316
-
317
- frame->fn = fn;
318
- frame->flags = flags;
319
- frame->rvalue = rvalue;
320
- frame->regs[pabi->static_chain] = (unsigned)closure;
321
-
322
- narg_reg = 0;
323
- switch (flags)
324
- {
325
- case X86_RET_STRUCTARG:
326
- /* The pointer is passed as the first argument. */
327
- if (pabi->nregs > 0)
328
- {
329
- frame->regs[pabi->regs[0]] = (unsigned)rvalue;
330
- narg_reg = 1;
331
- break;
332
- }
333
- /* fallthru */
334
- case X86_RET_STRUCTPOP:
335
- *(void **)argp = rvalue;
336
- argp += sizeof(void *);
337
- break;
338
- }
339
-
340
- arg_types = cif->arg_types;
341
- for (i = 0, n = cif->nargs; i < n; i++)
342
- {
343
- ffi_type *ty = arg_types[i];
344
- void *valp = avalue[i];
345
- size_t z = ty->size;
346
- int t = ty->type;
347
-
348
- if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT)
349
- {
350
- ffi_arg val = extend_basic_type (valp, t);
351
-
352
- if (t != FFI_TYPE_FLOAT && narg_reg < pabi->nregs)
353
- frame->regs[pabi->regs[narg_reg++]] = val;
354
- else if (dir < 0)
355
- {
356
- argp -= 4;
357
- *(ffi_arg *)argp = val;
358
- }
359
- else
360
- {
361
- *(ffi_arg *)argp = val;
362
- argp += 4;
363
- }
364
- }
365
- else
366
- {
367
- size_t za = FFI_ALIGN (z, FFI_SIZEOF_ARG);
368
- size_t align = FFI_SIZEOF_ARG;
369
-
370
- /* Issue 434: For thiscall and fastcall, if the paramter passed
371
- as 64-bit integer or struct, all following integer parameters
372
- will be passed on stack. */
373
- if ((cabi == FFI_THISCALL || cabi == FFI_FASTCALL)
374
- && (t == FFI_TYPE_SINT64
375
- || t == FFI_TYPE_UINT64
376
- || t == FFI_TYPE_STRUCT))
377
- narg_reg = 2;
378
-
379
- /* Alignment rules for arguments are quite complex. Vectors and
380
- structures with 16 byte alignment get it. Note that long double
381
- on Darwin does have 16 byte alignment, and does not get this
382
- alignment if passed directly; a structure with a long double
383
- inside, however, would get 16 byte alignment. Since libffi does
384
- not support vectors, we need non concern ourselves with other
385
- cases. */
386
- if (t == FFI_TYPE_STRUCT && ty->alignment >= 16)
387
- align = 16;
388
-
389
- if (dir < 0)
390
- {
391
- /* ??? These reverse argument ABIs are probably too old
392
- to have cared about alignment. Someone should check. */
393
- argp -= za;
394
- memcpy (argp, valp, z);
395
- }
396
- else
397
- {
398
- argp = (char *)FFI_ALIGN (argp, align);
399
- memcpy (argp, valp, z);
400
- argp += za;
401
- }
402
- }
403
- }
404
- FFI_ASSERT (dir > 0 || argp == stack);
405
-
406
- ffi_call_i386 (frame, stack);
407
- }
408
- #if defined(_MSC_VER)
409
- #pragma runtime_checks("s", restore)
410
- #endif
411
-
412
- void
413
- ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
414
- {
415
- ffi_call_int (cif, fn, rvalue, avalue, NULL);
416
- }
417
-
418
- #ifdef FFI_GO_CLOSURES
419
- void
420
- ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
421
- void **avalue, void *closure)
422
- {
423
- ffi_call_int (cif, fn, rvalue, avalue, closure);
424
- }
425
- #endif
426
-
427
- /** private members **/
428
-
429
- void FFI_HIDDEN ffi_closure_i386(void);
430
- void FFI_HIDDEN ffi_closure_STDCALL(void);
431
- void FFI_HIDDEN ffi_closure_REGISTER(void);
432
- #if defined(FFI_EXEC_STATIC_TRAMP)
433
- void FFI_HIDDEN ffi_closure_i386_alt(void);
434
- void FFI_HIDDEN ffi_closure_STDCALL_alt(void);
435
- void FFI_HIDDEN ffi_closure_REGISTER_alt(void);
436
- #endif
437
-
438
- struct closure_frame
439
- {
440
- unsigned rettemp[4]; /* 0 */
441
- unsigned regs[3]; /* 16-24 */
442
- ffi_cif *cif; /* 28 */
443
- void (*fun)(ffi_cif*,void*,void**,void*); /* 32 */
444
- void *user_data; /* 36 */
445
- };
446
-
447
- int FFI_HIDDEN FFI_DECLARE_FASTCALL
448
- ffi_closure_inner (struct closure_frame *frame, char *stack)
449
- {
450
- ffi_cif *cif = frame->cif;
451
- int cabi, i, n, flags, dir, narg_reg;
452
- const struct abi_params *pabi;
453
- ffi_type **arg_types;
454
- char *argp;
455
- void *rvalue;
456
- void **avalue;
457
-
458
- cabi = cif->abi;
459
- flags = cif->flags;
460
- narg_reg = 0;
461
- rvalue = frame->rettemp;
462
- pabi = &abi_params[cabi];
463
- dir = pabi->dir;
464
- argp = (dir < 0 ? stack + STACK_ALIGN (cif->bytes) : stack);
465
-
466
- switch (flags)
467
- {
468
- case X86_RET_STRUCTARG:
469
- if (pabi->nregs > 0)
470
- {
471
- rvalue = (void *)frame->regs[pabi->regs[0]];
472
- narg_reg = 1;
473
- frame->rettemp[0] = (unsigned)rvalue;
474
- break;
475
- }
476
- /* fallthru */
477
- case X86_RET_STRUCTPOP:
478
- rvalue = *(void **)argp;
479
- argp += sizeof(void *);
480
- frame->rettemp[0] = (unsigned)rvalue;
481
- break;
482
- }
483
-
484
- n = cif->nargs;
485
- avalue = alloca(sizeof(void *) * n);
486
-
487
- arg_types = cif->arg_types;
488
- for (i = 0; i < n; ++i)
489
- {
490
- ffi_type *ty = arg_types[i];
491
- size_t z = ty->size;
492
- int t = ty->type;
493
- void *valp;
494
-
495
- if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT)
496
- {
497
- if (t != FFI_TYPE_FLOAT && narg_reg < pabi->nregs)
498
- valp = &frame->regs[pabi->regs[narg_reg++]];
499
- else if (dir < 0)
500
- {
501
- argp -= 4;
502
- valp = argp;
503
- }
504
- else
505
- {
506
- valp = argp;
507
- argp += 4;
508
- }
509
- }
510
- else
511
- {
512
- size_t za = FFI_ALIGN (z, FFI_SIZEOF_ARG);
513
- size_t align = FFI_SIZEOF_ARG;
514
-
515
- /* See the comment in ffi_call_int. */
516
- if (t == FFI_TYPE_STRUCT && ty->alignment >= 16)
517
- align = 16;
518
-
519
- /* Issue 434: For thiscall and fastcall, if the paramter passed
520
- as 64-bit integer or struct, all following integer parameters
521
- will be passed on stack. */
522
- if ((cabi == FFI_THISCALL || cabi == FFI_FASTCALL)
523
- && (t == FFI_TYPE_SINT64
524
- || t == FFI_TYPE_UINT64
525
- || t == FFI_TYPE_STRUCT))
526
- narg_reg = 2;
527
-
528
- if (dir < 0)
529
- {
530
- /* ??? These reverse argument ABIs are probably too old
531
- to have cared about alignment. Someone should check. */
532
- argp -= za;
533
- valp = argp;
534
- }
535
- else
536
- {
537
- argp = (char *)FFI_ALIGN (argp, align);
538
- valp = argp;
539
- argp += za;
540
- }
541
- }
542
-
543
- avalue[i] = valp;
544
- }
545
-
546
- frame->fun (cif, rvalue, avalue, frame->user_data);
547
-
548
- switch (cabi)
549
- {
550
- case FFI_STDCALL:
551
- return flags | (cif->bytes << X86_RET_POP_SHIFT);
552
- case FFI_THISCALL:
553
- case FFI_FASTCALL:
554
- return flags | ((cif->bytes - (narg_reg * FFI_SIZEOF_ARG))
555
- << X86_RET_POP_SHIFT);
556
- default:
557
- return flags;
558
- }
559
- }
560
-
561
- ffi_status
562
- ffi_prep_closure_loc (ffi_closure* closure,
563
- ffi_cif* cif,
564
- void (*fun)(ffi_cif*,void*,void**,void*),
565
- void *user_data,
566
- void *codeloc)
567
- {
568
- char *tramp = closure->tramp;
569
- void (*dest)(void);
570
- int op = 0xb8; /* movl imm, %eax */
571
-
572
- switch (cif->abi)
573
- {
574
- case FFI_SYSV:
575
- case FFI_MS_CDECL:
576
- dest = ffi_closure_i386;
577
- break;
578
- case FFI_STDCALL:
579
- case FFI_THISCALL:
580
- case FFI_FASTCALL:
581
- case FFI_PASCAL:
582
- dest = ffi_closure_STDCALL;
583
- break;
584
- case FFI_REGISTER:
585
- dest = ffi_closure_REGISTER;
586
- op = 0x68; /* pushl imm */
587
- break;
588
- default:
589
- return FFI_BAD_ABI;
590
- }
591
-
592
- #if defined(FFI_EXEC_STATIC_TRAMP)
593
- if (ffi_tramp_is_present(closure))
594
- {
595
- /* Initialize the static trampoline's parameters. */
596
- if (dest == ffi_closure_i386)
597
- dest = ffi_closure_i386_alt;
598
- else if (dest == ffi_closure_STDCALL)
599
- dest = ffi_closure_STDCALL_alt;
600
- else
601
- dest = ffi_closure_REGISTER_alt;
602
- ffi_tramp_set_parms (closure->ftramp, dest, closure);
603
- goto out;
604
- }
605
- #endif
606
-
607
- /* Initialize the dynamic trampoline. */
608
- /* endbr32. */
609
- *(UINT32 *) tramp = 0xfb1e0ff3;
610
-
611
- /* movl or pushl immediate. */
612
- tramp[4] = op;
613
- *(void **)(tramp + 5) = codeloc;
614
-
615
- /* jmp dest */
616
- tramp[9] = 0xe9;
617
- *(unsigned *)(tramp + 10) = (unsigned)dest - ((unsigned)codeloc + 14);
618
-
619
- #if defined(FFI_EXEC_STATIC_TRAMP)
620
- out:
621
- #endif
622
- closure->cif = cif;
623
- closure->fun = fun;
624
- closure->user_data = user_data;
625
-
626
- return FFI_OK;
627
- }
628
-
629
- #ifdef FFI_GO_CLOSURES
630
-
631
- void FFI_HIDDEN ffi_go_closure_EAX(void);
632
- void FFI_HIDDEN ffi_go_closure_ECX(void);
633
- void FFI_HIDDEN ffi_go_closure_STDCALL(void);
634
-
635
- ffi_status
636
- ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif,
637
- void (*fun)(ffi_cif*,void*,void**,void*))
638
- {
639
- void (*dest)(void);
640
-
641
- switch (cif->abi)
642
- {
643
- case FFI_SYSV:
644
- case FFI_MS_CDECL:
645
- dest = ffi_go_closure_ECX;
646
- break;
647
- case FFI_THISCALL:
648
- case FFI_FASTCALL:
649
- dest = ffi_go_closure_EAX;
650
- break;
651
- case FFI_STDCALL:
652
- case FFI_PASCAL:
653
- dest = ffi_go_closure_STDCALL;
654
- break;
655
- case FFI_REGISTER:
656
- default:
657
- return FFI_BAD_ABI;
658
- }
659
-
660
- closure->tramp = dest;
661
- closure->cif = cif;
662
- closure->fun = fun;
663
-
664
- return FFI_OK;
665
- }
666
-
667
- #endif /* FFI_GO_CLOSURES */
668
-
669
- /* ------- Native raw API support -------------------------------- */
670
-
671
- #if !FFI_NO_RAW_API
672
-
673
- void FFI_HIDDEN ffi_closure_raw_SYSV(void);
674
- void FFI_HIDDEN ffi_closure_raw_THISCALL(void);
675
-
676
- ffi_status
677
- ffi_prep_raw_closure_loc (ffi_raw_closure *closure,
678
- ffi_cif *cif,
679
- void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
680
- void *user_data,
681
- void *codeloc)
682
- {
683
- char *tramp = closure->tramp;
684
- void (*dest)(void);
685
- int i;
686
-
687
- /* We currently don't support certain kinds of arguments for raw
688
- closures. This should be implemented by a separate assembly
689
- language routine, since it would require argument processing,
690
- something we don't do now for performance. */
691
- for (i = cif->nargs-1; i >= 0; i--)
692
- switch (cif->arg_types[i]->type)
693
- {
694
- case FFI_TYPE_STRUCT:
695
- case FFI_TYPE_LONGDOUBLE:
696
- return FFI_BAD_TYPEDEF;
697
- }
698
-
699
- switch (cif->abi)
700
- {
701
- case FFI_THISCALL:
702
- dest = ffi_closure_raw_THISCALL;
703
- break;
704
- case FFI_SYSV:
705
- dest = ffi_closure_raw_SYSV;
706
- break;
707
- default:
708
- return FFI_BAD_ABI;
709
- }
710
-
711
- /* movl imm, %eax. */
712
- tramp[0] = 0xb8;
713
- *(void **)(tramp + 1) = codeloc;
714
-
715
- /* jmp dest */
716
- tramp[5] = 0xe9;
717
- *(unsigned *)(tramp + 6) = (unsigned)dest - ((unsigned)codeloc + 10);
718
-
719
- closure->cif = cif;
720
- closure->fun = fun;
721
- closure->user_data = user_data;
722
-
723
- return FFI_OK;
724
- }
725
-
726
- void
727
- ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *avalue)
728
- {
729
- size_t rsize, bytes;
730
- struct call_frame *frame;
731
- char *stack, *argp;
732
- ffi_type **arg_types;
733
- int flags, cabi, i, n, narg_reg;
734
- const struct abi_params *pabi;
735
-
736
- flags = cif->flags;
737
- cabi = cif->abi;
738
- pabi = &abi_params[cabi];
739
-
740
- rsize = 0;
741
- if (rvalue == NULL)
742
- {
743
- switch (flags)
744
- {
745
- case X86_RET_FLOAT:
746
- case X86_RET_DOUBLE:
747
- case X86_RET_LDOUBLE:
748
- case X86_RET_STRUCTPOP:
749
- case X86_RET_STRUCTARG:
750
- /* The float cases need to pop the 387 stack.
751
- The struct cases need to pass a valid pointer to the callee. */
752
- rsize = cif->rtype->size;
753
- break;
754
- default:
755
- /* We can pretend that the callee returns nothing. */
756
- flags = X86_RET_VOID;
757
- break;
758
- }
759
- }
760
-
761
- bytes = STACK_ALIGN (cif->bytes);
762
- argp = stack =
763
- (void *)((uintptr_t)alloca(bytes + sizeof(*frame) + rsize + 15) & ~16);
764
- frame = (struct call_frame *)(stack + bytes);
765
- if (rsize)
766
- rvalue = frame + 1;
767
-
768
- frame->fn = fn;
769
- frame->flags = flags;
770
- frame->rvalue = rvalue;
771
-
772
- narg_reg = 0;
773
- switch (flags)
774
- {
775
- case X86_RET_STRUCTARG:
776
- /* The pointer is passed as the first argument. */
777
- if (pabi->nregs > 0)
778
- {
779
- frame->regs[pabi->regs[0]] = (unsigned)rvalue;
780
- narg_reg = 1;
781
- break;
782
- }
783
- /* fallthru */
784
- case X86_RET_STRUCTPOP:
785
- *(void **)argp = rvalue;
786
- argp += sizeof(void *);
787
- bytes -= sizeof(void *);
788
- break;
789
- }
790
-
791
- arg_types = cif->arg_types;
792
- for (i = 0, n = cif->nargs; narg_reg < pabi->nregs && i < n; i++)
793
- {
794
- ffi_type *ty = arg_types[i];
795
- size_t z = ty->size;
796
- int t = ty->type;
797
-
798
- if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT && t != FFI_TYPE_FLOAT)
799
- {
800
- ffi_arg val = extend_basic_type (avalue, t);
801
- frame->regs[pabi->regs[narg_reg++]] = val;
802
- z = FFI_SIZEOF_ARG;
803
- }
804
- else
805
- {
806
- memcpy (argp, avalue, z);
807
- z = FFI_ALIGN (z, FFI_SIZEOF_ARG);
808
- argp += z;
809
- }
810
- avalue += z;
811
- bytes -= z;
812
- }
813
- if (i < n)
814
- memcpy (argp, avalue, bytes);
815
-
816
- ffi_call_i386 (frame, stack);
817
- }
818
- #endif /* !FFI_NO_RAW_API */
819
-
820
- #if defined(FFI_EXEC_STATIC_TRAMP)
821
- void *
822
- ffi_tramp_arch (size_t *tramp_size, size_t *map_size)
823
- {
824
- extern void *trampoline_code_table;
825
-
826
- *map_size = X86_TRAMP_MAP_SIZE;
827
- *tramp_size = X86_TRAMP_SIZE;
828
- return &trampoline_code_table;
829
- }
830
- #endif
831
-
832
- #endif /* __i386__ */