Commit 570f7ed
authored
Remove borrowed types from FFI; fixed_size_list constructor accepts u32 (#8658)
FFI currently has two types of returned objects: ones are owned (inside
of which
there's an Arc), others are borrowed (because there's no Arc inside).
One example of the latter is a struct field name which returns a
borrowed
vx_string. We initially had a comment
caller shouldn't call the corresponding _free() function on these. This
is not
enough as caller can call a _clone() function on a borrowed vx_string
which is
UB because we try to increment a strong reference count on a pointer
which isn't
an Arc. From a callee's perspective, we can't distinguish owned and
borrowed
types, and this creates weird APIs like struct field dtype being owned
but name
being borrowed.
This PR removes all borrowed/owned distinction from FFI layer. Each
object now
returned from an FFI function is owned. It can be freely cloned, and
each must
be freed explicitly with _free() functions.
On another change, fixed size list constructor previously accepted a
size_t
(64-bit unsigned integer on most systems) but validated it against u32
because
that's our file format limitation for fixed size lists. This PR changes
the
signature so that now it accepts uint32_t as length parameter.
As the changes are significant enough to trigger bugs in our own tests,
this PR also re-enables FFI sanitizer tests in CI.
Signed-off-by: Mikhail Kot <mikhail@spiraldb.com>1 parent 86c250a commit 570f7ed
20 files changed
Lines changed: 224 additions & 305 deletions
File tree
- .github/workflows
- vortex-ffi
- cinclude
- examples
- src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | 220 | | |
224 | 221 | | |
225 | 222 | | |
| |||
241 | 238 | | |
242 | 239 | | |
243 | 240 | | |
244 | | - | |
245 | | - | |
| 241 | + | |
246 | 242 | | |
247 | 243 | | |
248 | 244 | | |
| |||
251 | 247 | | |
252 | 248 | | |
253 | 249 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
259 | 255 | | |
260 | 256 | | |
261 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
0 commit comments