move print_vmStack to DEBUG_VM-only

This commit is contained in:
dzaima 2024-09-16 00:29:44 +03:00
parent 6f7e82e52b
commit 10671c446d
3 changed files with 10 additions and 6 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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;