From 8e631d71771675b0a4e99e232eeb341f2826d381 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 13 Nov 2022 20:45:42 +0200 Subject: [PATCH] always take size in mm_alloc as u64 --- src/h.h | 2 +- src/opt/mm_2buddy.h | 2 +- src/opt/mm_buddy.h | 2 +- src/opt/mm_malloc.h | 2 +- src/utils/mut.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/h.h b/src/h.h index 1fa5ebe6..7384c6c3 100644 --- a/src/h.h +++ b/src/h.h @@ -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); diff --git a/src/opt/mm_2buddy.h b/src/opt/mm_2buddy.h index 51264de3..f85d598a 100644 --- a/src/opt/mm_2buddy.h +++ b/src/opt/mm_2buddy.h @@ -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; diff --git a/src/opt/mm_buddy.h b/src/opt/mm_buddy.h index 0fb92437..67eb5f18 100644 --- a/src/opt/mm_buddy.h +++ b/src/opt/mm_buddy.h @@ -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); diff --git a/src/opt/mm_malloc.h b/src/opt/mm_malloc.h index 707d5bd0..9a4c014e 100644 --- a/src/opt/mm_malloc.h +++ b/src/opt/mm_malloc.h @@ -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; diff --git a/src/utils/mut.h b/src/utils/mut.h index b15b7b97..6f8b3447 100644 --- a/src/utils/mut.h +++ b/src/utils/mut.h @@ -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;