summaryrefslogtreecommitdiffstats
path: root/struct.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-07 21:50:47 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-07 21:50:47 -0700
commit0fdf7390864f8bc619741aff777cb5d2560d9f1c (patch)
treea8fcaecb89af88d0a9b0a298f5df59123fc3ef36 /struct.c
parent2b249216eba72f0ea9700b7eede3711ff45a1327 (diff)
downloadtxr-0fdf7390864f8bc619741aff777cb5d2560d9f1c.tar.gz
txr-0fdf7390864f8bc619741aff777cb5d2560d9f1c.tar.bz2
txr-0fdf7390864f8bc619741aff777cb5d2560d9f1c.zip
gc issues in clear_struct and replace_struct.
* struct.c (clear_struct, reset_struct): Inform the garbage collector that the structure has been mutate, using the mut macro. This is required for correctness because the structure may be a mature object receiving young generation values.
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/struct.c b/struct.c
index f42c685b..f8ed361d 100644
--- a/struct.c
+++ b/struct.c
@@ -599,6 +599,8 @@ val clear_struct(val strct, val value)
for (i = 0; i < st->nslots; i++)
si->slot[i] = clear_val;
+ mut(strct);
+
return strct;
}
@@ -621,6 +623,7 @@ val replace_struct(val target, val source)
free(tsi);
target->co.handle = coerce(mem_t *, ssi_copy);
target->co.cls = source->co.cls;
+ mut(target);
}
return target;