diff options
| author | LLLL Colonq <llll@colonq> | 2026-09-02 21:13:24 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-09-02 21:13:24 -0400 |
| commit | c01f847b68a7fcd48eb0f3d456aa993a6f69ea8d (patch) | |
| tree | 9da9636f6f390950f052c14b64f833ac1819d5cc /pit/src/runtime/eval.c | |
| parent | a107593b6b362fb68e409c9d7b79427776d137d7 (diff) | |
Diffstat (limited to 'pit/src/runtime/eval.c')
| -rw-r--r-- | pit/src/runtime/eval.c | 5 |
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 */ } } |
