ffi 1.13.1 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +10 -2
  4. data/ext/ffi_c/AbstractMemory.c +25 -26
  5. data/ext/ffi_c/Buffer.c +2 -7
  6. data/ext/ffi_c/Call.c +2 -7
  7. data/ext/ffi_c/ClosurePool.c +64 -11
  8. data/ext/ffi_c/ClosurePool.h +3 -1
  9. data/ext/ffi_c/DynamicLibrary.c +1 -6
  10. data/ext/ffi_c/Function.c +8 -13
  11. data/ext/ffi_c/FunctionInfo.c +2 -6
  12. data/ext/ffi_c/LastError.c +2 -6
  13. data/ext/ffi_c/MemoryPointer.c +2 -7
  14. data/ext/ffi_c/MethodHandle.c +4 -8
  15. data/ext/ffi_c/Platform.c +2 -7
  16. data/ext/ffi_c/Pointer.c +24 -25
  17. data/ext/ffi_c/Struct.c +3 -6
  18. data/ext/ffi_c/StructByValue.c +2 -7
  19. data/ext/ffi_c/StructLayout.c +2 -5
  20. data/ext/ffi_c/Thread.c +0 -5
  21. data/ext/ffi_c/Thread.h +1 -6
  22. data/ext/ffi_c/Type.c +1 -1
  23. data/ext/ffi_c/Variadic.c +2 -7
  24. data/ext/ffi_c/extconf.rb +17 -4
  25. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +1 -1
  26. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +1 -1
  27. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
  28. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +1 -1
  29. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +1 -1
  30. data/ext/ffi_c/libffi/.travis/wine-sim.exp +1 -1
  31. data/ext/ffi_c/libffi/Makefile.am +48 -58
  32. data/ext/ffi_c/libffi/README.md +4 -0
  33. data/ext/ffi_c/libffi/config.guess +552 -331
  34. data/ext/ffi_c/libffi/config.sub +1321 -1306
  35. data/ext/ffi_c/libffi/configure.ac +6 -1
  36. data/ext/ffi_c/libffi/configure.host +32 -20
  37. data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
  38. data/ext/ffi_c/libffi/doc/libffi.texi +997 -0
  39. data/ext/ffi_c/libffi/doc/version.texi +4 -0
  40. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -1
  41. data/ext/ffi_c/libffi/msvcc.sh +11 -11
  42. data/ext/ffi_c/libffi/src/aarch64/ffi.c +45 -35
  43. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +10 -5
  44. data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
  45. data/ext/ffi_c/libffi/src/aarch64/sysv.S +1 -1
  46. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +1 -1
  47. data/ext/ffi_c/libffi/src/arm/ffi.c +22 -0
  48. data/ext/ffi_c/libffi/src/arm/sysv.S +4 -4
  49. data/ext/ffi_c/libffi/src/closures.c +23 -6
  50. data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
  51. data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
  52. data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
  53. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  54. data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
  55. data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
  56. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
  57. data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
  58. data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
  59. data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
  60. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
  61. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +1 -1
  62. data/ext/ffi_c/libffi/src/powerpc/linux64.S +8 -0
  63. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +13 -1
  64. data/ext/ffi_c/libffi/src/prep_cif.c +1 -1
  65. data/ext/ffi_c/libffi/src/x86/ffi.c +8 -2
  66. data/ext/ffi_c/libffi/src/x86/ffi64.c +7 -0
  67. data/ext/ffi_c/libffi/src/x86/ffiw64.c +5 -0
  68. data/ext/ffi_c/libffi/src/x86/sysv.S +2 -2
  69. data/ext/ffi_c/libffi/src/x86/unix64.S +1 -2
  70. data/ext/ffi_c/libffi/src/x86/win64.S +3 -2
  71. data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
  72. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +22 -2
  73. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
  74. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
  75. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +2 -0
  76. data/ffi.gemspec +1 -1
  77. data/lib/ffi.rb +2 -2
  78. data/lib/ffi/abstract_memory.rb +44 -0
  79. data/lib/ffi/ffi.rb +1 -0
  80. data/lib/ffi/library.rb +1 -1
  81. data/lib/ffi/platform.rb +15 -6
  82. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  83. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  84. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  85. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  86. data/lib/ffi/pointer.rb +21 -7
  87. data/lib/ffi/version.rb +1 -1
  88. metadata +15 -11
  89. data/.appveyor.yml +0 -30
  90. data/.github/workflows/ci.yml +0 -64
  91. data/.gitignore +0 -25
  92. data/.gitmodules +0 -4
  93. data/.travis.yml +0 -58
  94. data/.yardopts +0 -5
  95. data/ext/ffi_c/win32/stdbool.h +0 -8
  96. data/ext/ffi_c/win32/stdint.h +0 -201
