diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index ce587af2..1a3bf509 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -288,7 +288,7 @@ B select_c2(B t, B w, B x) { B* xp = hany_ptr(x); \ for (; i < wia; i++) r.a[i] = inc(xp[WRAP(wp[i], xia, thrF("โŠ: Indexing out-of-bounds (%iโˆŠ๐•จ, %sโ‰กโ‰ ๐•ฉ)", wp[i], xia))]); \ dec(x); return harr_fcd(r, w); \ - } \ + } SLOW2("๐•จโŠ๐•ฉ", w, x); \ for (; i < wia; i++) r.a[i] = Get(x, WRAP(wp[i], xia, thrF("โŠ: Indexing out-of-bounds (%iโˆŠ๐•จ, %sโ‰กโ‰ ๐•ฉ)", wp[i], xia))); \ dec(x); return withFill(harr_fcd(r,w),xf); \ } @@ -431,6 +431,7 @@ B slash_c2(B t, B w, B x) { } \ if (or>>SIGN) thrM("/: ๐•จ must consist of natural numbers"); \ CASE(WT,i8) CASE(WT,i16) CASE(WT,i32) CASE(WT,f64) \ + SLOW2("๐•จ/๐•ฉ", w, x); \ HArr_p r = m_harrs(wsum, &ri); SGetU(x) \ for (usz i = 0; i < wia; i++) { \ i32 cw = wp[i]; if (cw==0) continue; \ @@ -477,6 +478,7 @@ B slash_c2(B t, B w, B x) { dec(x); return r; } else { + SLOW2("๐•จ/๐•ฉ", w, x); B xf = getFillQ(x); HArr_p r = m_harrUv(xia*wv); SGetU(x) @@ -814,6 +816,7 @@ B group_c2(B t, B w, B x) { c->ia = 0; rp[i] = taga(c); } + SLOW2("๐•จโŠ”๐•ฉ", w, x); SGet(x) for (usz i = 0; i < xia; i++) { i32 n = wp[i]; diff --git a/src/core/stuff.c b/src/core/stuff.c index a1c0d7ad..7f5d61fe 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -694,6 +694,13 @@ NOINLINE void printAllocStats() { #endif } +// for gdb +Value* g_v(B x) { return v(x); } +Arr* g_a(B x) { return a(x); } +B g_t (void* x) { return tag(x,OBJ_TAG); } +B g_ta(void* x) { return tag(x,ARR_TAG); } +B g_tf(void* x) { return tag(x,FUN_TAG); } + #ifdef DEBUG #ifdef OBJ_COUNTER #define PRINT_ID(X) printf("Object ID: "N64u"\n", (X)->uid) diff --git a/src/h.h b/src/h.h index 8eaf7088..e2cdf451 100644 --- a/src/h.h +++ b/src/h.h @@ -115,6 +115,7 @@ #define NORETURN __attribute__((noreturn)) #define AUTO __auto_type #define CLZ(X) __builtin_clzll(X) +#define POPC(X) __builtin_popcountll(X) #define LIKELY(X) __builtin_expect(X,1) #define RARE(X) __builtin_expect(X,0) #define fsizeof(T,F,E,N) (offsetof(T, F) + sizeof(E)*(N)) // type, flexible array member name, flexible array member type, item amount @@ -222,9 +223,9 @@ enum ElType { // aโŒˆb shall return the type that can store both, if possible; a typedef struct Value { i32 refc; // plain old reference count u8 mmInfo; // bucket size, mark&sweep bits when that's needed - u8 flags; // is sorted/a permutation/whatever in the future, currently primitive index for self-hosted runtime + u8 flags; // self-hosted primitive index for callable, fl_* flags for arrays u8 type; // used by TI, among generally knowing what type of object this is - ur extra; // whatever object-specific stuff. Rank for arrays, id for functions + ur extra; // whatever object-specific stuff. Rank for arrays, internal id for functions #ifdef OBJ_COUNTER u64 uid; #endif diff --git a/src/utils/wyhash.h b/src/utils/wyhash.h index ea20c830..76facf28 100644 --- a/src/utils/wyhash.h +++ b/src/utils/wyhash.h @@ -170,19 +170,7 @@ static inline void make_secret(uint64_t seed, uint64_t *secret){ for(size_t j=0;j<64;j+=8) secret[i]|=((uint64_t)c[wyrand(&seed)%sizeof(c)])<> 1) & 0x5555555555555555; - x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333); - x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f; - x = (x * 0x0101010101010101) >> 56; - if(x!=32){ ok=0; break; } -#endif + if(POPC(secret[j]^secret[i])!=32){ ok=0; break; } } }while(!ok); }