From ec75208980f29628604aed45a4f64cfa3c62e0df Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 29 Feb 2024 12:37:09 -0500 Subject: Fix up some import issues and improve arrays to use saturating refcounts instead of .copy_on_write --- builtins/table.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'builtins/table.c') diff --git a/builtins/table.c b/builtins/table.c index 677def7b..fcb64e40 100644 --- a/builtins/table.c +++ b/builtins/table.c @@ -98,21 +98,21 @@ static inline void hshow(const table_t *t) static void maybe_copy_on_write(table_t *t, const TypeInfo *type) { - if (t->entries.copy_on_write) { + if (t->entries.data_refcount) { Array__compact(&t->entries, ENTRIES_TYPE(type)); } - if (t->bucket_info && t->bucket_info->copy_on_write) { + if (t->bucket_info && t->bucket_info->data_refcount) { int64_t size = sizeof(bucket_info_t) + t->bucket_info->count*sizeof(bucket_t); t->bucket_info = memcpy(GC_MALLOC(size), t->bucket_info, size); - t->bucket_info->copy_on_write = 0; + t->bucket_info->data_refcount = 0; } } public void Table_mark_copy_on_write(table_t *t) { - t->entries.copy_on_write = 1; - if (t->bucket_info) t->bucket_info->copy_on_write = 1; + t->entries.data_refcount = 3; + if (t->bucket_info) t->bucket_info->data_refcount = 3; } // Return address of value or NULL -- cgit v1.2.3