cleanup
This commit is contained in:
parent
776b0b2b47
commit
1bd9467a2d
@ -91,7 +91,7 @@ B repr_c1(B t, B x) {
|
|||||||
if (isF64(x)) {
|
if (isF64(x)) {
|
||||||
#if NO_RYU
|
#if NO_RYU
|
||||||
NUM_FMT_BUF(buf, x.f);
|
NUM_FMT_BUF(buf, x.f);
|
||||||
return utf8Decode(buf, strlen(buf));
|
return utf8Decode0(buf);
|
||||||
#else
|
#else
|
||||||
return ryu_d2s(o2fG(x));
|
return ryu_d2s(o2fG(x));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -49,15 +49,15 @@ void mm_forFreedHeap(V2v f);
|
|||||||
void heap_printInfo(bool sizes, bool types, bool freed, bool chain) {
|
void heap_printInfo(bool sizes, bool types, bool freed, bool chain) {
|
||||||
u64 total = mm_heapAlloc;
|
u64 total = mm_heapAlloc;
|
||||||
u64 used = mm_heapUsed();
|
u64 used = mm_heapUsed();
|
||||||
printf("RAM allocated: "N64u"\n", total);
|
fprintf(stderr, "RAM allocated: "N64u"\n", total);
|
||||||
printf("heap in use: "N64u"\n", used);
|
fprintf(stderr, "heap in use: "N64u"\n", used);
|
||||||
#if MM!=0
|
#if MM!=0
|
||||||
if (sizes) {
|
if (sizes) {
|
||||||
for (i32 i = 2; i < 64; i++) {
|
for (i32 i = 2; i < 64; i++) {
|
||||||
for (i32 j = 0; j < MM; j++) {
|
for (i32 j = 0; j < MM; j++) {
|
||||||
i32 o = i-j;
|
i32 o = i-j;
|
||||||
u64 count = mm_ctrs[o + j*64];
|
u64 count = mm_ctrs[o + j*64];
|
||||||
if (count>0) printf("size %llu: "N64u"\n", (1ULL<<o)*(j?3:1), count);
|
if (count>0) fprintf(stderr, "size %llu: "N64u"\n", (1ULL<<o)*(j?3:1), count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ void heap_printInfo(bool sizes, bool types, bool freed, bool chain) {
|
|||||||
mm_forHeap(heap_PIFn);
|
mm_forHeap(heap_PIFn);
|
||||||
for (i32 i = 0; i < t_COUNT; i++) {
|
for (i32 i = 0; i < t_COUNT; i++) {
|
||||||
u64 count = heap_PICounts[i];
|
u64 count = heap_PICounts[i];
|
||||||
if (count>0) printf("type %d/%s: count "N64u", total size "N64u"\n", i, type_repr(i), count, heap_PISizes[i]);
|
if (count>0) fprintf(stderr, "type %d/%s: count "N64u", total size "N64u"\n", i, type_repr(i), count, heap_PISizes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (freed || chain) {
|
if (freed || chain) {
|
||||||
@ -91,11 +91,12 @@ void heap_printInfo(bool sizes, bool types, bool freed, bool chain) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cf!=0 || cc!=0) {
|
if (cf!=0 || cc!=0) {
|
||||||
if (chain && freed) printf("freed size %llu: count "N64u", chain "N64u"\n", (1ULL<<o)*(j?3:1), cf, cc);
|
if (chain && freed) fprintf(stderr, "freed size %llu: count "N64u", chain "N64u"\n", (1ULL<<o)*(j?3:1), cf, cc);
|
||||||
else printf("freed size %llu: "N64u"\n", (1ULL<<o)*(j?3:1), freed? cf : cc);
|
else fprintf(stderr, "freed size %llu: "N64u"\n", (1ULL<<o)*(j?3:1), freed? cf : cc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -796,7 +796,7 @@ bool cbqn_initialized;
|
|||||||
void cbqn_init() {
|
void cbqn_init() {
|
||||||
if (cbqn_initialized) return;
|
if (cbqn_initialized) return;
|
||||||
#define F(X) X##_init();
|
#define F(X) X##_init();
|
||||||
FOR_INIT(F)
|
FOR_INIT(F)
|
||||||
#undef F
|
#undef F
|
||||||
cbqn_initialized = true;
|
cbqn_initialized = true;
|
||||||
gc_enable();
|
gc_enable();
|
||||||
|
|||||||
@ -439,7 +439,7 @@ static B m_getU_B (void* a, usz ms) { return ((B*) a)[ms]; }
|
|||||||
|
|
||||||
void apd_fail_apd(ApdMut* m, B x) { }
|
void apd_fail_apd(ApdMut* m, B x) { }
|
||||||
NOINLINE char* apd_ty_base(u32 ty) {
|
NOINLINE char* apd_ty_base(u32 ty) {
|
||||||
return ty==1? ">" : ty==2? "[...]" : ty==U'˘'? "˘" : ty==U'⎉'? "⎉" : "??";
|
return ty==1? ">" : ty==2? "[…]" : ty==U'˘'? "˘" : ty==U'⎉'? "⎉" : "??";
|
||||||
}
|
}
|
||||||
Arr* apd_sh_err(ApdMut* m, u32 ty) {
|
Arr* apd_sh_err(ApdMut* m, u32 ty) {
|
||||||
B msg = make_fmt("%U: Incompatible %S shapes (encountered shapes %2H and %H)", apd_ty_base(ty), ty>2? "result" : "element", m->cr, m->csh, m->failEl);
|
B msg = make_fmt("%U: Incompatible %S shapes (encountered shapes %2H and %H)", apd_ty_base(ty), ty>2? "result" : "element", m->cr, m->csh, m->failEl);
|
||||||
|
|||||||
4
src/vm.c
4
src/vm.c
@ -1296,7 +1296,7 @@ CatchFrame* cfStart;
|
|||||||
CatchFrame* cfEnd;
|
CatchFrame* cfEnd;
|
||||||
|
|
||||||
#if CATCH_ERRORS
|
#if CATCH_ERRORS
|
||||||
jmp_buf* prepareCatch() { // in the case of returning false, must call popCatch();
|
jmp_buf* prepareCatch() {
|
||||||
if (cf==cfEnd) {
|
if (cf==cfEnd) {
|
||||||
u64 n = cfEnd-cfStart;
|
u64 n = cfEnd-cfStart;
|
||||||
n = n<8? 8 : n*2;
|
n = n<8? 8 : n*2;
|
||||||
@ -1727,7 +1727,7 @@ NOINLINE void freeThrown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NOINLINE NORETURN void thrM(char* s) {
|
NOINLINE NORETURN void thrM(char* s) {
|
||||||
thr(utf8Decode(s, strlen(s)));
|
thr(utf8Decode0(s));
|
||||||
}
|
}
|
||||||
NOINLINE NORETURN void thrOOM() {
|
NOINLINE NORETURN void thrOOM() {
|
||||||
if (oomMessage.u==0) err("out-of-memory encountered before out-of-memory error message object was initialized");
|
if (oomMessage.u==0) err("out-of-memory encountered before out-of-memory error message object was initialized");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user