aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/gc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/src/gc.c b/runtime/src/gc.c
index 97f26ba1..6958a772 100644
--- a/runtime/src/gc.c
+++ b/runtime/src/gc.c
@@ -103,3 +103,15 @@ void shed__runtime__gc_add_perm_root(ShedObject gc_root) {
gc_perm_roots[gc_perm_root_index] = (struct ShedGcObjectHeader*) gc_root;
gc_perm_root_index++;
}
+
+// == Collection ==
+
+void mark_reachable() {
+ for (size_t i = 0; i < gc_perm_root_index; i++) {
+ mark(gc_perm_roots[i]);
+ }
+
+ for (size_t i = 0; i < gc_root_stack_index; i++) {
+ mark(gc_root_stack[i]);
+ }
+}