more consistent print method naming scheme

This commit is contained in:
dzaima 2021-11-02 18:32:25 +02:00
parent ce36f03f11
commit 6aaaaeb39c
5 changed files with 13 additions and 12 deletions

View File

@ -10,7 +10,7 @@
extern B* gStack; // points to after end extern B* gStack; // points to after end
extern B* gStackStart; extern B* gStackStart;
extern B* gStackEnd; extern B* gStackEnd;
void gsPrint(void); void print_gStack(void);
static void gsReserve(u64 am) { static void gsReserve(u64 am) {
#ifdef GS_REALLOC #ifdef GS_REALLOC

View File

@ -685,7 +685,7 @@ B bqn_merge(B x) {
#endif #endif
#endif #endif
NOINLINE void printAllocStats() { NOINLINE void print_allocStats() {
#ifdef ALLOC_STAT #ifdef ALLOC_STAT
printf("total ever allocated: "N64u"\n", talloc); printf("total ever allocated: "N64u"\n", talloc);
printf("allocated heap size: "N64u"\n", mm_heapAlloc); printf("allocated heap size: "N64u"\n", mm_heapAlloc);

View File

@ -2,7 +2,7 @@
NORETURN void bqn_exit(i32 code); NORETURN void bqn_exit(i32 code);
u64 mm_heapUsed(void); u64 mm_heapUsed(void);
void printAllocStats(void); void print_allocStats(void);
void vm_pstLive(void); void vm_pstLive(void);

View File

@ -319,6 +319,7 @@ void load_init() { // very last init function
B* runtime = fruntime; B* runtime = fruntime;
(void)frtObj; (void)frtObj;
(void)rtComplete; (void)rtComplete;
(void)runtime;
#endif #endif
@ -338,7 +339,7 @@ void load_init() { // very last init function
#endif #endif
rtWrap_print(); rtWrap_print();
CTR_FOR(CTR_PRINT) CTR_FOR(CTR_PRINT)
printAllocStats(); print_allocStats();
exit(0); exit(0);
#else // use compiler #else // use compiler
B prevAsrt = runtime[42]; B prevAsrt = runtime[42];
@ -374,7 +375,7 @@ B bqn_execFile(B path, B args) { // consumes both
void bqn_exit(i32 code) { void bqn_exit(i32 code) {
rtWrap_print(); rtWrap_print();
CTR_FOR(CTR_PRINT) CTR_FOR(CTR_PRINT)
printAllocStats(); print_allocStats();
exit(code); exit(code);
} }

View File

@ -29,7 +29,7 @@ char* bc_repr(u32* p) {
#undef F #undef F
} }
} }
void printBC(u32* p, i32 w) { void print_BC(u32* p, i32 w) {
char* str = bc_repr(p); char* str = bc_repr(p);
printf("%s", str); printf("%s", str);
u32* n = nextBC(p); u32* n = nextBC(p);
@ -50,9 +50,9 @@ void printBC(u32* p, i32 w) {
len = w-len; len = w-len;
while(len-->0) putchar(' '); while(len-->0) putchar(' ');
} }
void printBCStream(u32* p) { void print_BCStream(u32* p) {
while(true) { while(true) {
printBC(p, 10); putchar(10); print_BC(p, 10); putchar(10);
if (*p == RETD || *p == RETN) return; if (*p == RETD || *p == RETN) return;
p = nextBC(p); p = nextBC(p);
} }
@ -70,7 +70,7 @@ B* gStack; // points to after end
B* gStackStart; B* gStackStart;
B* gStackEnd; B* gStackEnd;
NOINLINE void gsReserveR(u64 am) { gsReserve(am); } NOINLINE void gsReserveR(u64 am) { gsReserve(am); }
void gsPrint() { void print_gStack() {
B* c = gStackStart; B* c = gStackStart;
i32 i = 0; i32 i = 0;
printf("gStack %p, height "N64d":\n", gStackStart, gStack-gStackStart); printf("gStack %p, height "N64d":\n", gStackStart, gStack-gStackStart);
@ -568,7 +568,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume
i32 bcPos = BCPOS(b,sbc); i32 bcPos = BCPOS(b,sbc);
vmStack[stackNum] = bcPos; vmStack[stackNum] = bcPos;
for(i32 i = 0; i < bcDepth; i++) printf(" "); for(i32 i = 0; i < bcDepth; i++) printf(" ");
printBC(sbc,20); printf("@%d in: ", bcPos); print_BC(sbc,20); printf("@%d in: ", bcPos);
for (i32 i = 0; i < lgStack-origStack; i++) { if(i)printf("; "); print(origStack[i]); } putchar('\n'); fflush(stdout); for (i32 i = 0; i < lgStack-origStack; i++) { if(i)printf("; "); print(origStack[i]); } putchar('\n'); fflush(stdout);
bcCtr++; bcCtr++;
for (i32 i = 0; i < sc->varAm; i++) VALIDATE(sc->vars[i]); for (i32 i = 0; i < sc->varAm; i++) VALIDATE(sc->vars[i]);
@ -749,7 +749,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume
} }
#ifdef DEBUG_VM #ifdef DEBUG_VM
for(i32 i = 0; i < bcDepth; i++) printf(" "); for(i32 i = 0; i < bcDepth; i++) printf(" ");
printBC(sbc,20); printf("@%d out: ", BCPOS(b, sbc)); print_BC(sbc,20); printf("@%d out: ", BCPOS(b, sbc));
for (i32 i = 0; i < lgStack-origStack; i++) { if(i)printf("; "); print(origStack[i]); } putchar('\n'); fflush(stdout); for (i32 i = 0; i < lgStack-origStack; i++) { if(i)printf("; "); print(origStack[i]); } putchar('\n'); fflush(stdout);
#endif #endif
} }
@ -1101,7 +1101,7 @@ NOINLINE void vm_printPos(Comp* comp, i32 bcPos, i64 pos) {
B s = emptyCVec(); B s = emptyCVec();
printRaw(vm_fmtPoint(src, s, comp->path, cs, ce)); printRaw(vm_fmtPoint(src, s, comp->path, cs, ce));
putchar('\n'); putchar('\n');
//printBCStream((u32*)i32arr_ptr(comp->bc)+bcPos); //print_BCStream((u32*)i32arr_ptr(comp->bc)+bcPos);
} else { } else {
#ifdef DEBUG #ifdef DEBUG
if (pos!=-1) printf(N64d": ", pos); if (pos!=-1) printf(N64d": ", pos);