aboutsummaryrefslogtreecommitdiff
path: root/builtins/table.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtins/table.c')
-rw-r--r--builtins/table.c10
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