ffi 0.4.0-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

Files changed (316) hide show
  1. data/LICENSE +51 -0
  2. data/README.rdoc +69 -0
  3. data/Rakefile +142 -0
  4. data/ext/ffi_c/AbstractMemory.c +412 -0
  5. data/ext/ffi_c/AbstractMemory.h +68 -0
  6. data/ext/ffi_c/AutoPointer.c +60 -0
  7. data/ext/ffi_c/AutoPointer.h +18 -0
  8. data/ext/ffi_c/Buffer.c +171 -0
  9. data/ext/ffi_c/Callback.c +374 -0
  10. data/ext/ffi_c/Callback.h +47 -0
  11. data/ext/ffi_c/DynamicLibrary.c +213 -0
  12. data/ext/ffi_c/DynamicLibrary.h +22 -0
  13. data/ext/ffi_c/Invoker.c +962 -0
  14. data/ext/ffi_c/LastError.c +135 -0
  15. data/ext/ffi_c/LastError.h +18 -0
  16. data/ext/ffi_c/MemoryPointer.c +156 -0
  17. data/ext/ffi_c/MemoryPointer.h +20 -0
  18. data/ext/ffi_c/NullPointer.c +143 -0
  19. data/ext/ffi_c/Platform.c +59 -0
  20. data/ext/ffi_c/Platform.h +16 -0
  21. data/ext/ffi_c/Pointer.c +164 -0
  22. data/ext/ffi_c/Pointer.h +25 -0
  23. data/ext/ffi_c/Struct.c +477 -0
  24. data/ext/ffi_c/Struct.h +26 -0
  25. data/ext/ffi_c/Type.c +230 -0
  26. data/ext/ffi_c/Type.h +28 -0
  27. data/ext/ffi_c/Types.c +118 -0
  28. data/ext/ffi_c/Types.h +54 -0
  29. data/ext/ffi_c/compat.h +22 -0
  30. data/ext/ffi_c/endian.h +40 -0
  31. data/ext/ffi_c/extconf.rb +31 -0
  32. data/ext/ffi_c/ffi.c +76 -0
  33. data/ext/ffi_c/libffi.bsd.mk +34 -0
  34. data/ext/ffi_c/libffi.darwin.mk +75 -0
  35. data/ext/ffi_c/libffi.gnu.mk +29 -0
  36. data/ext/ffi_c/libffi.mk +13 -0
  37. data/ext/ffi_c/libffi/ChangeLog +3243 -0
  38. data/ext/ffi_c/libffi/ChangeLog.libffi +347 -0
  39. data/ext/ffi_c/libffi/ChangeLog.libgcj +40 -0
  40. data/ext/ffi_c/libffi/ChangeLog.v1 +764 -0
  41. data/ext/ffi_c/libffi/LICENSE +21 -0
  42. data/ext/ffi_c/libffi/Makefile.am +177 -0
  43. data/ext/ffi_c/libffi/Makefile.in +1640 -0
  44. data/ext/ffi_c/libffi/README +328 -0
  45. data/ext/ffi_c/libffi/TODO +1 -0
  46. data/ext/ffi_c/libffi/acinclude.m4 +92 -0
  47. data/ext/ffi_c/libffi/aclocal.m4 +7516 -0
  48. data/ext/ffi_c/libffi/compile +142 -0
  49. data/ext/ffi_c/libffi/config.guess +1516 -0
  50. data/ext/ffi_c/libffi/config.sub +1626 -0
  51. data/ext/ffi_c/libffi/configure +24414 -0
  52. data/ext/ffi_c/libffi/configure.ac +365 -0
  53. data/ext/ffi_c/libffi/configure.host +11 -0
  54. data/ext/ffi_c/libffi/depcomp +584 -0
  55. data/ext/ffi_c/libffi/doc/libffi.info +533 -0
  56. data/ext/ffi_c/libffi/doc/libffi.texi +541 -0
  57. data/ext/ffi_c/libffi/doc/stamp-vti +4 -0
  58. data/ext/ffi_c/libffi/doc/version.texi +4 -0
  59. data/ext/ffi_c/libffi/fficonfig.h.in +160 -0
  60. data/ext/ffi_c/libffi/include/Makefile.am +9 -0
  61. data/ext/ffi_c/libffi/include/Makefile.in +422 -0
  62. data/ext/ffi_c/libffi/include/ffi.h.in +393 -0
  63. data/ext/ffi_c/libffi/include/ffi_common.h +98 -0
  64. data/ext/ffi_c/libffi/install-sh +323 -0
  65. data/ext/ffi_c/libffi/libffi.pc.in +10 -0
  66. data/ext/ffi_c/libffi/libtool-version +29 -0
  67. data/ext/ffi_c/libffi/ltcf-c.sh +861 -0
  68. data/ext/ffi_c/libffi/ltcf-cxx.sh +1069 -0
  69. data/ext/ffi_c/libffi/ltcf-gcj.sh +700 -0
  70. data/ext/ffi_c/libffi/ltconfig +2862 -0
  71. data/ext/ffi_c/libffi/ltmain.sh +6930 -0
  72. data/ext/ffi_c/libffi/man/Makefile.am +8 -0
  73. data/ext/ffi_c/libffi/man/Makefile.in +395 -0
  74. data/ext/ffi_c/libffi/man/ffi.3 +31 -0
  75. data/ext/ffi_c/libffi/man/ffi_call.3 +103 -0
  76. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +66 -0
  77. data/ext/ffi_c/libffi/mdate-sh +201 -0
  78. data/ext/ffi_c/libffi/missing +353 -0
  79. data/ext/ffi_c/libffi/mkinstalldirs +158 -0
  80. data/ext/ffi_c/libffi/src/alpha/ffi.c +284 -0
  81. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +48 -0
  82. data/ext/ffi_c/libffi/src/alpha/osf.S +366 -0
  83. data/ext/ffi_c/libffi/src/arm/ffi.c +309 -0
  84. data/ext/ffi_c/libffi/src/arm/ffitarget.h +49 -0
  85. data/ext/ffi_c/libffi/src/arm/sysv.S +299 -0
  86. data/ext/ffi_c/libffi/src/closures.c +596 -0
  87. data/ext/ffi_c/libffi/src/cris/ffi.c +383 -0
  88. data/ext/ffi_c/libffi/src/cris/ffitarget.h +51 -0
  89. data/ext/ffi_c/libffi/src/cris/sysv.S +215 -0
  90. data/ext/ffi_c/libffi/src/debug.c +59 -0
  91. data/ext/ffi_c/libffi/src/dlmalloc.c +5099 -0
  92. data/ext/ffi_c/libffi/src/frv/eabi.S +128 -0
  93. data/ext/ffi_c/libffi/src/frv/ffi.c +292 -0
  94. data/ext/ffi_c/libffi/src/frv/ffitarget.h +61 -0
  95. data/ext/ffi_c/libffi/src/ia64/ffi.c +580 -0
  96. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +50 -0
  97. data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +40 -0
  98. data/ext/ffi_c/libffi/src/ia64/unix.S +560 -0
  99. data/ext/ffi_c/libffi/src/java_raw_api.c +359 -0
  100. data/ext/ffi_c/libffi/src/m32r/ffi.c +232 -0
  101. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +48 -0
  102. data/ext/ffi_c/libffi/src/m32r/sysv.S +121 -0
  103. data/ext/ffi_c/libffi/src/m68k/ffi.c +278 -0
  104. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +49 -0
  105. data/ext/ffi_c/libffi/src/m68k/sysv.S +234 -0
  106. data/ext/ffi_c/libffi/src/mips/ffi.c +926 -0
  107. data/ext/ffi_c/libffi/src/mips/ffitarget.h +202 -0
  108. data/ext/ffi_c/libffi/src/mips/n32.S +534 -0
  109. data/ext/ffi_c/libffi/src/mips/o32.S +381 -0
  110. data/ext/ffi_c/libffi/src/pa/ffi.c +709 -0
  111. data/ext/ffi_c/libffi/src/pa/ffitarget.h +77 -0
  112. data/ext/ffi_c/libffi/src/pa/hpux32.S +368 -0
  113. data/ext/ffi_c/libffi/src/pa/linux.S +357 -0
  114. data/ext/ffi_c/libffi/src/powerpc/aix.S +225 -0
  115. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +247 -0
  116. data/ext/ffi_c/libffi/src/powerpc/asm.h +125 -0
  117. data/ext/ffi_c/libffi/src/powerpc/darwin.S +245 -0
  118. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +317 -0
  119. data/ext/ffi_c/libffi/src/powerpc/ffi.c +1429 -0
  120. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +800 -0
  121. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +118 -0
  122. data/ext/ffi_c/libffi/src/powerpc/linux64.S +187 -0
  123. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +236 -0
  124. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +327 -0
  125. data/ext/ffi_c/libffi/src/powerpc/sysv.S +230 -0
  126. data/ext/ffi_c/libffi/src/prep_cif.c +174 -0
  127. data/ext/ffi_c/libffi/src/raw_api.c +254 -0
  128. data/ext/ffi_c/libffi/src/s390/ffi.c +780 -0
  129. data/ext/ffi_c/libffi/src/s390/ffitarget.h +60 -0
  130. data/ext/ffi_c/libffi/src/s390/sysv.S +434 -0
  131. data/ext/ffi_c/libffi/src/sh/ffi.c +716 -0
  132. data/ext/ffi_c/libffi/src/sh/ffitarget.h +49 -0
  133. data/ext/ffi_c/libffi/src/sh/sysv.S +850 -0
  134. data/ext/ffi_c/libffi/src/sh64/ffi.c +453 -0
  135. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +53 -0
  136. data/ext/ffi_c/libffi/src/sh64/sysv.S +530 -0
  137. data/ext/ffi_c/libffi/src/sparc/ffi.c +610 -0
  138. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +66 -0
  139. data/ext/ffi_c/libffi/src/sparc/v8.S +272 -0
  140. data/ext/ffi_c/libffi/src/sparc/v9.S +307 -0
  141. data/ext/ffi_c/libffi/src/types.c +77 -0
  142. data/ext/ffi_c/libffi/src/x86/darwin.S +443 -0
  143. data/ext/ffi_c/libffi/src/x86/darwin64.S +416 -0
  144. data/ext/ffi_c/libffi/src/x86/ffi.c +475 -0
  145. data/ext/ffi_c/libffi/src/x86/ffi64.c +572 -0
  146. data/ext/ffi_c/libffi/src/x86/ffitarget.h +90 -0
  147. data/ext/ffi_c/libffi/src/x86/freebsd.S +458 -0
  148. data/ext/ffi_c/libffi/src/x86/sysv.S +437 -0
  149. data/ext/ffi_c/libffi/src/x86/unix64.S +418 -0
  150. data/ext/ffi_c/libffi/src/x86/win32.S +391 -0
  151. data/ext/ffi_c/libffi/testsuite/Makefile.am +71 -0
  152. data/ext/ffi_c/libffi/testsuite/Makefile.in +447 -0
  153. data/ext/ffi_c/libffi/testsuite/config/default.exp +1 -0
  154. data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +289 -0
  155. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +263 -0
  156. data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +45 -0
  157. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +36 -0
  158. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +97 -0
  159. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +89 -0
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +89 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +90 -0
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +97 -0
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +99 -0
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +98 -0
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c +72 -0
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +102 -0
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +103 -0
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +104 -0
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +110 -0
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +97 -0
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +99 -0
  172. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +101 -0
  173. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +121 -0
  174. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +98 -0
  175. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +103 -0
  176. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +98 -0
  177. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +98 -0
  178. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +106 -0
  179. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +98 -0
  180. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +117 -0
  181. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +106 -0
  182. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +132 -0
  183. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +121 -0
  184. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +107 -0
  185. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +125 -0
  186. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +105 -0
  187. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +96 -0
  188. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +98 -0
  189. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +99 -0
  190. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +101 -0
  191. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +99 -0
  192. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +100 -0
  193. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +101 -0
  194. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +99 -0
  195. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +99 -0
  196. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +99 -0
  197. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +99 -0
  198. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +99 -0
  199. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +100 -0
  200. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +51 -0
  201. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +51 -0
  202. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +82 -0
  203. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +82 -0
  204. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +94 -0
  205. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +99 -0
  206. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +82 -0
  207. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +94 -0
  208. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +52 -0
  209. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +50 -0
  210. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +50 -0
  211. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +50 -0
  212. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +51 -0
  213. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +54 -0
  214. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +51 -0
  215. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +86 -0
  216. data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +59 -0
  217. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +58 -0
  218. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +57 -0
  219. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +72 -0
  220. data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +62 -0
  221. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +69 -0
  222. data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +63 -0
  223. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +53 -0
  224. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +160 -0
  225. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +169 -0
  226. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +141 -0
  227. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +118 -0
  228. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +119 -0
  229. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +119 -0
  230. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +120 -0
  231. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +139 -0
  232. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +119 -0
  233. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +139 -0
  234. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +139 -0
  235. data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +98 -0
  236. data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +59 -0
  237. data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +114 -0
  238. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +35 -0
  239. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +43 -0
  240. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +42 -0
  241. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +35 -0
  242. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +36 -0
  243. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +49 -0
  244. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +42 -0
  245. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +34 -0
  246. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +41 -0
  247. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +42 -0
  248. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +36 -0
  249. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +38 -0
  250. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +38 -0
  251. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +38 -0
  252. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +44 -0
  253. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c +44 -0
  254. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +65 -0
  255. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +67 -0
  256. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +59 -0
  257. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +63 -0
  258. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +65 -0
  259. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +64 -0
  260. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +74 -0
  261. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +80 -0
  262. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +67 -0
  263. data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +86 -0
  264. data/ext/ffi_c/libffi/testsuite/libffi.special/special.exp +38 -0
  265. data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc +123 -0
  266. data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +53 -0
  267. data/ext/ffi_c/libffi/texinfo.tex +7482 -0
  268. data/ext/ffi_c/rbffi.h +23 -0
  269. data/gen/Rakefile +12 -0
  270. data/lib/1.8/ffi_c.so +0 -0
  271. data/lib/1.9/ffi_c.so +0 -0
  272. data/lib/ffi.rb +11 -0
  273. data/lib/ffi/autopointer.rb +61 -0
  274. data/lib/ffi/buffer.rb +0 -0
  275. data/lib/ffi/callback.rb +10 -0
  276. data/lib/ffi/enum.rb +78 -0
  277. data/lib/ffi/errno.rb +8 -0
  278. data/lib/ffi/ffi.rb +96 -0
  279. data/lib/ffi/io.rb +21 -0
  280. data/lib/ffi/library.rb +243 -0
  281. data/lib/ffi/managedstruct.rb +55 -0
  282. data/lib/ffi/memorypointer.rb +73 -0
  283. data/lib/ffi/platform.rb +78 -0
  284. data/lib/ffi/pointer.rb +119 -0
  285. data/lib/ffi/struct.rb +354 -0
  286. data/lib/ffi/tools/const_generator.rb +177 -0
  287. data/lib/ffi/tools/generator.rb +58 -0
  288. data/lib/ffi/tools/generator_task.rb +35 -0
  289. data/lib/ffi/tools/struct_generator.rb +194 -0
  290. data/lib/ffi/tools/types_generator.rb +123 -0
  291. data/lib/ffi/types.rb +153 -0
  292. data/lib/ffi/union.rb +17 -0
  293. data/lib/ffi/variadic.rb +30 -0
  294. data/spec/ffi/bool_spec.rb +24 -0
  295. data/spec/ffi/buffer_spec.rb +196 -0
  296. data/spec/ffi/callback_spec.rb +560 -0
  297. data/spec/ffi/enum_spec.rb +164 -0
  298. data/spec/ffi/errno_spec.rb +13 -0
  299. data/spec/ffi/library_spec.rb +144 -0
  300. data/spec/ffi/managed_struct_spec.rb +56 -0
  301. data/spec/ffi/number_spec.rb +231 -0
  302. data/spec/ffi/pointer_spec.rb +195 -0
  303. data/spec/ffi/rbx/attach_function_spec.rb +27 -0
  304. data/spec/ffi/rbx/memory_pointer_spec.rb +102 -0
  305. data/spec/ffi/rbx/spec_helper.rb +1 -0
  306. data/spec/ffi/rbx/struct_spec.rb +13 -0
  307. data/spec/ffi/spec_helper.rb +17 -0
  308. data/spec/ffi/string_spec.rb +103 -0
  309. data/spec/ffi/struct_callback_spec.rb +41 -0
  310. data/spec/ffi/struct_initialize_spec.rb +30 -0
  311. data/spec/ffi/struct_spec.rb +476 -0
  312. data/spec/ffi/typedef_spec.rb +48 -0
  313. data/spec/ffi/union_spec.rb +60 -0
  314. data/spec/ffi/variadic_spec.rb +84 -0
  315. data/spec/spec.opts +4 -0
  316. metadata +375 -0
