m_hVec\d → m_hvec\d

This commit is contained in:
dzaima 2023-04-29 17:02:23 +03:00
parent e200bbc5f9
commit 35786d4f5b
11 changed files with 49 additions and 49 deletions

View File

@ -460,8 +460,8 @@ NOINLINE B for_cells_SA(B f, B w, B x, ur xcr, ur xr, u32 chr) {
if (isArr(w)) { B w0=w; w = IGet(w,0); decG(w0); }
return shift_cells(w, x, SH(x)[0], SH(x)[1], el_or(TI(x,elType), selfElType(w)), rtid);
}
if (rtid==n_take && xr>1 && isF64(w)) return takedrop_highrank(1, m_hVec2(m_f64(SH(x)[0]), w), x);
if (rtid==n_drop && xr>1 && isF64(w)) return takedrop_highrank(0, m_hVec2(m_f64(0), w), x);
if (rtid==n_take && xr>1 && isF64(w)) return takedrop_highrank(1, m_hvec2(m_f64(SH(x)[0]), w), x);
if (rtid==n_drop && xr>1 && isF64(w)) return takedrop_highrank(0, m_hvec2(m_f64(0), w), x);
if (rtid==n_transp && q_usz(w)) { usz a=o2sG(w); if (a<xr-1) return transp_cells(a+1, 1, x); }
}
S_KSLICES(x, xsh, xk, cam, 1) incBy(w, cam-1);

View File

@ -69,7 +69,7 @@ FORCE_INLINE B m_vec2Base(B a, B b, bool fills) {
return taga(ra);
}
noFills:
return m_hVec2(a,b);
return m_hvec2(a,b);
}
B m_vec2(B a, B b) { return m_vec2Base(a, b, false); }

View File

