diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-06-19 06:41:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-06-19 06:41:04 -0700 |
commit | ee639342a87cbb1db085f58f5f57cb2085832173 (patch) | |
tree | eee4fad0883ba471f5fc1d030a3e323d7e1130ca /struct.c | |
parent | 5b0d68a85dd9e9dca020ac4bfbbcf72cf8347a2b (diff) | |
download | txr-ee639342a87cbb1db085f58f5f57cb2085832173.tar.gz txr-ee639342a87cbb1db085f58f5f57cb2085832173.tar.bz2 txr-ee639342a87cbb1db085f58f5f57cb2085832173.zip |
make-struct-type: fix far-fetched gc/stability issue.
* struct.c (make_struct_type): The length and plus operations
can cons if the number of static slots doesn't fit into a
fixnum. Let's move that operation out of the sensitive object
construction region.
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -309,11 +309,11 @@ val make_struct_type(val name, val super, val id = num_fast(coerce(ucnum, st) / (uptopow2(sizeof *st) / 2)); val super_slots = if2(su, su->slots); val all_slots = uniq(append2(super_slots, append2(static_slots, slots))); + cnum stsl_upb = c_num(plus(length(static_slots), + num(if3(su, su->nstslots, 0)))); val stype = cobj(coerce(mem_t *, st), struct_type_s, &struct_type_ops); val iter; cnum sl, stsl; - cnum stsl_upb = c_num(plus(length(static_slots), - num(if3(su, su->nstslots, 0)))); struct stslot null_ptr = { nil, 0, 0, nil }; st->self = stype; |