diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-29 12:37:09 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-29 12:37:09 -0500 |
| commit | ec75208980f29628604aed45a4f64cfa3c62e0df (patch) | |
| tree | b1cf929cb2735f8ad258c60317410e111ad58462 /builtins/table.c | |
| parent | a7bbbe9584f6e4cd35c9a78e8f83b458ddd8f914 (diff) | |
Fix up some import issues and improve arrays to use saturating refcounts
instead of .copy_on_write
Diffstat (limited to 'builtins/table.c')
| -rw-r--r-- | builtins/table.c | 10 |
1 files changed, 5 insertions, 5 deletions
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 |
