move OBJ_COUNTER increment
This commit is contained in:
parent
48380be063
commit
9982c62526
@ -31,13 +31,8 @@ static void* mm_alloc(usz sz, u8 type) {
|
|||||||
assert(sz>=16);
|
assert(sz>=16);
|
||||||
onAlloc(sz, type);
|
onAlloc(sz, type);
|
||||||
u8 b1 = 64-__builtin_clzl(sz-1ull);
|
u8 b1 = 64-__builtin_clzl(sz-1ull);
|
||||||
Value* r;
|
if (sz <= (3ull<<(b1-2))) return b3_allocL(b1-2, type);
|
||||||
if (sz <= (3ull<<(b1-2))) r = b3_allocL(b1-2, type);
|
else return b1_allocL(b1, type);
|
||||||
else r = b1_allocL(b1, type);
|
|
||||||
#ifdef OBJ_COUNTER
|
|
||||||
r->uid = currObjCounter++;
|
|
||||||
#endif
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
static void mm_free(Value* x) {
|
static void mm_free(Value* x) {
|
||||||
if (x->mmInfo&64) b3_free(x);
|
if (x->mmInfo&64) b3_free(x);
|
||||||
|
|||||||
@ -23,9 +23,6 @@ static void* mm_alloc(usz sz, u8 type) {
|
|||||||
assert(sz>=16);
|
assert(sz>=16);
|
||||||
onAlloc(sz, type);
|
onAlloc(sz, type);
|
||||||
Value* r = mm_allocL(BSZI(sz), type);
|
Value* r = mm_allocL(BSZI(sz), type);
|
||||||
#ifdef OBJ_COUNTER
|
|
||||||
r->uid = currObjCounter++;
|
|
||||||
#endif
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,9 @@ static void* BN(allocL)(i64 bucket, u8 type) {
|
|||||||
u64* e = p + BSZ(bucket)/8;
|
u64* e = p + BSZ(bucket)/8;
|
||||||
while(s<e) *s++ = tag(NULL, OBJ_TAG).u;
|
while(s<e) *s++ = tag(NULL, OBJ_TAG).u;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef OBJ_COUNTER
|
||||||
|
x->uid = currObjCounter++;
|
||||||
|
#endif
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#undef buckets
|
#undef buckets
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user