summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 4247c813..efc135e0 100644
--- a/gc.c
+++ b/gc.c
@@ -32,6 +32,7 @@
#include <dirent.h>
#include "lib.h"
#include "stream.h"
+#include "hash.h"
#include "txr.h"
#include "gc.h"
@@ -350,8 +351,11 @@ void gc(void)
if (gc_enabled) {
jmp_buf jmp;
setjmp(jmp);
+ gc_enabled = 0;
mark();
+ hash_process_weak();
sweep();
+ gc_enabled = 1;
}
}
@@ -372,6 +376,18 @@ void gc_mark(obj_t *obj)
mark_obj(obj);
}
+int gc_is_reachable(obj_t *obj)
+{
+ type_t t;
+
+ if (obj == nil)
+ return 1;
+
+ t = obj->t.type;
+
+ return (t & REACHABLE) != 0;
+}
+
/*
* Useful functions for gdb'ing.
*/