From 6aaaaeb39c8aa5aed520608f8eac956586343a5c Mon Sep 17 00:00:00 2001 From: dzaima Date: Tue, 2 Nov 2021 18:32:25 +0200 Subject: [PATCH] more consistent print method naming scheme --- src/core/gstack.h | 2 +- src/core/stuff.c | 2 +- src/core/stuff.h | 2 +- src/load.c | 5 +++-- src/vm.c | 14 +++++++------- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/core/gstack.h b/src/core/gstack.h index 41bd1a92..eb66cc40 100644 --- a/src/core/gstack.h +++ b/src/core/gstack.h @@ -10,7 +10,7 @@ extern B* gStack; // points to after end extern B* gStackStart; extern B* gStackEnd; -void gsPrint(void); +void print_gStack(void); static void gsReserve(u64 am) { #ifdef GS_REALLOC diff --git a/src/core/stuff.c b/src/core/stuff.c index 8ab4dae3..c6ec72d7 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -685,7 +685,7 @@ B bqn_merge(B x) { #endif #endif -NOINLINE void printAllocStats() { +NOINLINE void print_allocStats() { #ifdef ALLOC_STAT printf("total ever allocated: "N64u"\n", talloc); printf("allocated heap size: "N64u"\n", mm_heapAlloc); diff --git a/src/core/stuff.h b/src/core/stuff.h index 47aac655..3f6f3ad5 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -2,7 +2,7 @@ NORETURN void bqn_exit(i32 code); u64 mm_heapUsed(void); -void printAllocStats(void); +void print_allocStats(void); void vm_pstLive(void); diff --git a/src/load.c b/src/load.c index 3513813f..362bd77a 100644 --- a/src/load.c +++ b/src/load.c @@ -319,6 +319,7 @@ void load_init() { // very last init function B* runtime = fruntime; (void)frtObj; (void)rtComplete; + (void)runtime; #endif @@ -338,7 +339,7 @@ void load_init() { // very last init function #endif rtWrap_print(); CTR_FOR(CTR_PRINT) - printAllocStats(); + print_allocStats(); exit(0); #else // use compiler B prevAsrt = runtime[42]; @@ -374,7 +375,7 @@ B bqn_execFile(B path, B args) { // consumes both void bqn_exit(i32 code) { rtWrap_print(); CTR_FOR(CTR_PRINT) - printAllocStats(); + print_allocStats(); exit(code); } diff --git a/src/vm.c b/src/vm.c index 9083fc9d..d8480235 100644 --- a/src/vm.c +++ b/src/vm.c @@ -29,7 +29,7 @@ char* bc_repr(u32* p) { #undef F } } -void printBC(u32* p, i32 w) { +void print_BC(u32* p, i32 w) { char* str = bc_repr(p); printf("%s", str); u32* n = nextBC(p); @@ -50,9 +50,9 @@ void printBC(u32* p, i32 w) { len = w-len; while(len-->0) putchar(' '); } -void printBCStream(u32* p) { +void print_BCStream(u32* p) { while(true) { - printBC(p, 10); putchar(10); + print_BC(p, 10); putchar(10); if (*p == RETD || *p == RETN) return; p = nextBC(p); } @@ -70,7 +70,7 @@ B* gStack; // points to after end B* gStackStart; B* gStackEnd; NOINLINE void gsReserveR(u64 am) { gsReserve(am); } -void gsPrint() { +void print_gStack() { B* c = gStackStart; i32 i = 0; 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); vmStack[stackNum] = bcPos; 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); bcCtr++; 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 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); #endif } @@ -1101,7 +1101,7 @@ NOINLINE void vm_printPos(Comp* comp, i32 bcPos, i64 pos) { B s = emptyCVec(); printRaw(vm_fmtPoint(src, s, comp->path, cs, ce)); putchar('\n'); - //printBCStream((u32*)i32arr_ptr(comp->bc)+bcPos); + //print_BCStream((u32*)i32arr_ptr(comp->bc)+bcPos); } else { #ifdef DEBUG if (pos!=-1) printf(N64d": ", pos);