overallocate heap

This commit is contained in:
dzaima 2021-10-19 18:12:27 +03:00
parent 044431bb7d
commit e38e4f89ae
4 changed files with 5 additions and 7 deletions

4
.gitignore vendored
View File

@ -1,7 +1,5 @@
BQN BQN
c.bqn c.bqn
perf.* perf.*
obj/*/*.o obj/
obj/*/*.d
obj/*/*.tmp
asm_* asm_*

View File

@ -340,11 +340,11 @@ B rand_range_c2(B t, B w, B x) {
RAND_END; RAND_END;
if (isArr(w)) { if (isArr(w)) {
switch (a(w)->ia) { usz wia = a(w)->ia;
switch (wia) {
case 0: { arr_shAlloc(r, 0); break; } case 0: { arr_shAlloc(r, 0); break; }
case 1: { arr_shVec(r); break; } case 1: { arr_shVec(r); break; }
default: { default: {
usz wia = a(w)->ia;
usz* sh = arr_shAlloc(r, wia); usz* sh = arr_shAlloc(r, wia);
SGetU(w); SGetU(w);
for (usz i = 0; i < wia; i++) sh[i] = o2su(GetU(w, i)); for (usz i = 0; i < wia; i++) sh[i] = o2su(GetU(w, i));

View File

@ -16,7 +16,6 @@
B m_str8(usz sz, char* s); B m_str8(usz sz, char* s);
B m_str8l(char* s); B m_str8l(char* s);
B m_str32(u32* s); B m_str32(u32* s);
B m_str8l(char* s);
B fromUTF8l(char* x); B fromUTF8l(char* x);
B fromUTF8a(I8Arr* x); B fromUTF8a(I8Arr* x);

View File

@ -5,7 +5,8 @@
#define alSize BN(alSize) #define alSize BN(alSize)
#define str(X) #X #define str(X) #X
#ifndef MMAP #ifndef MMAP
#define MMAP(SZ) mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_NORESERVE|MAP_PRIVATE|MAP_ANON, -1, 0) usz getPageSize();
#define MMAP(SZ) mmap(NULL, (SZ)+getPageSize(), PROT_READ|PROT_WRITE, MAP_NORESERVE|MAP_PRIVATE|MAP_ANON, -1, 0)
#endif #endif
typedef struct AllocInfo { typedef struct AllocInfo {