more slow warns

This commit is contained in:
dzaima 2021-09-26 13:36:37 +03:00
parent 797a848ed4
commit d2ea19c757
4 changed files with 15 additions and 16 deletions

View File

@ -288,7 +288,7 @@ B select_c2(B t, B w, B x) {
B* xp = hany_ptr(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))]); \ 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); \ 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))); \ 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); \ 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"); \ if (or>>SIGN) thrM("/: 𝕨 must consist of natural numbers"); \
CASE(WT,i8) CASE(WT,i16) CASE(WT,i32) CASE(WT,f64) \ CASE(WT,i8) CASE(WT,i16) CASE(WT,i32) CASE(WT,f64) \
SLOW2("𝕨/𝕩", w, x); \
HArr_p r = m_harrs(wsum, &ri); SGetU(x) \ HArr_p r = m_harrs(wsum, &ri); SGetU(x) \
for (usz i = 0; i < wia; i++) { \ for (usz i = 0; i < wia; i++) { \
i32 cw = wp[i]; if (cw==0) continue; \ i32 cw = wp[i]; if (cw==0) continue; \
@ -477,6 +478,7 @@ B slash_c2(B t, B w, B x) {
dec(x); dec(x);
return r; return r;
} else { } else {
SLOW2("𝕨/𝕩", w, x);
B xf = getFillQ(x); B xf = getFillQ(x);
HArr_p r = m_harrUv(xia*wv); HArr_p r = m_harrUv(xia*wv);
SGetU(x) SGetU(x)
@ -814,6 +816,7 @@ B group_c2(B t, B w, B x) {
c->ia = 0; c->ia = 0;
rp[i] = taga(c); rp[i] = taga(c);
} }
SLOW2("𝕨⊔𝕩", w, x);
SGet(x) SGet(x)
for (usz i = 0; i < xia; i++) { for (usz i = 0; i < xia; i++) {
i32 n = wp[i]; i32 n = wp[i];

View File

@ -694,6 +694,13 @@ NOINLINE void printAllocStats() {
#endif #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 DEBUG
#ifdef OBJ_COUNTER #ifdef OBJ_COUNTER
#define PRINT_ID(X) printf("Object ID: "N64u"\n", (X)->uid) #define PRINT_ID(X) printf("Object ID: "N64u"\n", (X)->uid)

View File

@ -115,6 +115,7 @@
#define NORETURN __attribute__((noreturn)) #define NORETURN __attribute__((noreturn))
#define AUTO __auto_type #define AUTO __auto_type
#define CLZ(X) __builtin_clzll(X) #define CLZ(X) __builtin_clzll(X)
#define POPC(X) __builtin_popcountll(X)
#define LIKELY(X) __builtin_expect(X,1) #define LIKELY(X) __builtin_expect(X,1)
#define RARE(X) __builtin_expect(X,0) #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 #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 { typedef struct Value {
i32 refc; // plain old reference count i32 refc; // plain old reference count
u8 mmInfo; // bucket size, mark&sweep bits when that's needed 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 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 #ifdef OBJ_COUNTER
u64 uid; u64 uid;
#endif #endif

View File

@ -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)])<<j; for(size_t j=0;j<64;j+=8) secret[i]|=((uint64_t)c[wyrand(&seed)%sizeof(c)])<<j;
if(secret[i]%2==0){ ok=0; continue; } if(secret[i]%2==0){ ok=0; continue; }
for(size_t j=0;j<i;j++) { for(size_t j=0;j<i;j++) {
#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) if(POPC(secret[j]^secret[i])!=32){ ok=0; break; }
if(__builtin_popcountll(secret[j]^secret[i])!=32){ ok=0; break; }
#elif defined(_MSC_VER) && defined(_M_X64)
if(_mm_popcnt_u64(secret[j]^secret[i])!=32){ ok=0; break; }
#else
//manual popcount
uint64_t x = secret[j]^secret[i];
x -= (x >> 1) & 0x5555555555555555;
x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;
x = (x * 0x0101010101010101) >> 56;
if(x!=32){ ok=0; break; }
#endif
} }
}while(!ok); }while(!ok);
} }