apparently BSZI is barely used

This commit is contained in:
dzaima 2021-07-05 01:22:49 +03:00
parent 7bc8856cd1
commit d063e83a8d
7 changed files with 6 additions and 16 deletions

View File

@ -1,4 +1,5 @@
#if defined(__x86_64) || defined(__amd64__)
#include "../core.h"
#if (defined(__x86_64) || defined(__amd64__)) && MM!=0
#include "nvm_x86_64.c"
#else
#include "nvm_placeholder.c"

View File

@ -26,10 +26,9 @@
#define PROT PROT_READ|PROT_WRITE|PROT_EXEC
#define FLAGS MAP_NORESERVE|MAP_PRIVATE|MAP_ANON|MAP_32BIT
#include "../opt/mm_buddyTemplate.c"
static void* mmX_allocN(usz sz, u8 type) { assert(sz>=16); return mmX_allocL(BSZI(sz), type); }
static void* mmX_allocN(usz sz, u8 type) { assert(sz>=16); return mmX_allocL(64-__builtin_clzl(sz-1ull), type); }
#undef mmX_buckets
#undef BN
#undef BSZI
#undef BSZ

View File

@ -6,7 +6,6 @@ u64 currObjCounter;
#define ALSZ 20
#define BSZ(X) (1ull<<(X))
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
#define MMI(X) X
#define BN(X) b1_##X
#define buckets b1_buckets
@ -14,11 +13,9 @@ u64 currObjCounter;
#undef buckets
#undef BN
#undef BSZ
#undef BSZI
#define ALSZ 20
#define BSZ(X) (3ull<<(X))
#define BSZI(X) ((u8)(64-__builtin_clzl((X)/3-1ull)))
#define MMI(X) ((X)|64)
#define BN(X) b3_##X
#define buckets b3_buckets
@ -26,7 +23,6 @@ u64 currObjCounter;
#undef buckets
#undef BN
#undef BSZ
#undef BSZI
void mm_forHeap(V2v f) {
b1_forHeap(f);

View File

@ -10,7 +10,6 @@ extern u64 mm_heapAlloc;
extern u64 mm_heapMax;
#define BSZ(X) (1ull<<(X))
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
#define MMI(X) X
#define BN(X) b1_##X
#define buckets b1_buckets
@ -18,10 +17,8 @@ extern u64 mm_heapMax;
#undef buckets
#undef BN
#undef BSZ
#undef BSZI
#define BSZ(X) (3ull<<(X))
#define BSZI(X) ((u8)(64-__builtin_clzl((X)/3-1ull)))
#define MMI(X) ((X)|64)
#define BN(X) b3_##X
#define buckets b3_buckets
@ -29,7 +26,6 @@ extern u64 mm_heapMax;
#undef buckets
#undef BN
#undef BSZ
#undef BSZI
#ifdef OBJ_COUNTER
extern u64 currObjCounter;

View File

@ -6,7 +6,6 @@ u64 currObjCounter;
#define ALSZ 20
#define BSZ(X) (1ull<<(X))
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
#define MMI(X) X
#define BN(X) mm_##X
@ -14,4 +13,3 @@ u64 currObjCounter;
#undef BN
#undef BSZ
#undef BSZI

View File

@ -10,7 +10,6 @@ extern u64 mm_heapAlloc;
extern u64 mm_heapMax;
#define BSZ(X) (1ull<<(X))
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
#define MMI(X) X
#define BN(X) mm_##X
@ -20,6 +19,7 @@ extern u64 mm_heapMax;
extern u64 currObjCounter;
#endif
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
static void* mm_alloc(usz sz, u8 type) {
assert(sz>=16);
onAlloc(sz, type);
@ -38,6 +38,6 @@ static u64 mm_size(Value* x) {
}
void mm_forHeap(V2v f);
#undef BSZI
#undef BN
#undef BSZ
#undef BSZI

View File

@ -1,7 +1,7 @@
#pragma once
#if defined(__x86_64) || defined(__amd64__)
#if (defined(__x86_64) || defined(__amd64__)) && MM!=0
#ifndef JIT_START
#define JIT_START 2 // number of calls for when to start JITting. -1: never JIT; 0: JIT everything, n: JIT after n non-JIT invocations; max ¯1+2⋆16
#endif