diff --git a/src/core/stuff.c b/src/core/stuff.c index 87dcf0a0..b41cb7c2 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -9,6 +9,9 @@ bool please_tail_call_err = true; void before_exit(void); +#if DEBUG_VM + void print_vmStack(void); +#endif GLOBAL bool inErr; NORETURN NOINLINE void fatal(char* s) { NOGC_E; @@ -27,7 +30,9 @@ NORETURN NOINLINE void fatal(char* s) { fputs(s, stderr); fflush(stderr); fputc('\n', stderr); fflush(stderr); vm_pstLive(); fflush(stderr); fflush(stdout); - print_vmStack(); fflush(stderr); + #if DEBUG_VM + print_vmStack(); fflush(stderr); + #endif before_exit(); #if DEBUG || USE_VALGRIND __builtin_trap(); diff --git a/src/h.h b/src/h.h index 283fd6bd..936f628e 100644 --- a/src/h.h +++ b/src/h.h @@ -429,7 +429,6 @@ void freeThrown(void); #define VTY(X,T) assert(isVal(X) && TY(X)==(T)) -void print_vmStack(void); #if DEBUG B validate(B x); Value* validateP(Value* x); diff --git a/src/vm.c b/src/vm.c index ae0c9d3e..64dfbb55 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1194,13 +1194,13 @@ static void allocStack(void** curr, void** start, void** end, i32 elSize, i32 co mprotect(*end, ps, PROT_NONE); // idk first way i found to force erroring on overflow #endif } -void print_vmStack() { - #if DEBUG_VM +#if DEBUG_VM + void print_vmStack() { printf("vm stack:"); for (i32 i = 0; i < (bcDepth>>1) + 1; i++) { printf(" %d", vmStack[i]); fflush(stdout); } printf("\n"); fflush(stdout); - #endif -} + } +#endif GLOBAL B oomMessage;