summaryrefslogtreecommitdiff
path: root/pit/src/runtime/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'pit/src/runtime/gc.c')
-rw-r--r--pit/src/runtime/gc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/pit/src/runtime/gc.c b/pit/src/runtime/gc.c
index fcb5f89..671202d 100644
--- a/pit/src/runtime/gc.c
+++ b/pit/src/runtime/gc.c
@@ -17,11 +17,9 @@ static pit_value gc_copy_value(pit_runtime *rt, pit_value v) {
pit_ref r = pit_value_as_ref(rt, v);
pit_value_heavy *h = pit_value_ref_deref(rt, r);
i64 new = gc_copy(rt, h);
- pit_annotated_ref *ann = pit_annotation_get(rt, r);
+ pit_annotation *ann = pit_annotation_get(rt, r);
if (ann != NULL) {
- pit_annotated_ref newann = *ann;
- newann.ref = new;
- if (pit_vec_push(pit_annotated_ref)(rt->backtrace, newann) < 0)
+ if (pit_hashtable_insert(pit_ref, pit_annotation)(rt->annotations_backbuffer, new, *ann) < 0)
pit_error(rt, "annotation overflow");
}
return pit_value_ref_new(rt, new);
@@ -34,10 +32,10 @@ void pit_gc(pit_runtime *rt) {
rt->frozen_symtab = 0;
pit_arena *fromspace = rt->heap;
pit_arena *tospace = rt->backbuffer;
- pit_vec(pit_annotated_ref) *fromspace_ann = rt->annotations;
- pit_vec(pit_annotated_ref) *tospace_ann = rt->backtrace;
+ pit_hashtable(pit_ref, pit_annotation) *fromspace_ann = rt->annotations;
+ pit_hashtable(pit_ref, pit_annotation) *tospace_ann = rt->annotations_backbuffer;
pit_arena_reset(tospace);
- pit_vec_reset(pit_annotated_ref)(tospace_ann);
+ pit_hashtable_reset(pit_ref, pit_annotation)(tospace_ann);
/* populate tospace with immediately reachable values */
for (i64 i = 0; i < rt->symtab->next; ++i) {
pit_symtab_entry *ent = pit_vec_get(pit_symtab_entry)(rt->symtab, i);
@@ -95,6 +93,6 @@ void pit_gc(pit_runtime *rt) {
rt->heap = tospace;
rt->backbuffer = fromspace;
rt->annotations = tospace_ann;
- rt->backtrace = fromspace_ann;
- pit_vec_reset(pit_annotated_ref)(rt->backtrace);
+ rt->annotations_backbuffer = fromspace_ann;
+ pit_hashtable_reset(pit_ref, pit_annotation)(rt->annotations_backbuffer);
}