diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 4882c3ec..d5710050 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -16,7 +16,7 @@ B type_c1(B t, B x) { else if (isMd1(x)) r = 4; else if (isMd2(x)) r = 5; else if (isNsp(x)) r = 6; - if (r==-1) { print(x); err(": getting type"); } + if (RARE(r==-1)) { print(x); err(": getting type"); } decR(x); return m_i32(r); } diff --git a/src/core/stuff.c b/src/core/stuff.c index eae49945..f6a32bda 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -6,8 +6,12 @@ NORETURN NOINLINE void err(char* s) { puts(s); fflush(stdout); - print_vmStack(); - __builtin_trap(); + vm_pstLive(); fflush(stdout); + print_vmStack(); fflush(stdout); + puts("CBQN interpreter entered unexpected state, exiting."); + #ifdef DEBUG + __builtin_trap(); + #endif exit(1); } diff --git a/src/core/stuff.h b/src/core/stuff.h index b376493b..255cf5f5 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -8,6 +8,7 @@ static void mm_visitP(void* x); NORETURN void bqn_exit(i32 code); u64 mm_heapUsed(); void printAllocStats(); +void vm_pstLive(); #ifndef MAP_NORESERVE diff --git a/src/opt/single.c b/src/opt/single.c index 8621ad24..aab417bf 100644 --- a/src/opt/single.c +++ b/src/opt/single.c @@ -11,6 +11,7 @@ #include "../utils/hash.c" #include "../utils/utf.c" #include "../utils/file.c" +#include "../utils/mut.c" #include "../builtins/fns.c" #include "../builtins/sfns.c" #include "../builtins/sysfn.c"