error on nested GC
This commit is contained in:
parent
d21a77119f
commit
647a0b97e7
@ -168,8 +168,11 @@ static void gcv2_unmark_visit(Value* x) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLOBAL u64 gc_lastAlloc;
|
GLOBAL u64 gc_lastAlloc;
|
||||||
|
GLOBAL bool gc_running;
|
||||||
void gc_forceGC(bool toplevel) {
|
void gc_forceGC(bool toplevel) {
|
||||||
#if ENABLE_GC
|
#if ENABLE_GC
|
||||||
|
if (gc_running) fatal("starting GC while GC is in the middle of running");
|
||||||
|
gc_running = 1;
|
||||||
u64 startTime=0, startSize=0;
|
u64 startTime=0, startSize=0;
|
||||||
if (gc_log_enabled) {
|
if (gc_log_enabled) {
|
||||||
startTime = nsTime();
|
startTime = nsTime();
|
||||||
@ -193,6 +196,7 @@ void gc_forceGC(bool toplevel) {
|
|||||||
fprintf(stderr, "; took %.3fms\n", (nsTime()-startTime)/1e6);
|
fprintf(stderr, "; took %.3fms\n", (nsTime()-startTime)/1e6);
|
||||||
}
|
}
|
||||||
gc_lastAlloc = endSize;
|
gc_lastAlloc = endSize;
|
||||||
|
gc_running = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
extern GLOBAL u64 gc_depth;
|
extern GLOBAL u64 gc_depth;
|
||||||
|
extern GLOBAL bool gc_running;
|
||||||
static void gc_disable() { gc_depth++; }
|
static void gc_disable() { gc_depth++; }
|
||||||
static void gc_enable() { gc_depth--; }
|
static void gc_enable() { gc_depth--; }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user