always take size in mm_alloc as u64
This commit is contained in:
parent
3be97e6f61
commit
8e631d7177
2
src/h.h
2
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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user