@@ -1,30 +0,0 @@
1
- install:
2
- - SET PATH=C:\Ruby%RUBYVER%\bin;%PATH%
3
- - SET RAKEOPT=-rdevkit
4
- - ps: |
5
- if ($env:RUBYVER -like "*head*") {
6
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:RUBYVER.exe", "$pwd/ruby-setup.exe")
7
- cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:RUBYVER
8
- }
9
- - ridk version
10
- - gem --version
11
- - gem install bundler --quiet --no-document
12
- - bundle install
13
- # Update to libffi-3.3 since Appveyor version fails on LongDouble specs
14
- - ridk exec pacman --sync --refresh --needed --noconfirm mingw-w64-x86_64-libffi mingw-w64-i686-libffi
15
- build: off
16
- build_script:
17
- - bundle exec rake libffi compile -- %EXTCONFOPTS% || bundle exec rake compile -- %EXTCONFOPTS%
18
- test_script:
19
- - bundle exec rake test
20
- - bundle exec rake types_conf && git --no-pager diff
21
- environment:
22
- matrix:
23
- - RUBYVER: "head-x64"
24
- EXTCONFOPTS: "--disable-system-libffi"
25
- - RUBYVER: 24
26
- EXTCONFOPTS: "--disable-system-libffi"
27
- - RUBYVER: 25-x64
28
- EXTCONFOPTS: "--enable-system-libffi"
29
- - RUBYVER: 26
30
- EXTCONFOPTS: "--enable-system-libffi"
@@ -1,64 +0,0 @@
1
- name: CI
2
- on: [push, pull_request]
3
- jobs:
4
- system-libffi:
5
- # Run on latest MRI with explicit selection of system or builtin libffi
6
- strategy:
7
- fail-fast: false
8
- matrix:
9
- os: [ ubuntu, macos, windows ]
10
- extconfopts: [ --disable-system-libffi, --enable-system-libffi ]
11
- runs-on: ${{ matrix.os }}-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- - uses: ruby/setup-ruby@v1
15
- with:
16
- ruby-version: 2.7
17
-
18
- - run: brew install automake libffi pkg-config
19
- if: matrix.os == 'macos'
20
- - run: ridk exec pacman --sync --refresh --needed --noconfirm mingw-w64-x86_64-libffi
21
- if: matrix.os == 'windows' && matrix.extconfopts == '--enable-system-libffi'
22
-
23
- - run: bundle install
24
- - run: bundle exec rake libffi
25
- - run: bundle exec rake compile -- ${{ matrix.extconfopts }}
26
- env:
27
- # work around misconfiguration of libffi on MacOS with homebrew
28
- PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}:/usr/local/opt/libffi/lib/pkgconfig
29
- - run: bundle exec rake test
30
- - run: bundle exec rake types_conf && git --no-pager diff
31
-
32
- specs:
33
- # Run all specs on all ruby implementations
34
- # Use automatic libffi selection on MRI
35
- strategy:
36
- fail-fast: false
37
- matrix:
38
- os: [ ubuntu, macos, windows ]
39
- ruby: [ 2.3, 2.4, 2.5, 2.6, 2.7, ruby-head, truffleruby-head ]
40
- exclude:
41
- - os: windows
42
- ruby: truffleruby-head
43
- - os: windows
44
- ruby: 2.3 # compilation fails
45
- runs-on: ${{ matrix.os }}-latest
46
- steps:
47
- - uses: actions/checkout@v2
48
- - uses: ruby/setup-ruby@v1
49
- with:
50
- ruby-version: ${{ matrix.ruby }}
51
-
52
- - run: brew install automake
53
- if: matrix.os == 'macos'
54
-
55
- - run: bundle install
56
- - run: bundle exec rake libffi
57
- - run: bundle exec rake compile
58
-
59
- - run: bundle exec rake test
60
-
61
- - run: bundle exec rake bench:all
62
- if: matrix.ruby != 'truffleruby-head'
63
- env:
64
- ITER: 10
data/.gitignore DELETED
@@ -1,25 +0,0 @@
1
- doc/
2
- bin/
3
- .yardoc
4
- *.orig
5
- nbproject/private
6
- pkg
7
- *.orig
8
- *.rej
9
- *.patch
10
- *.diff
11
- build
12
- *.so
13
- *.[oa]
14
- core
15
- lib/ffi/types.conf
16
- lib/ffi_c.bundle
17
- lib/ffi_c.so
18
- vendor
19
- .bundle
20
- Gemfile.lock
21
- types_log
22
- *.gem
23
- embed-test.log
24
- spec/ffi/embed-test/ext/Makefile
25
- spec/ffi/embed-test/ext/embed_test.bundle
@@ -1,4 +0,0 @@
1
- [submodule "ext/ffi_c/libffi"]
2
- path = ext/ffi_c/libffi
3
- url = https://github.com/libffi/libffi.git
4
- branch = master
@@ -1,58 +0,0 @@
1
- dist: trusty
2
- group: beta
3
- language: ruby
4
- git:
5
- submodules: false
6
-
7
- script:
8
- - bundle exec rake libffi
9
- - bundle exec rake compile
10
- - bundle exec rake test
11
- - |
12
- if [[ $(ruby -v) != *truffleruby* ]]; then
13
- ITER=10 bundle exec rake bench:all
14
- fi
15
- - bundle exec rake types_conf && git --no-pager diff
16
- os:
17
- - linux
18
- - osx
19
- rvm:
20
- - 2.3.8
21
- - 2.4.6
22
- - 2.5.5
23
- - 2.6.5
24
- - 2.7.0
25
- - ruby-head
26
- - truffleruby-head
27
-
28
- env:
29
- - CC=gcc
30
- - CC=clang
31
- matrix:
32
- allow_failures:
33
- - os: osx
34
- rvm: ruby-head
35
- - os: osx
36
- rvm: 2.3.8
37
- - os: linux
38
- rvm: ruby-head
39
- include:
40
- - name: powerpc
41
- language: generic
42
- before_install: |
43
- docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
44
- docker build --rm -t ffi-powerpc -f spec/env/Dockerfile.powerpc .
45
- script: |
46
- docker run --rm -t -v `pwd`:/ffi ffi-powerpc
47
- - name: armhf
48
- language: generic
49
- before_install: |
50
- docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
51
- docker build --rm -t ffi-armhf -f spec/env/Dockerfile.armhf .
52
- script: |
53
- docker run --rm -t -v `pwd`:/ffi ffi-armhf
54
- exclude:
55
- - os: osx
56
- rvm: truffleruby-head
57
- after_failure:
58
- - "find build -name mkmf.log | xargs cat"
data/.yardopts DELETED
@@ -1,5 +0,0 @@
1
- --title "Ruby FFI"
2
- --charset UTF-8
3
- --private
4
- lib/**/*.rb
5
- ext/**/*.c
@@ -1,8 +0,0 @@
1
- #ifndef FFI_STDBOOL_H
2
- #define FFI_STDBOOL_H
3
-
4
- typedef int bool;
5
- #define true 1
6
- #define false 0
7
-
8
- #endif /* FFI_STDBOOL_H */
@@ -1,201 +0,0 @@
1
- /* stdint.h standard header */
2
- #if !defined(_MSC_VER) && !defined(INT8_MIN)
3
- #pragma once
4
- #ifndef _STDINT
5
- #define _STDINT
6
- #ifndef RC_INVOKED
7
- #include <yvals.h>
8
-
9
- /* NB: assumes
10
- byte has 8 bits
11
- long is 32 bits
12
- pointer can convert to and from long long
13
- long long is longest type
14
- */
15
-
16
- _C_STD_BEGIN
17
- /* TYPE DEFINITIONS */
18
- typedef signed char int8_t;
19
- typedef short int16_t;
20
- typedef int int32_t;
21
-
22
- typedef unsigned char uint8_t;
23
- typedef unsigned short uint16_t;
24
- typedef unsigned int uint32_t;
25
-
26
- typedef signed char int_least8_t;
27
- typedef short int_least16_t;
28
- typedef int int_least32_t;
29
-
30
- typedef unsigned char uint_least8_t;
31
- typedef unsigned short uint_least16_t;
32
- typedef unsigned int uint_least32_t;
33
-
34
- typedef char int_fast8_t;
35
- typedef int int_fast16_t;
36
- typedef int int_fast32_t;
37
-
38
- typedef unsigned char uint_fast8_t;
39
- typedef unsigned int uint_fast16_t;
40
- typedef unsigned int uint_fast32_t;
41
-
42
- #ifndef _INTPTR_T_DEFINED
43
- #define _INTPTR_T_DEFINED
44
- #ifdef _WIN64
45
- typedef __int64 intptr_t;
46
- #else /* _WIN64 */
47
- typedef _W64 int intptr_t;
48
- #endif /* _WIN64 */
49
- #endif /* _INTPTR_T_DEFINED */
50
-
51
- #ifndef _UINTPTR_T_DEFINED
52
- #define _UINTPTR_T_DEFINED
53
- #ifdef _WIN64
54
- typedef unsigned __int64 uintptr_t;
55
- #else /* _WIN64 */
56
- typedef _W64 unsigned int uintptr_t;
57
- #endif /* _WIN64 */
58
- #endif /* _UINTPTR_T_DEFINED */
59
-
60
- typedef _Longlong int64_t;
61
- typedef _ULonglong uint64_t;
62
-
63
- typedef _Longlong int_least64_t;
64
- typedef _ULonglong uint_least64_t;
65
-
66
- typedef _Longlong int_fast64_t;
67
- typedef _ULonglong uint_fast64_t;
68
-
69
- typedef _Longlong intmax_t;
70
- typedef _ULonglong uintmax_t;
71
-
72
- /* LIMIT MACROS */
73
- #define INT8_MIN (-0x7f - _C2)
74
- #define INT16_MIN (-0x7fff - _C2)
75
- #define INT32_MIN (-0x7fffffff - _C2)
76
-
77
- #define INT8_MAX 0x7f
78
- #define INT16_MAX 0x7fff
79
- #define INT32_MAX 0x7fffffff
80
- #define UINT8_MAX 0xff
81
- #define UINT16_MAX 0xffff
82
- #define UINT32_MAX 0xffffffff
83
-
84
- #define INT_LEAST8_MIN (-0x7f - _C2)
85
- #define INT_LEAST16_MIN (-0x7fff - _C2)
86
- #define INT_LEAST32_MIN (-0x7fffffff - _C2)
87
-
88
- #define INT_LEAST8_MAX 0x7f
89
- #define INT_LEAST16_MAX 0x7fff
90
- #define INT_LEAST32_MAX 0x7fffffff
91
- #define UINT_LEAST8_MAX 0xff
92
- #define UINT_LEAST16_MAX 0xffff
93
- #define UINT_LEAST32_MAX 0xffffffff
94
-
95
- #define INT_FAST8_MIN (-0x7f - _C2)
96
- #define INT_FAST16_MIN (-0x7fff - _C2)
97
- #define INT_FAST32_MIN (-0x7fffffff - _C2)
98
-
99
- #define INT_FAST8_MAX 0x7f
100
- #define INT_FAST16_MAX 0x7fff
101
- #define INT_FAST32_MAX 0x7fffffff
102
- #define UINT_FAST8_MAX 0xff
103
- #define UINT_FAST16_MAX 0xffff
104
- #define UINT_FAST32_MAX 0xffffffff
105
-
106
- #if _INTPTR == 0 || _INTPTR == 1
107
- #define INTPTR_MAX 0x7fffffff
108
- #define INTPTR_MIN (-INTPTR_MAX - _C2)
109
- #define UINTPTR_MAX 0xffffffff
110
-
111
- #else /* _INTPTR == 2 */
112
- #define INTPTR_MIN (-_LLONG_MAX - _C2)
113
- #define INTPTR_MAX _LLONG_MAX
114
- #define UINTPTR_MAX _ULLONG_MAX
115
- #endif /* _INTPTR */
116
-
117
- #define INT8_C(x) (x)
118
- #define INT16_C(x) (x)
119
- #define INT32_C(x) ((x) + (INT32_MAX - INT32_MAX))
120
-
121
- #define UINT8_C(x) (x)
122
- #define UINT16_C(x) (x)
123
- #define UINT32_C(x) ((x) + (UINT32_MAX - UINT32_MAX))
124
-
125
- #ifdef _WIN64
126
- #define PTRDIFF_MIN INT64_MIN
127
- #define PTRDIFF_MAX INT64_MAX
128
- #else /* _WIN64 */
129
- #define PTRDIFF_MIN INT32_MIN
130
- #define PTRDIFF_MAX INT32_MAX
131
- #endif /* _WIN64 */
132
-
133
- #define SIG_ATOMIC_MIN INT32_MIN
134
- #define SIG_ATOMIC_MAX INT32_MAX
135
-
136
- #ifndef SIZE_MAX
137
- #ifdef _WIN64
138
- #define SIZE_MAX UINT64_MAX
139
- #else /* _WIN64 */
140
- #define SIZE_MAX UINT32_MAX
141
- #endif /* _WIN64 */
142
- #endif /* SIZE_MAX */
143
-
144
- #define WCHAR_MIN 0x0000
145
- #define WCHAR_MAX 0xffff
146
-
147
- #define WINT_MIN 0x0000
148
- #define WINT_MAX 0xffff
149
-
150
- #define INT64_MIN (-0x7fffffffffffffff - _C2)
151
- #define INT64_MAX 0x7fffffffffffffff
152
- #define UINT64_MAX 0xffffffffffffffffU
153
-
154
- #define INT_LEAST64_MIN (-0x7fffffffffffffff - _C2)
155
- #define INT_LEAST64_MAX 0x7fffffffffffffff
156
- #define UINT_LEAST64_MAX 0xffffffffffffffffU
157
-
158
- #define INT_FAST64_MIN (-0x7fffffffffffffff - _C2)
159
- #define INT_FAST64_MAX 0x7fffffffffffffff
160
- #define UINT_FAST64_MAX 0xffffffffffffffffU
161
-
162
- #define INTMAX_MIN (-0x7fffffffffffffff - _C2)
163
- #define INTMAX_MAX 0x7fffffffffffffff
164
- #define UINTMAX_MAX 0xffffffffffffffffU
165
-
166
- #define INT64_C(x) ((x) + (INT64_MAX - INT64_MAX))
167
- #define UINT64_C(x) ((x) + (UINT64_MAX - UINT64_MAX))
168
- #define INTMAX_C(x) INT64_C(x)
169
- #define UINTMAX_C(x) UINT64_C(x)
170
- _C_STD_END
171
- #endif /* RC_INVOKED */
172
- #endif /* _STDINT */
173
-
174
- #if defined(_STD_USING)
175
- using _CSTD int8_t; using _CSTD int16_t;
176
- using _CSTD int32_t; using _CSTD int64_t;
177
-
178
- using _CSTD uint8_t; using _CSTD uint16_t;
179
- using _CSTD uint32_t; using _CSTD uint64_t;
180
-
181
- using _CSTD int_least8_t; using _CSTD int_least16_t;
182
- using _CSTD int_least32_t; using _CSTD int_least64_t;
183
- using _CSTD uint_least8_t; using _CSTD uint_least16_t;
184
- using _CSTD uint_least32_t; using _CSTD uint_least64_t;
185
-
186
- using _CSTD intmax_t; using _CSTD uintmax_t;
187
-
188
- using _CSTD uintptr_t;
189
- using _CSTD intptr_t;
190
-
191
- using _CSTD int_fast8_t; using _CSTD int_fast16_t;
192
- using _CSTD int_fast32_t; using _CSTD int_fast64_t;
193
- using _CSTD uint_fast8_t; using _CSTD uint_fast16_t;
194
- using _CSTD uint_fast32_t; using _CSTD uint_fast64_t;
195
- #endif /* defined(_STD_USING) */
196
-
197
- /*
198
- * Copyright (c) 1992-2009 by P.J. Plauger. ALL RIGHTS RESERVED.
199
- * Consult your license regarding permissions and restrictions.
200
- V5.20:0009 */
201
- #endif /* !defined(_MSC_VER) && !defined(INT8_MIN) */