move OBJ_COUNTER increment

This commit is contained in:
dzaima 2021-07-11 22:14:28 +03:00
parent 48380be063
commit 9982c62526
3 changed files with 5 additions and 10 deletions

View File

@ -31,13 +31,8 @@ static void* mm_alloc(usz sz, u8 type) {
assert(sz>=16);
onAlloc(sz, type);
u8 b1 = 64-__builtin_clzl(sz-1ull);
Value* r;
if (sz <= (3ull<<(b1-2))) r = b3_allocL(b1-2, type);
else r = b1_allocL(b1, type);
#ifdef OBJ_COUNTER
r->uid = currObjCounter++;
#endif
return r;
if (sz <= (3ull<<(b1-2))) return b3_allocL(b1-2, type);
else return b1_allocL(b1, type);
}
static void mm_free(Value* x) {
if (x->mmInfo&64) b3_free(x);

View File

@ -23,9 +23,6 @@ static void* mm_alloc(usz sz, u8 type) {
assert(sz>=16);
onAlloc(sz, type);
Value* r = mm_allocL(BSZI(sz), type);
#ifdef OBJ_COUNTER
r->uid = currObjCounter++;
#endif
return r;
}

View File

@ -38,6 +38,9 @@ static void* BN(allocL)(i64 bucket, u8 type) {
u64* e = p + BSZ(bucket)/8;
while(s<e) *s++ = tag(NULL, OBJ_TAG).u;
#endif
#ifdef OBJ_COUNTER
x->uid = currObjCounter++;
#endif
return x;
}
#undef buckets