@@ -0,0 +1,610 @@
1
+ /* -----------------------------------------------------------------------
2
+ ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc.
3
+
4
+ SPARC Foreign Function Interface
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ ``Software''), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included
15
+ in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24
+ DEALINGS IN THE SOFTWARE.
25
+ ----------------------------------------------------------------------- */
26
+
27
+ #include <ffi.h>
28
+ #include <ffi_common.h>
29
+
30
+ #include <stdlib.h>
31
+
32
+
33
+ /* ffi_prep_args is called by the assembly routine once stack space
34
+ has been allocated for the function's arguments */
35
+
36
+ void ffi_prep_args_v8(char *stack, extended_cif *ecif)
37
+ {
38
+ int i;
39
+ void **p_argv;
40
+ char *argp;
41
+ ffi_type **p_arg;
42
+
43
+ /* Skip 16 words for the window save area */
44
+ argp = stack + 16*sizeof(int);
45
+
46
+ /* This should only really be done when we are returning a structure,
47
+ however, it's faster just to do it all the time...
48
+
49
+ if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) */
50
+ *(int *) argp = (long)ecif->rvalue;
51
+
52
+ /* And 1 word for the structure return value. */
53
+ argp += sizeof(int);
54
+
55
+ #ifdef USING_PURIFY
56
+ /* Purify will probably complain in our assembly routine, unless we
57
+ zero out this memory. */
58
+
59
+ ((int*)argp)[0] = 0;
60
+ ((int*)argp)[1] = 0;
61
+ ((int*)argp)[2] = 0;
62
+ ((int*)argp)[3] = 0;
63
+ ((int*)argp)[4] = 0;
64
+ ((int*)argp)[5] = 0;
65
+ #endif
66
+
67
+ p_argv = ecif->avalue;
68
+
69
+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++)
70
+ {
71
+ size_t z;
72
+
73
+ if ((*p_arg)->type == FFI_TYPE_STRUCT
74
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
75
+ || (*p_arg)->type == FFI_TYPE_LONGDOUBLE
76
+ #endif
77
+ )
78
+ {
79
+ *(unsigned int *) argp = (unsigned long)(* p_argv);
80
+ z = sizeof(int);
81
+ }
82
+ else
83
+ {
84
+ z = (*p_arg)->size;
85
+ if (z < sizeof(int))
86
+ {
87
+ z = sizeof(int);
88
+ switch ((*p_arg)->type)
89
+ {
90
+ case FFI_TYPE_SINT8:
91
+ *(signed int *) argp = *(SINT8 *)(* p_argv);
92
+ break;
93
+
94
+ case FFI_TYPE_UINT8:
95
+ *(unsigned int *) argp = *(UINT8 *)(* p_argv);
96
+ break;
97
+
98
+ case FFI_TYPE_SINT16:
99
+ *(signed int *) argp = *(SINT16 *)(* p_argv);
100
+ break;
101
+
102
+ case FFI_TYPE_UINT16:
103
+ *(unsigned int *) argp = *(UINT16 *)(* p_argv);
104
+ break;
105
+
106
+ default:
107
+ FFI_ASSERT(0);
108
+ }
109
+ }
110
+ else
111
+ {
112
+ memcpy(argp, *p_argv, z);
113
+ }
114
+ }
115
+ p_argv++;
116
+ argp += z;
117
+ }
118
+
119
+ return;
120
+ }
121
+
122
+ int ffi_prep_args_v9(char *stack, extended_cif *ecif)
123
+ {
124
+ int i, ret = 0;
125
+ int tmp;
126
+ void **p_argv;
127
+ char *argp;
128
+ ffi_type **p_arg;
129
+
130
+ tmp = 0;
131
+
132
+ /* Skip 16 words for the window save area */
133
+ argp = stack + 16*sizeof(long long);
134
+
135
+ #ifdef USING_PURIFY
136
+ /* Purify will probably complain in our assembly routine, unless we
137
+ zero out this memory. */
138
+
139
+ ((long long*)argp)[0] = 0;
140
+ ((long long*)argp)[1] = 0;
141
+ ((long long*)argp)[2] = 0;
142
+ ((long long*)argp)[3] = 0;
143
+ ((long long*)argp)[4] = 0;
144
+ ((long long*)argp)[5] = 0;
145
+ #endif
146
+
147
+ p_argv = ecif->avalue;
148
+
149
+ if (ecif->cif->rtype->type == FFI_TYPE_STRUCT &&
150
+ ecif->cif->rtype->size > 32)
151
+ {
152
+ *(unsigned long long *) argp = (unsigned long)ecif->rvalue;
153
+ argp += sizeof(long long);
154
+ tmp = 1;
155
+ }
156
+
157
+ for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs;
158
+ i++, p_arg++)
159
+ {
160
+ size_t z;
161
+
162
+ z = (*p_arg)->size;
163
+ switch ((*p_arg)->type)
164
+ {
165
+ case FFI_TYPE_STRUCT:
166
+ if (z > 16)
167
+ {
168
+ /* For structures larger than 16 bytes we pass reference. */
169
+ *(unsigned long long *) argp = (unsigned long)* p_argv;
170
+ argp += sizeof(long long);
171
+ tmp++;
172
+ p_argv++;
173
+ continue;
174
+ }
175
+ /* FALLTHROUGH */
176
+ case FFI_TYPE_FLOAT:
177
+ case FFI_TYPE_DOUBLE:
178
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
179
+ case FFI_TYPE_LONGDOUBLE:
180
+ #endif
181
+ ret = 1; /* We should promote into FP regs as well as integer. */
182
+ break;
183
+ }
184
+ if (z < sizeof(long long))
185
+ {
186
+ switch ((*p_arg)->type)
187
+ {
188
+ case FFI_TYPE_SINT8:
189
+ *(signed long long *) argp = *(SINT8 *)(* p_argv);
190
+ break;
191
+
192
+ case FFI_TYPE_UINT8:
193
+ *(unsigned long long *) argp = *(UINT8 *)(* p_argv);
194
+ break;
195
+
196
+ case FFI_TYPE_SINT16:
197
+ *(signed long long *) argp = *(SINT16 *)(* p_argv);
198
+ break;
199
+
200
+ case FFI_TYPE_UINT16:
201
+ *(unsigned long long *) argp = *(UINT16 *)(* p_argv);
202
+ break;
203
+
204
+ case FFI_TYPE_SINT32:
205
+ *(signed long long *) argp = *(SINT32 *)(* p_argv);
206
+ break;
207
+
208
+ case FFI_TYPE_UINT32:
209
+ *(unsigned long long *) argp = *(UINT32 *)(* p_argv);
210
+ break;
211
+
212
+ case FFI_TYPE_FLOAT:
213
+ *(float *) (argp + 4) = *(FLOAT32 *)(* p_argv); /* Right justify */
214
+ break;
215
+
216
+ case FFI_TYPE_STRUCT:
217
+ memcpy(argp, *p_argv, z);
218
+ break;
219
+
220
+ default:
221
+ FFI_ASSERT(0);
222
+ }
223
+ z = sizeof(long long);
224
+ tmp++;
225
+ }
226
+ else if (z == sizeof(long long))
227
+ {
228
+ memcpy(argp, *p_argv, z);
229
+ z = sizeof(long long);
230
+ tmp++;
231
+ }
232
+ else
233
+ {
234
+ if ((tmp & 1) && (*p_arg)->alignment > 8)
235
+ {
236
+ tmp++;
237
+ argp += sizeof(long long);
238
+ }
239
+ memcpy(argp, *p_argv, z);
240
+ z = 2 * sizeof(long long);
241
+ tmp += 2;
242
+ }
243
+ p_argv++;
244
+ argp += z;
245
+ }
246
+
247
+ return ret;
248
+ }
249
+
250
+ /* Perform machine dependent cif processing */
251
+ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
252
+ {
253
+ int wordsize;
254
+
255
+ if (cif->abi != FFI_V9)
256
+ {
257
+ wordsize = 4;
258
+
259
+ /* If we are returning a struct, this will already have been added.
260
+ Otherwise we need to add it because it's always got to be there! */
261
+
262
+ if (cif->rtype->type != FFI_TYPE_STRUCT)
263
+ cif->bytes += wordsize;
264
+
265
+ /* sparc call frames require that space is allocated for 6 args,
266
+ even if they aren't used. Make that space if necessary. */
267
+
268
+ if (cif->bytes < 4*6+4)
269
+ cif->bytes = 4*6+4;
270
+ }
271
+ else
272
+ {
273
+ wordsize = 8;
274
+
275
+ /* sparc call frames require that space is allocated for 6 args,
276
+ even if they aren't used. Make that space if necessary. */
277
+
278
+ if (cif->bytes < 8*6)
279
+ cif->bytes = 8*6;
280
+ }
281
+
282
+ /* Adjust cif->bytes. to include 16 words for the window save area,
283
+ and maybe the struct/union return pointer area, */
284
+
285
+ cif->bytes += 16 * wordsize;
286
+
287
+ /* The stack must be 2 word aligned, so round bytes up
288
+ appropriately. */
289
+
290
+ cif->bytes = ALIGN(cif->bytes, 2 * wordsize);
291
+
292
+ /* Set the return type flag */
293
+ switch (cif->rtype->type)
294
+ {
295
+ case FFI_TYPE_VOID:
296
+ case FFI_TYPE_FLOAT:
297
+ case FFI_TYPE_DOUBLE:
298
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
299
+ case FFI_TYPE_LONGDOUBLE:
300
+ #endif
301
+ cif->flags = cif->rtype->type;
302
+ break;
303
+
304
+ case FFI_TYPE_STRUCT:
305
+ if (cif->abi == FFI_V9 && cif->rtype->size > 32)
306
+ cif->flags = FFI_TYPE_VOID;
307
+ else
308
+ cif->flags = FFI_TYPE_STRUCT;
309
+ break;
310
+
311
+ case FFI_TYPE_SINT64:
312
+ case FFI_TYPE_UINT64:
313
+ if (cif->abi != FFI_V9)
314
+ {
315
+ cif->flags = FFI_TYPE_SINT64;
316
+ break;
317
+ }
318
+ /* FALLTHROUGH */
319
+ default:
320
+ cif->flags = FFI_TYPE_INT;
321
+ break;
322
+ }
323
+ return FFI_OK;
324
+ }
325
+
326
+ int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *flt)
327
+ {
328
+ ffi_type **ptr = &arg->elements[0];
329
+
330
+ while (*ptr != NULL)
331
+ {
332
+ if (off & ((*ptr)->alignment - 1))
333
+ off = ALIGN(off, (*ptr)->alignment);
334
+
335
+ switch ((*ptr)->type)
336
+ {
337
+ case FFI_TYPE_STRUCT:
338
+ off = ffi_v9_layout_struct(*ptr, off, ret, intg, flt);
339
+ off = ALIGN(off, FFI_SIZEOF_ARG);
340
+ break;
341
+ case FFI_TYPE_FLOAT:
342
+ case FFI_TYPE_DOUBLE:
343
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
344
+ case FFI_TYPE_LONGDOUBLE:
345
+ #endif
346
+ memmove(ret + off, flt + off, (*ptr)->size);
347
+ off += (*ptr)->size;
348
+ break;
349
+ default:
350
+ memmove(ret + off, intg + off, (*ptr)->size);
351
+ off += (*ptr)->size;
352
+ break;
353
+ }
354
+ ptr++;
355
+ }
356
+ return off;
357
+ }
358
+
359
+
360
+ #ifdef SPARC64
361
+ extern int ffi_call_v9(void *, extended_cif *, unsigned,
362
+ unsigned, unsigned *, void (*fn)(void));
363
+ #else
364
+ extern int ffi_call_v8(void *, extended_cif *, unsigned,
365
+ unsigned, unsigned *, void (*fn)(void));
366
+ #endif
367
+
368
+ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
369
+ {
370
+ extended_cif ecif;
371
+ void *rval = rvalue;
372
+
373
+ ecif.cif = cif;
374
+ ecif.avalue = avalue;
375
+
376
+ /* If the return value is a struct and we don't have a return */
377
+ /* value address then we need to make one */
378
+
379
+ ecif.rvalue = rvalue;
380
+ if (cif->rtype->type == FFI_TYPE_STRUCT)
381
+ {
382
+ if (cif->rtype->size <= 32)
383
+ rval = alloca(64);
384
+ else
385
+ {
386
+ rval = NULL;
387
+ if (rvalue == NULL)
388
+ ecif.rvalue = alloca(cif->rtype->size);
389
+ }
390
+ }
391
+
392
+ switch (cif->abi)
393
+ {
394
+ case FFI_V8:
395
+ #ifdef SPARC64
396
+ /* We don't yet support calling 32bit code from 64bit */
397
+ FFI_ASSERT(0);
398
+ #else
399
+ ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes,
400
+ cif->flags, rvalue, fn);
401
+ #endif
402
+ break;
403
+ case FFI_V9:
404
+ #ifdef SPARC64
405
+ ffi_call_v9(ffi_prep_args_v9, &ecif, cif->bytes,
406
+ cif->flags, rval, fn);
407
+ if (rvalue && rval && cif->rtype->type == FFI_TYPE_STRUCT)
408
+ ffi_v9_layout_struct(cif->rtype, 0, (char *)rvalue, (char *)rval, ((char *)rval)+32);
409
+ #else
410
+ /* And vice versa */
411
+ FFI_ASSERT(0);
412
+ #endif
413
+ break;
414
+ default:
415
+ FFI_ASSERT(0);
416
+ break;
417
+ }
418
+
419
+ }
420
+
421
+
422
+ #ifdef SPARC64
423
+ extern void ffi_closure_v9(void);
424
+ #else
425
+ extern void ffi_closure_v8(void);
426
+ #endif
427
+
428
+ ffi_status
429
+ ffi_prep_closure_loc (ffi_closure* closure,
430
+ ffi_cif* cif,
431
+ void (*fun)(ffi_cif*, void*, void**, void*),
432
+ void *user_data,
433
+ void *codeloc)
434
+ {
435
+ unsigned int *tramp = (unsigned int *) &closure->tramp[0];
436
+ unsigned long fn;
437
+ #ifdef SPARC64
438
+ /* Trampoline address is equal to the closure address. We take advantage
439
+ of that to reduce the trampoline size by 8 bytes. */
440
+ FFI_ASSERT (cif->abi == FFI_V9);
441
+ fn = (unsigned long) ffi_closure_v9;
442
+ tramp[0] = 0x83414000; /* rd %pc, %g1 */
443
+ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */
444
+ tramp[2] = 0x81c14000; /* jmp %g5 */
445
+ tramp[3] = 0x01000000; /* nop */
446
+ *((unsigned long *) &tramp[4]) = fn;
447
+ #else
448
+ unsigned long ctx = (unsigned long) codeloc;
449
+ FFI_ASSERT (cif->abi == FFI_V8);
450
+ fn = (unsigned long) ffi_closure_v8;
451
+ tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */
452
+ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */
453
+ tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */
454
+ tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */
455
+ #endif
456
+
457
+ closure->cif = cif;
458
+ closure->fun = fun;
459
+ closure->user_data = user_data;
460
+
461
+ /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */
462
+ #ifdef SPARC64
463
+ asm volatile ("flush %0" : : "r" (closure) : "memory");
464
+ asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory");
465
+ #else
466
+ asm volatile ("iflush %0" : : "r" (closure) : "memory");
467
+ asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory");
468
+ #endif
469
+
470
+ return FFI_OK;
471
+ }
472
+
473
+ int
474
+ ffi_closure_sparc_inner_v8(ffi_closure *closure,
475
+ void *rvalue, unsigned long *gpr, unsigned long *scratch)
476
+ {
477
+ ffi_cif *cif;
478
+ ffi_type **arg_types;
479
+ void **avalue;
480
+ int i, argn;
481
+
482
+ cif = closure->cif;
483
+ arg_types = cif->arg_types;
484
+ avalue = alloca(cif->nargs * sizeof(void *));
485
+
486
+ /* Copy the caller's structure return address so that the closure
487
+ returns the data directly to the caller. */
488
+ if (cif->flags == FFI_TYPE_STRUCT
489
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
490
+ || cif->flags == FFI_TYPE_LONGDOUBLE
491
+ #endif
492
+ )
493
+ rvalue = (void *) gpr[0];
494
+
495
+ /* Always skip the structure return address. */
496
+ argn = 1;
497
+
498
+ /* Grab the addresses of the arguments from the stack frame. */
499
+ for (i = 0; i < cif->nargs; i++)
500
+ {
501
+ if (arg_types[i]->type == FFI_TYPE_STRUCT
502
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
503
+ || arg_types[i]->type == FFI_TYPE_LONGDOUBLE
504
+ #endif
505
+ )
506
+ {
507
+ /* Straight copy of invisible reference. */
508
+ avalue[i] = (void *)gpr[argn++];
509
+ }
510
+ else if ((arg_types[i]->type == FFI_TYPE_DOUBLE
511
+ || arg_types[i]->type == FFI_TYPE_SINT64
512
+ || arg_types[i]->type == FFI_TYPE_UINT64)
513
+ /* gpr is 8-byte aligned. */
514
+ && (argn % 2) != 0)
515
+ {
516
+ /* Align on a 8-byte boundary. */
517
+ scratch[0] = gpr[argn];
518
+ scratch[1] = gpr[argn+1];
519
+ avalue[i] = scratch;
520
+ scratch -= 2;
521
+ argn += 2;
522
+ }
523
+ else
524
+ {
525
+ /* Always right-justify. */
526
+ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
527
+ avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size;
528
+ }
529
+ }
530
+
531
+ /* Invoke the closure. */
532
+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
533
+
534
+ /* Tell ffi_closure_sparc how to perform return type promotions. */
535
+ return cif->rtype->type;
536
+ }
537
+
538
+ int
539
+ ffi_closure_sparc_inner_v9(ffi_closure *closure,
540
+ void *rvalue, unsigned long *gpr, double *fpr)
541
+ {
542
+ ffi_cif *cif;
543
+ ffi_type **arg_types;
544
+ void **avalue;
545
+ int i, argn, fp_slot_max;
546
+
547
+ cif = closure->cif;
548
+ arg_types = cif->arg_types;
549
+ avalue = alloca(cif->nargs * sizeof(void *));
550
+
551
+ /* Copy the caller's structure return address so that the closure
552
+ returns the data directly to the caller. */
553
+ if (cif->flags == FFI_TYPE_VOID
554
+ && cif->rtype->type == FFI_TYPE_STRUCT)
555
+ {
556
+ rvalue = (void *) gpr[0];
557
+ /* Skip the structure return address. */
558
+ argn = 1;
559
+ }
560
+ else
561
+ argn = 0;
562
+
563
+ fp_slot_max = 16 - argn;
564
+
565
+ /* Grab the addresses of the arguments from the stack frame. */
566
+ for (i = 0; i < cif->nargs; i++)
567
+ {
568
+ if (arg_types[i]->type == FFI_TYPE_STRUCT)
569
+ {
570
+ if (arg_types[i]->size > 16)
571
+ {
572
+ /* Straight copy of invisible reference. */
573
+ avalue[i] = (void *)gpr[argn++];
574
+ }
575
+ else
576
+ {
577
+ /* Left-justify. */
578
+ ffi_v9_layout_struct(arg_types[i],
579
+ 0,
580
+ (char *) &gpr[argn],
581
+ (char *) &gpr[argn],
582
+ (char *) &fpr[argn]);
583
+ avalue[i] = &gpr[argn];
584
+ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
585
+ }
586
+ }
587
+ else
588
+ {
589
+ /* Right-justify. */
590
+ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
591
+
592
+ if (i < fp_slot_max
593
+ && (arg_types[i]->type == FFI_TYPE_FLOAT
594
+ || arg_types[i]->type == FFI_TYPE_DOUBLE
595
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
596
+ || arg_types[i]->type == FFI_TYPE_LONGDOUBLE
597
+ #endif
598
+ ))
599
+ avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size;
600
+ else
601
+ avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size;
602
+ }
603
+ }
604
+
605
+ /* Invoke the closure. */
606
+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
607
+
608
+ /* Tell ffi_closure_sparc how to perform return type promotions. */
609
+ return cif->rtype->type;
610
+ }