always take size in mm_alloc as u64

This commit is contained in:
dzaima 2022-11-13 20:45:42 +02:00
parent 3be97e6f61
commit 8e631d7177
5 changed files with 5 additions and 5 deletions

View File

@ -327,7 +327,7 @@ extern B bi_emptyHVec, bi_emptyIVec, bi_emptyCVec, bi_emptySVec;
#define emptyIVec() incG(bi_emptyIVec)
#define emptyCVec() incG(bi_emptyCVec)
#define emptySVec() incG(bi_emptySVec)
static void* mm_alloc(usz sz, u8 type);
static void* mm_alloc(u64 sz, u8 type);
static void mm_free(Value* x);
static u64 mm_size(Value* x);
static void mm_visit(B x);

View File

@ -19,7 +19,7 @@ extern EmptyValue* mm_buckets[128];
#define LOG2(X) ((u8)(64-CLZ((X)-1ull)))
static void* mm_alloc(usz sz, u8 type) {
static void* mm_alloc(u64 sz, u8 type) {
assert(sz>=16);
u32 log = LOG2(sz);
u32 logm2 = log-2;

View File

@ -19,7 +19,7 @@ extern EmptyValue* mm_buckets[64];
#define LOG2(X) ((u8)(64-CLZ((X)-1ull)))
static void* mm_alloc(usz sz, u8 type) {
static void* mm_alloc(u64 sz, u8 type) {
assert(sz>=16);
onAlloc(sz, type);
return mm_allocL(LOG2(sz), type);

View File

@ -8,7 +8,7 @@ static void mm_free(Value* x) {
free(x);
}
static void* mm_alloc(usz sz, u8 type) {
static void* mm_alloc(u64 sz, u8 type) {
Value* x = malloc(sz);
onAlloc(sz, type);
x->flags = x->extra = x->mmInfo = x->type = 0;

View File

@ -43,7 +43,7 @@ struct Mut {
static void mut_init(Mut* m, u8 n) {
m->fns = &mutFns[n];
usz ia = PIA(m);
usz sz;
u64 sz;
// hack around inlining of the allocator too many times
switch(n) { default: UD;
case el_bit: sz = BITARR_SZ( ia); break;