apparently BSZI is barely used
This commit is contained in:
parent
7bc8856cd1
commit
d063e83a8d
@ -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"
|
#include "nvm_x86_64.c"
|
||||||
#else
|
#else
|
||||||
#include "nvm_placeholder.c"
|
#include "nvm_placeholder.c"
|
||||||
|
|||||||
@ -26,10 +26,9 @@
|
|||||||
#define PROT PROT_READ|PROT_WRITE|PROT_EXEC
|
#define PROT PROT_READ|PROT_WRITE|PROT_EXEC
|
||||||
#define FLAGS MAP_NORESERVE|MAP_PRIVATE|MAP_ANON|MAP_32BIT
|
#define FLAGS MAP_NORESERVE|MAP_PRIVATE|MAP_ANON|MAP_32BIT
|
||||||
#include "../opt/mm_buddyTemplate.c"
|
#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 mmX_buckets
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZI
|
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ u64 currObjCounter;
|
|||||||
|
|
||||||
#define ALSZ 20
|
#define ALSZ 20
|
||||||
#define BSZ(X) (1ull<<(X))
|
#define BSZ(X) (1ull<<(X))
|
||||||
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
|
|
||||||
#define MMI(X) X
|
#define MMI(X) X
|
||||||
#define BN(X) b1_##X
|
#define BN(X) b1_##X
|
||||||
#define buckets b1_buckets
|
#define buckets b1_buckets
|
||||||
@ -14,11 +13,9 @@ u64 currObjCounter;
|
|||||||
#undef buckets
|
#undef buckets
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
#undef BSZI
|
|
||||||
|
|
||||||
#define ALSZ 20
|
#define ALSZ 20
|
||||||
#define BSZ(X) (3ull<<(X))
|
#define BSZ(X) (3ull<<(X))
|
||||||
#define BSZI(X) ((u8)(64-__builtin_clzl((X)/3-1ull)))
|
|
||||||
#define MMI(X) ((X)|64)
|
#define MMI(X) ((X)|64)
|
||||||
#define BN(X) b3_##X
|
#define BN(X) b3_##X
|
||||||
#define buckets b3_buckets
|
#define buckets b3_buckets
|
||||||
@ -26,7 +23,6 @@ u64 currObjCounter;
|
|||||||
#undef buckets
|
#undef buckets
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
#undef BSZI
|
|
||||||
|
|
||||||
void mm_forHeap(V2v f) {
|
void mm_forHeap(V2v f) {
|
||||||
b1_forHeap(f);
|
b1_forHeap(f);
|
||||||
|
|||||||
@ -10,7 +10,6 @@ extern u64 mm_heapAlloc;
|
|||||||
extern u64 mm_heapMax;
|
extern u64 mm_heapMax;
|
||||||
|
|
||||||
#define BSZ(X) (1ull<<(X))
|
#define BSZ(X) (1ull<<(X))
|
||||||
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
|
|
||||||
#define MMI(X) X
|
#define MMI(X) X
|
||||||
#define BN(X) b1_##X
|
#define BN(X) b1_##X
|
||||||
#define buckets b1_buckets
|
#define buckets b1_buckets
|
||||||
@ -18,10 +17,8 @@ extern u64 mm_heapMax;
|
|||||||
#undef buckets
|
#undef buckets
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
#undef BSZI
|
|
||||||
|
|
||||||
#define BSZ(X) (3ull<<(X))
|
#define BSZ(X) (3ull<<(X))
|
||||||
#define BSZI(X) ((u8)(64-__builtin_clzl((X)/3-1ull)))
|
|
||||||
#define MMI(X) ((X)|64)
|
#define MMI(X) ((X)|64)
|
||||||
#define BN(X) b3_##X
|
#define BN(X) b3_##X
|
||||||
#define buckets b3_buckets
|
#define buckets b3_buckets
|
||||||
@ -29,7 +26,6 @@ extern u64 mm_heapMax;
|
|||||||
#undef buckets
|
#undef buckets
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
#undef BSZI
|
|
||||||
|
|
||||||
#ifdef OBJ_COUNTER
|
#ifdef OBJ_COUNTER
|
||||||
extern u64 currObjCounter;
|
extern u64 currObjCounter;
|
||||||
|
|||||||
@ -6,7 +6,6 @@ u64 currObjCounter;
|
|||||||
|
|
||||||
#define ALSZ 20
|
#define ALSZ 20
|
||||||
#define BSZ(X) (1ull<<(X))
|
#define BSZ(X) (1ull<<(X))
|
||||||
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
|
|
||||||
#define MMI(X) X
|
#define MMI(X) X
|
||||||
#define BN(X) mm_##X
|
#define BN(X) mm_##X
|
||||||
|
|
||||||
@ -14,4 +13,3 @@ u64 currObjCounter;
|
|||||||
|
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
#undef BSZI
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ extern u64 mm_heapAlloc;
|
|||||||
extern u64 mm_heapMax;
|
extern u64 mm_heapMax;
|
||||||
|
|
||||||
#define BSZ(X) (1ull<<(X))
|
#define BSZ(X) (1ull<<(X))
|
||||||
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
|
|
||||||
#define MMI(X) X
|
#define MMI(X) X
|
||||||
#define BN(X) mm_##X
|
#define BN(X) mm_##X
|
||||||
|
|
||||||
@ -20,6 +19,7 @@ extern u64 mm_heapMax;
|
|||||||
extern u64 currObjCounter;
|
extern u64 currObjCounter;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BSZI(X) ((u8)(64-__builtin_clzl((X)-1ull)))
|
||||||
static void* mm_alloc(usz sz, u8 type) {
|
static void* mm_alloc(usz sz, u8 type) {
|
||||||
assert(sz>=16);
|
assert(sz>=16);
|
||||||
onAlloc(sz, type);
|
onAlloc(sz, type);
|
||||||
@ -38,6 +38,6 @@ static u64 mm_size(Value* x) {
|
|||||||
}
|
}
|
||||||
void mm_forHeap(V2v f);
|
void mm_forHeap(V2v f);
|
||||||
|
|
||||||
|
#undef BSZI
|
||||||
#undef BN
|
#undef BN
|
||||||
#undef BSZ
|
#undef BSZ
|
||||||
#undef BSZI
|
|
||||||
|
|||||||
2
src/vm.h
2
src/vm.h
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#if defined(__x86_64) || defined(__amd64__)
|
#if (defined(__x86_64) || defined(__amd64__)) && MM!=0
|
||||||
#ifndef JIT_START
|
#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
|
#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
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user