This commit is contained in:
dzaima 2023-05-04 12:24:27 +03:00
parent 776b0b2b47
commit 1bd9467a2d
5 changed files with 12 additions and 11 deletions

View File

@ -91,7 +91,7 @@ B repr_c1(B t, B x) {
if (isF64(x)) {
#if NO_RYU
NUM_FMT_BUF(buf, x.f);
return utf8Decode(buf, strlen(buf));
return utf8Decode0(buf);
#else
return ryu_d2s(o2fG(x));
#endif

View File

@ -49,15 +49,15 @@ void mm_forFreedHeap(V2v f);
void heap_printInfo(bool sizes, bool types, bool freed, bool chain) {
u64 total = mm_heapAlloc;
u64 used = mm_heapUsed();
printf("RAM allocated: "N64u"\n", total);
printf("heap in use: "N64u"\n", used);
fprintf(stderr, "RAM allocated: "N64u"\n", total);
fprintf(stderr, "heap in use: "N64u"\n", used);
#if MM!=0
if (sizes) {
for (i32 i = 2; i < 64; i++) {
for (i32 j = 0; j < MM; j++) {
i32 o = i-j;
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);
for (i32 i = 0; i < t_COUNT; 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) {
@ -91,11 +91,12 @@ void heap_printInfo(bool sizes, bool types, bool freed, bool chain) {
}
}
if (cf!=0 || cc!=0) {
if (chain && freed) printf("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);
if (chain && freed) fprintf(stderr, "freed size %llu: count "N64u", chain "N64u"\n", (1ULL<<o)*(j?3:1), cf, cc);
else fprintf(stderr, "freed size %llu: "N64u"\n", (1ULL<<o)*(j?3:1), freed? cf : cc);
}
}
}
}
#endif
fflush(stderr);
}

View File

@ -796,7 +796,7 @@ bool cbqn_initialized;
void cbqn_init() {
if (cbqn_initialized) return;
#define F(X) X##_init();
FOR_INIT(F)
FOR_INIT(F)
#undef F
cbqn_initialized = true;
gc_enable();

View File

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

View File

@ -1296,7 +1296,7 @@ CatchFrame* cfStart;
CatchFrame* cfEnd;
#if CATCH_ERRORS
jmp_buf* prepareCatch() { // in the case of returning false, must call popCatch();
jmp_buf* prepareCatch() {
if (cf==cfEnd) {
u64 n = cfEnd-cfStart;
n = n<8? 8 : n*2;
@ -1727,7 +1727,7 @@ NOINLINE void freeThrown() {
}
NOINLINE NORETURN void thrM(char* s) {
thr(utf8Decode(s, strlen(s)));
thr(utf8Decode0(s));
}
NOINLINE NORETURN void thrOOM() {
if (oomMessage.u==0) err("out-of-memory encountered before out-of-memory error message object was initialized");