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 | 1d63275961d4fc193f424656c77c8bdf393a54d6 (patch) | |
tree | eee4fad0883ba471f5fc1d030a3e323d7e1130ca | |
parent | 06a91d0371b6c94ad0b9cb9be00401b5a0295bf6 (diff) | |
download | txr-1d63275961d4fc193f424656c77c8bdf393a54d6.tar.gz txr-1d63275961d4fc193f424656c77c8bdf393a54d6.tar.bz2 txr-1d63275961d4fc193f424656c77c8bdf393a54d6.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.
-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; |