diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-07-28 15:29:10 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-07-28 15:29:10 -0700 |
commit | f9f357f060b6c084c720b67226af3ad6f4cbfff7 (patch) | |
tree | 2991719e117846dc19917927926a4fd179fabe72 /ffi.c | |
parent | cfe0428c0d96813685b19a191a3bd20336c20001 (diff) | |
download | txr-f9f357f060b6c084c720b67226af3ad6f4cbfff7.tar.gz txr-f9f357f060b6c084c720b67226af3ad6f4cbfff7.tar.bz2 txr-f9f357f060b6c084c720b67226af3ad6f4cbfff7.zip |
FFI: bugfix: GC-correctness of assignments.
Recent work has introduced wrong-way assignments. When we
compile the slots after we have created the type object, the
slot types may be in a newer generation than the type object.
If we are reusing an old type object, it can be older than
the syntax, or the Lisp object being stored in it.
* ffi.c (make_ffi_type_struct, make_ffi_type_union): add some
setcheck calls to handle anti-generational assignments.
Diffstat (limited to 'ffi.c')
-rw-r--r-- | ffi.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -2882,6 +2882,9 @@ static val make_ffi_type_struct(val syntax, val lisp_type, tft->incomplete = 1; + setcheck(obj, syntax); + setcheck(obj, lisp_type); + sethash(ffi_struct_tag_hash, cadr(syntax), obj); for (i = 0; i < nmemb; i++) { @@ -2897,6 +2900,9 @@ static val make_ffi_type_struct(val syntax, val lisp_type, memb[i].mname = slot; memb[i].mtft = mtft; + setcheck(obj, slot); + setcheck(obj, type); + if (mtft->bitfield) { ucnum size = mtft->size; ucnum bits_type = 8 * size; @@ -3045,6 +3051,8 @@ static val make_ffi_type_union(val syntax, val use_existing, val self) tft->incomplete = 1; + setcheck(obj, syntax); + sethash(ffi_struct_tag_hash, cadr(syntax), obj); for (i = 0; i < nmemb; i++) { @@ -3058,6 +3066,9 @@ static val make_ffi_type_union(val syntax, val use_existing, val self) memb[i].mtft = mtft; memb[i].offs = 0; + setcheck(obj, slot); + setcheck(obj, type); + if (most_align < (ucnum) mtft->align) most_align = mtft->align; |