@ -44,8 +44,8 @@ B type_c1(B t, B x) {
}
B decp_c1(B t, B x) {
if (!isVal(x)) return m_hVec2(m_i32(-1), x);
if (isPrim(x)) return m_hVec2(m_i32(0), x);
if (!isVal(x)) return m_hvec2(m_i32(-1), x);
if (isPrim(x)) return m_hvec2(m_i32(0), x);
return TI(x,decompose)(x);
}
@ -1052,7 +1052,7 @@ B sh_c2(B t, B w, B x) {
int code = WIFEXITED(status)? WEXITSTATUS(status)
: WIFSIGNALED(status)? WTERMSIG(status)+128
: -1;
return m_hVec3(m_i32(code), s_outObj, s_errObj);
return m_hvec3(m_i32(code), s_outObj, s_errObj);
}
#else
#define HAS_SH 0
@ -1640,7 +1640,7 @@ B sys_c1(B t, B x) {
case 15: { // •state
if (q_N(comp_currArgs)) thrM("No arguments present for •state");
if (q_N(comp_currPath)) thrM("No path present for •state");
cr = m_hVec3(inc(REQ_PATH), inc(REQ_NAME), inc(comp_currArgs));
cr = m_hvec3(inc(REQ_PATH), inc(REQ_NAME), inc(comp_currArgs));
break;
}
case 16: { // •args

View File

@ -49,11 +49,11 @@ B fork_c2(B t, B w, B x) {
B md2H_c1(Md1D* m, B x) { Md2H* t=(Md2H*) m->m1; return md2D_c1(m_md2D(t->m2, m->f, t->g), x); }
B md2H_c2(Md1D* m, B w, B x) { Md2H* t=(Md2H*) m->m1; return md2D_c2(m_md2D(t->m2, m->f, t->g), w, x); }
static B md1D_decompose(B x) { B r=m_hVec3(m_i32(4),inc(c(Md1D,x)->f),tag(ptr_inc(c(Md1D,x)->m1),MD1_TAG) ); decR(x); return r; }
static B md2D_decompose(B x) { B r=m_hVec4(m_i32(5),inc(c(Md2D,x)->f),tag(ptr_inc(c(Md2D,x)->m2),MD2_TAG), inc(c(Md2D,x)->g)); decR(x); return r; }
static B md2H_decompose(B x) { B r=m_hVec3(m_i32(6), tag(ptr_inc(c(Md2H,x)->m2),MD2_TAG), inc(c(Md2H,x)->g)); decR(x); return r; }
static B fork_decompose(B x) { B r=m_hVec4(m_i32(3),inc(c(Fork,x)->f), inc(c(Fork,x)->g ), inc(c(Fork,x)->h)); decR(x); return r; }
static B atop_decompose(B x) { B r=m_hVec3(m_i32(2), inc(c(Atop,x)->g ), inc(c(Atop,x)->h)); decR(x); return r; }
static B md1D_decompose(B x) { B r=m_hvec3(m_i32(4),inc(c(Md1D,x)->f),tag(ptr_inc(c(Md1D,x)->m1),MD1_TAG) ); decR(x); return r; }
static B md2D_decompose(B x) { B r=m_hvec4(m_i32(5),inc(c(Md2D,x)->f),tag(ptr_inc(c(Md2D,x)->m2),MD2_TAG), inc(c(Md2D,x)->g)); decR(x); return r; }
static B md2H_decompose(B x) { B r=m_hvec3(m_i32(6), tag(ptr_inc(c(Md2H,x)->m2),MD2_TAG), inc(c(Md2H,x)->g)); decR(x); return r; }
static B fork_decompose(B x) { B r=m_hvec4(m_i32(3),inc(c(Fork,x)->f), inc(c(Fork,x)->g ), inc(c(Fork,x)->h)); decR(x); return r; }
static B atop_decompose(B x) { B r=m_hvec3(m_i32(2), inc(c(Atop,x)->g ), inc(c(Atop,x)->h)); decR(x); return r; }
static B md2D_uc1(B t, B o, B x) {
Md2* m = c(Md2D, t)->m2;

View File

@ -118,8 +118,8 @@ static HArr* toHArr(B x) { return TY(x)==t_harr? c(HArr,x) : (HArr*) cpyHArr(x);
B m_caB(usz ia, B* a);
// consumes all
static B m_hVec1(B a ) { HArr_p r = m_harrUv(1); r.a[0] = a; NOGC_E; return r.b; }
static B m_hVec2(B a, B b ) { HArr_p r = m_harrUv(2); r.a[0] = a; r.a[1] = b; NOGC_E; return r.b; }
static B m_hVec3(B a, B b, B c ) { HArr_p r = m_harrUv(3); r.a[0] = a; r.a[1] = b; r.a[2] = c; NOGC_E; return r.b; }
static B m_hVec4(B a, B b, B c, B d) { HArr_p r = m_harrUv(4); r.a[0] = a; r.a[1] = b; r.a[2] = c; r.a[3] = d; NOGC_E; return r.b; }
static B m_hvec1(B a ) { HArr_p r = m_harrUv(1); r.a[0] = a; NOGC_E; return r.b; }
static B m_hvec2(B a, B b ) { HArr_p r = m_harrUv(2); r.a[0] = a; r.a[1] = b; NOGC_E; return r.b; }
static B m_hvec3(B a, B b, B c ) { HArr_p r = m_harrUv(3); r.a[0] = a; r.a[1] = b; r.a[2] = c; NOGC_E; return r.b; }
static B m_hvec4(B a, B b, B c, B d) { HArr_p r = m_harrUv(4); r.a[0] = a; r.a[1] = b; r.a[2] = c; r.a[3] = d; NOGC_E; return r.b; }

View File

@ -82,7 +82,7 @@ B def_m1_ucw(Md1* t, B o, B f, B w, B x) { B t2 = m1_d(tag(ptr_inc(t),MD1_T
B def_m2_uc1(Md2* t, B o, B f, B g, B x) { B t2 = m2_d(tag(ptr_inc(t),MD2_TAG),inc(f),inc(g)); B r = rtUnder_c1(o, t2, x); decG(t2); return r; }
B def_m2_ucw(Md2* t, B o, B f, B g, B w, B x) { B t2 = m2_d(tag(ptr_inc(t),MD2_TAG),inc(f),inc(g)); B r = rtUnder_cw(o, t2, w, x); decG(t2); return r; }
B def_decompose(B x) {
return m_hVec2(m_i32(isCallable(x)? (isImpureBuiltin(x)? 1 : 0) : -1),x);
return m_hvec2(m_i32(isCallable(x)? (isImpureBuiltin(x)? 1 : 0) : -1),x);
}
B bi_emptyHVec, bi_emptyIVec, bi_emptyCVec, bi_emptySVec;

View File

@ -925,7 +925,7 @@ B ffiload_c2(B t, B w, B x) {
if (s!=FFI_OK) thrM("FFI: Error preparing call interface");
// mm_free(argsRaw)
u32 flags = many[1] | many[0]<<1 | tRes.resSingle<<2;
B r = m_ffiFn(foreignFnDesc, m_hVec3(argObj, tag(cif, OBJ_TAG), tag(argsRaw, OBJ_TAG)), libffiFn_c1, libffiFn_c2, (void*)(u64)flags, sym);
B r = m_ffiFn(foreignFnDesc, m_hvec3(argObj, tag(cif, OBJ_TAG), tag(argsRaw, OBJ_TAG)), libffiFn_c1, libffiFn_c2, (void*)(u64)flags, sym);
c(BoundFn,r)->mutCount = mutCount;
return r;
#endif

View File

@ -118,11 +118,11 @@ INS B i_LST_0(void) { // TODO combine with ADDI
}
INS B i_LST_1(B a) {
if (isNum(a)) return m_vec1(a);
return m_hVec1(a);
return m_hvec1(a);
}
INS B i_LST_2(B a, B b) {
if (isNum(a) && isNum(b)) return m_vec2(a, b);
return m_hVec2(a, b);
return m_hvec2(a, b);
}
INS B i_LST_p(B el0, i64 sz, B* cStack) { assert(sz>0);
GS_UPD;

View File

@ -210,7 +210,7 @@ Block* bqn_compScc(B str, B path, B args, Scope* sc, B comp, B rt, bool repl) {
csc = csc->psc;
depth++;
}
Block* r = load_compObj(c2(comp, m_hVec4(incG(rt), incG(bi_sys), vName, vDepth), inc(str)), str, path, sc);
Block* r = load_compObj(c2(comp, m_hvec4(incG(rt), incG(bi_sys), vName, vDepth), inc(str)), str, path, sc);
dec(path); dec(args);
POP_COMP; popCatch();
return r;
@ -309,7 +309,7 @@ B getPrimitives(void) {
usz l = IA(gg[gi]);
u32* gp = c32arr_ptr(gg[gi]);
for (usz i = 0; i < l; i++) {
HARR_ADDA(ph, m_hVec2(m_c32(gp[i]), inc(pr[i])));
HARR_ADDA(ph, m_hvec2(m_c32(gp[i]), inc(pr[i])));
}
pr+= l;
}
@ -339,7 +339,7 @@ B rebqn_exec(B str, B path, B args, B o) {
sc->body = ptr_inc(block->bodies[0]);
res = execBlockInplace(block, sc);
} else {
B rtsys = m_hVec2(inc(op[3]), incG(bi_sys));
B rtsys = m_hvec2(inc(op[3]), incG(bi_sys));
block = bqn_compc(str, path, args, op[2], rtsys);
decG(rtsys);
comp_currRe = prevRe;
@ -353,10 +353,10 @@ B rebqn_exec(B str, B path, B args, B o) {
}
static NOINLINE B m_lvB_0( ) { return emptyHVec(); }
static NOINLINE B m_lvB_1(B a ) { return m_hVec1(a); }
static NOINLINE B m_lvB_2(B a, B b ) { return m_hVec2(a,b); }
static NOINLINE B m_lvB_3(B a, B b, B c ) { return m_hVec3(a,b,c); }
static NOINLINE B m_lvB_4(B a, B b, B c, B d) { return m_hVec4(a,b,c,d); }
static NOINLINE B m_lvB_1(B a ) { return m_hvec1(a); }
static NOINLINE B m_lvB_2(B a, B b ) { return m_hvec2(a,b); }
static NOINLINE B m_lvB_3(B a, B b, B c ) { return m_hvec3(a,b,c); }
static NOINLINE B m_lvB_4(B a, B b, B c, B d) { return m_hvec4(a,b,c,d); }
static NOINLINE B m_lvi32_0( ) { return emptyIVec(); }
static NOINLINE B m_lvi32_1(i32 a ) { i32* rp; B r = m_i32arrv(&rp,1); rp[0]=a; return r; }
static NOINLINE B m_lvi32_2(i32 a, i32 b ) { i32* rp; B r = m_i32arrv(&rp,2); rp[0]=a; rp[1]=b; return r; }
@ -424,7 +424,7 @@ void load_init() { // very last init function
B setPrims = Get(rtRes,1);
B setInv = Get(rtRes,2);
dec(rtRes);
dec(c1(setPrims, m_hVec2(incG(bi_decp), incG(bi_primInd)))); decG(setPrims);
dec(c1(setPrims, m_hvec2(incG(bi_decp), incG(bi_primInd)))); decG(setPrims);
dec(c2(setInv, incG(bi_setInvSwap), incG(bi_setInvReg))); decG(setInv);
@ -469,7 +469,7 @@ void load_init() { // very last init function
B* runtime = runtimeH.a;
B rtObj = runtimeH.b;
load_rtObj = FAKE_RUNTIME? frtObj : rtObj;
load_compArg = m_hVec2(load_rtObj, incG(bi_sys)); gc_add(FAKE_RUNTIME? rtObj : frtObj);
load_compArg = m_hvec2(load_rtObj, incG(bi_sys)); gc_add(FAKE_RUNTIME? rtObj : frtObj);
#else
B* runtime = fruntime;
(void)frtObj;
@ -480,7 +480,7 @@ void load_init() { // very last init function
if (isVal(r)) v(r)->flags|= i+1;
}
load_rtObj = frtObj;
load_compArg = m_hVec2(load_rtObj, incG(bi_sys));
load_compArg = m_hvec2(load_rtObj, incG(bi_sys));
rt_select=rt_slash=rt_group=rt_find=rt_invFnReg=rt_invFnSwap = incByG(bi_invalidFn, 7);
rt_undo=rt_insert = incByG(bi_invalidMd1, 2);
rt_under=rt_depth = incByG(bi_invalidMd2, 2);
@ -514,7 +514,7 @@ void load_init() { // very last init function
print_allocStats();
exit(0);
#else // use compiler
load_glyphs = m_hVec3(m_c32vec_0(U"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!"), m_c32vec_0(U"˙˜˘¨⌜⁼´˝`"), m_c32vec_0(U"∘○⊸⟜⌾⊘◶⎉⚇⍟⎊")); gc_add(load_glyphs);
load_glyphs = m_hvec3(m_c32vec_0(U"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!"), m_c32vec_0(U"˙˜˘¨⌜⁼´˝`"), m_c32vec_0(U"∘○⊸⟜⌾⊘◶⎉⚇⍟⎊")); gc_add(load_glyphs);
#if !ONLY_NATIVE_COMP
B prevAsrt = runtime[n_asrt];

View File

@ -109,7 +109,7 @@ NOINLINE B nc_tokenize(B prims, B sysvs, u32* chars, usz len, bool* hasBlock) {
}
case U'𝕨': case U'𝕩': { // special names
*hasBlock = true;
val = m_hVec2(m_f64(3), m_c32vec((u32[1]){c}, 1));
val = m_hvec2(m_f64(3), m_c32vec((u32[1]){c}, 1));
break;
}
case 'a'...'z': case 'A'...'Z': case U'': { // names
@ -120,11 +120,11 @@ NOINLINE B nc_tokenize(B prims, B sysvs, u32* chars, usz len, bool* hasBlock) {
u32* np; B name = m_c32arrv(&np, ia);
PLAINLOOP for (usz j = 0; j < ia; j++) np[j] = chars[i0+j] + (nc_up(chars[i0+j])? 32 : 0);
if (sys) {
B sysRes = C1(sys, m_hVec1(name));
B sysRes = C1(sys, m_hvec1(name));
val = nc_literal(IGet(sysRes, 0)); // won't have the class the user entered but ¯\_(ツ)_/¯
decG(sysRes);
} else {
val = m_hVec2(m_f64(nc_up(c)? 0 : 3), name);
val = m_hvec2(m_f64(nc_up(c)? 0 : 3), name);
}
break;
}
@ -192,7 +192,7 @@ B nc_generate(B p1) { // consumes
nc_ijoin(&bc, IGetU(e, 1));
nc_iadd(&bc, MD1C);
decG(e);
e = m_hVec2(m_f64(0), bc);
e = m_hvec2(m_f64(0), bc);
j++;
}
@ -225,7 +225,7 @@ B nc_generate(B p1) { // consumes
if (tyE != o2iG(IGetU(en1, 2))) thrM("Native compiler: Wrong assignment class");
nc_iadd(&bc, en1t==4? SETN : SETU);
decG(e);
e = m_hVec2(m_f64(explicit? 3 : 0), bc);
e = m_hvec2(m_f64(explicit? 3 : 0), bc);
i-= 1;
continue;
}
@ -240,7 +240,7 @@ B nc_generate(B p1) { // consumes
nc_ijoin(&bc, IGetU(en2, 1));
nc_iadd(&bc, explicit? FN2O : TR3O);
decG(e);
e = m_hVec2(m_f64(explicit? 3 : 0), bc);
e = m_hvec2(m_f64(explicit? 3 : 0), bc);
i-= 2;
continue;
}
@ -252,7 +252,7 @@ B nc_generate(B p1) { // consumes
nc_ijoin(&bc, IGetU(en1, 1));
nc_iadd(&bc, explicit? FN1O : TR2D);
decG(e);
e = m_hVec2(m_f64(explicit? 3 : 0), bc);
e = m_hvec2(m_f64(explicit? 3 : 0), bc);
i-= 1;
}
// printf("e: "); printI(e); putchar('\n');
@ -333,14 +333,14 @@ B nc_parseStatements(B tokens, usz i0, usz* i1, u32 close, B* objs, Vars vars) {
decG(ns);
nc_iadd(&bc, FLDG);
nc_iadd(&bc, str2gid(IGetU(name,1)));
nc_add(&parts, m_hVec2(IGet(name,0), bc));
nc_add(&parts, m_hvec2(IGet(name,0), bc));
} else thrF("Native compiler: Unexpected character token \\u%xi / %i", ctc, ctc);
} else if (isArr(ct)) {
if (RNK(ct)==0) { // literal
B val = IGetU(ct, 0);
usz j = addObj(objs, inc(val));
i32 type = isFun(val)? 0 : isMd1(val)? 1 : isMd2(val)? 2 : 3;
nc_add(&parts, m_hVec2(m_f64(type), nc_ivec2(PUSH, j)));
nc_add(&parts, m_hvec2(m_f64(type), nc_ivec2(PUSH, j)));
} else { // name
u8 ty = nc_ty(ct);
u8 rty = ty;
@ -352,7 +352,7 @@ B nc_parseStatements(B tokens, usz i0, usz* i1, u32 close, B* objs, Vars vars) {
i++;
}
}
nc_add(&parts, m_hVec3(m_f64(rty), nc_ivec3(rty<=3? VARO : VARM, 0, nc_var(vars, IGetU(ct, 1))), m_f64(ty)));
nc_add(&parts, m_hvec3(m_f64(rty), nc_ivec3(rty<=3? VARO : VARM, 0, nc_var(vars, IGetU(ct, 1))), m_f64(ty)));
}
} else thrF("Native compiler: Unexpected token %B", ct);
}
@ -382,7 +382,7 @@ B nc_parseStatements(B tokens, usz i0, usz* i1, u32 close, B* objs, Vars vars) {
} else if (close==')') {
type = type0;
} else thrM("bad closing");
return m_hVec2(m_f64(type), final);
return m_hvec2(m_f64(type), final);
}
NOINLINE usz nc_skipSeparators(B tokens, usz i) {
@ -458,18 +458,18 @@ B nativeComp_c2(B t, B w, B x) {
// build result
B res;
if (fnBlock) {
res = m_hVec4(
res = m_hvec4(
bytecode,
objs,
m_hVec2(nc_ivec3(0, 1, 0), nc_ivec3(0, 0, 1)),
m_hVec2(nc_ivec2(0, 0), nc_ivec2(3, varCount))
m_hvec2(nc_ivec3(0, 1, 0), nc_ivec3(0, 0, 1)),
m_hvec2(nc_ivec2(0, 0), nc_ivec2(3, varCount))
);
} else {
res = m_hVec4(
res = m_hvec4(
bytecode,
objs,
m_hVec1(nc_ivec3(0, 1, 0)),
m_hVec1(nc_ivec2(0, varCount))
m_hvec1(nc_ivec3(0, 1, 0)),
m_hvec1(nc_ivec2(0, varCount))
);
}

View File

@ -1142,7 +1142,7 @@ void funBl_print(FILE* f, B x) { fprintf(f,"{function"" block}"); }
void md1Bl_print(FILE* f, B x) { fprintf(f,"{1-modifier block}"); }
void md2Bl_print(FILE* f, B x) { fprintf(f,"{2-modifier block}"); }
B block_decompose(B x) { return m_hVec2(m_i32(1), x); }
B block_decompose(B x) { return m_hvec2(m_i32(1), x); }
#if !defined(_WIN32) && !defined(_WIN64)
static usz pageSizeV;