summaryrefslogtreecommitdiff
path: root/pit/src/runtime/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'pit/src/runtime/eval.c')
-rw-r--r--pit/src/runtime/eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pit/src/runtime/eval.c b/pit/src/runtime/eval.c
index b0b53b6..a2b9e79 100644
--- a/pit/src/runtime/eval.c
+++ b/pit/src/runtime/eval.c
@@ -180,8 +180,11 @@ bool pit_vm_run_one(pit_runtime *rt) {
pit_value pit_vm_eval(pit_runtime *rt, pit_value v) {
i64 start = rt->callstack->next;
vm_push_code(rt, v);
+ i64 gc = 0;
while (pit_vm_run_one(rt) && rt->callstack->next > start) {
- if (rt->expr_stack->next == 0 && rt->compilation_stack->next == 0) {
+ gc += 1;
+ if (gc > 100 && rt->expr_stack->next == 0 && rt->compilation_stack->next == 0) {
+ gc = 0;
pit_gc(rt); /* TODO hack to avoid running GC during macroexpansion */
}
}