From c7a6176be310fdd39ceed3de9385a01985d4a3d8 Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 30 Dec 2021 03:01:02 +0200 Subject: [PATCH] store untagged modifier in derived function object --- src/core/derv.c | 76 ++++++++++++++++++++++++------------------------- src/core/derv.h | 16 +++++------ src/rtwrap.c | 36 +++++++++++------------ src/vm.c | 30 +++++++++---------- 4 files changed, 76 insertions(+), 82 deletions(-) diff --git a/src/core/derv.c b/src/core/derv.c index 2caf2f69..569a7ff8 100644 --- a/src/core/derv.c +++ b/src/core/derv.c @@ -2,28 +2,28 @@ #include "../nfns.h" #include "../builtins.h" -DEF_FREE(md1D) { dec(((Md1D*)x)->m1); dec(((Md1D*)x)->f); } -DEF_FREE(md2D) { dec(((Md2D*)x)->m2); dec(((Md2D*)x)->f); dec(((Md2D*)x)->g); } -DEF_FREE(md2H) { dec(((Md2H*)x)->m2); dec(((Md2H*)x)->g); } -DEF_FREE(fork) { dec(((Fork*)x)->f ); dec(((Fork*)x)->g); dec(((Fork*)x)->h); } -DEF_FREE(atop) { dec(((Atop*)x)->g); dec(((Atop*)x)->h); } +DEF_FREE(md1D) { ptr_dec(((Md1D*)x)->m1); dec(((Md1D*)x)->f); } +DEF_FREE(md2D) { ptr_dec(((Md2D*)x)->m2); dec(((Md2D*)x)->f); dec(((Md2D*)x)->g); } +DEF_FREE(md2H) { ptr_dec(((Md2H*)x)->m2); dec(((Md2H*)x)->g); } +DEF_FREE(fork) { dec(((Fork*)x)->f ); dec(((Fork*)x)->g); dec(((Fork*)x)->h); } +DEF_FREE(atop) { dec(((Atop*)x)->g); dec(((Atop*)x)->h); } -static void md1D_visit(Value* x) { mm_visit(((Md1D*)x)->m1); mm_visit(((Md1D*)x)->f); } -static void md2D_visit(Value* x) { mm_visit(((Md2D*)x)->m2); mm_visit(((Md2D*)x)->f); mm_visit(((Md2D*)x)->g); } -static void md2H_visit(Value* x) { mm_visit(((Md2H*)x)->m2); mm_visit(((Md2H*)x)->g); } -static void fork_visit(Value* x) { mm_visit(((Fork*)x)->f ); mm_visit(((Fork*)x)->g); mm_visit(((Fork*)x)->h); } -static void atop_visit(Value* x) { mm_visit(((Atop*)x)->g); mm_visit(((Atop*)x)->h); } +static void md1D_visit(Value* x) { mm_visitP(((Md1D*)x)->m1); mm_visit(((Md1D*)x)->f); } +static void md2D_visit(Value* x) { mm_visitP(((Md2D*)x)->m2); mm_visit(((Md2D*)x)->f); mm_visit(((Md2D*)x)->g); } +static void md2H_visit(Value* x) { mm_visitP(((Md2H*)x)->m2); mm_visit(((Md2H*)x)->g); } +static void fork_visit(Value* x) { mm_visit (((Fork*)x)->f ); mm_visit(((Fork*)x)->g); mm_visit(((Fork*)x)->h); } +static void atop_visit(Value* x) { mm_visit(((Atop*)x)->g); mm_visit(((Atop*)x)->h); } -static void md1D_print(B x) { printf("(md1D ");print(c(Md1D,x)->f);printf(" ");print(c(Md1D,x)->m1); printf(")"); } -static void md2D_print(B x) { printf("(md2D ");print(c(Md2D,x)->f);printf(" ");print(c(Md2D,x)->m2);printf(" ");print(c(Md2D,x)->g);printf(")"); } -static void md2H_print(B x) { printf("(md2H "); print(c(Md2H,x)->m2);printf(" ");print(c(Md2H,x)->g);printf(")"); } -static void fork_print(B x) { printf("(fork ");print(c(Fork,x)->f);printf(" ");print(c(Fork,x)->g );printf(" ");print(c(Fork,x)->h);printf(")"); } -static void atop_print(B x) { printf("(atop "); print(c(Atop,x)->g );printf(" ");print(c(Atop,x)->h);printf(")"); } +static void md1D_print(B x) { printf("(md1D ");print(c(Md1D,x)->f);printf(" ");print(tag(c(Md1D,x)->m1,MD1_TAG)); printf(")"); } +static void md2D_print(B x) { printf("(md2D ");print(c(Md2D,x)->f);printf(" ");print(tag(c(Md2D,x)->m2,MD2_TAG));printf(" ");print(c(Md2D,x)->g);printf(")"); } +static void md2H_print(B x) { printf("(md2H "); print(tag(c(Md2H,x)->m2,MD2_TAG));printf(" ");print(c(Md2H,x)->g);printf(")"); } +static void fork_print(B x) { printf("(fork ");print(c(Fork,x)->f);printf(" ");print( c(Fork,x)->g );printf(" ");print(c(Fork,x)->h);printf(")"); } +static void atop_print(B x) { printf("(atop "); print( c(Atop,x)->g );printf(" ");print(c(Atop,x)->h);printf(")"); } -B md1D_c1(B t, B x) { Md1D* tc = c(Md1D, t); return c(Md1,tc->m1)->c1(tc, x); } -B md1D_c2(B t, B w, B x) { Md1D* tc = c(Md1D, t); return c(Md1,tc->m1)->c2(tc, w, x); } -B md2D_c1(B t, B x) { Md2D* tc = c(Md2D, t); return c(Md2,tc->m2)->c1(tc, x); } -B md2D_c2(B t, B w, B x) { Md2D* tc = c(Md2D, t); return c(Md2,tc->m2)->c2(tc, w, x); } +B md1D_c1(B t, B x) { Md1D* tc = c(Md1D, t); return ((Md1*)tc->m1)->c1(tc, x); } +B md1D_c2(B t, B w, B x) { Md1D* tc = c(Md1D, t); return ((Md1*)tc->m1)->c2(tc, w, x); } +B md2D_c1(B t, B x) { Md2D* tc = c(Md2D, t); return ((Md2*)tc->m2)->c1(tc, x); } +B md2D_c2(B t, B w, B x) { Md2D* tc = c(Md2D, t); return ((Md2*)tc->m2)->c2(tc, w, x); } B tr2D_c1(B t, B x) { return c1(c(Atop,t)->g, c1(c(Atop,t)->h, x)); } B tr2D_c2(B t, B w, B x) { return c1(c(Atop,t)->g, c2(c(Atop,t)->h, w, x)); } B fork_c1(B t, B x) { @@ -46,29 +46,28 @@ B fork_c2(B t, B w, B x) { return c2(c(Fork,t)->g, inc(f), c2(h,w,x)); } } -B md2H_c1(Md1D* m, B x) { Md2H* t=c(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=c(Md2H,m->m1); return md2D_c2(m_md2D(t->m2, m->f, t->g), w, x); } +B md2H_c1(Md1D* m, B x) { Md2H* t=(Md2H*) m->m1; return md2D_c1(m_md2D(tag(t->m2,MD2_TAG), m->f, t->g), x); } +B md2H_c2(Md1D* m, B w, B x) { Md2H* t=(Md2H*) m->m1; return md2D_c2(m_md2D(tag(t->m2,MD2_TAG), m->f, t->g), w, x); } -static B md1D_decompose(B x) { B r=m_hVec3(m_i32(4),inc(c(Md1D,x)->f),inc(c(Md1D,x)->m1) ); decR(x); return r; } -static B md2D_decompose(B x) { B r=m_hVec4(m_i32(5),inc(c(Md2D,x)->f),inc(c(Md2D,x)->m2), inc(c(Md2D,x)->g)); decR(x); return r; } -static B md2H_decompose(B x) { B r=m_hVec3(m_i32(6), inc(c(Md2H,x)->m2), 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) { - B m = c(Md2D, t)->m2; + Md2* m = c(Md2D, t)->m2; B f = c(Md2D, t)->f; B g = c(Md2D, t)->g; - if (v(t)->flags || !isMd2(m)) return def_fn_uc1(t, o, x); // flags check to not deconstruct builtins - return TI(m,m2_uc1)(m, o, f, g, x); + return TIv(m,m2_uc1)(tag(m,MD2_TAG), o, f, g, x); } static B toConstant(B x) { // doesn't consume x if (!isCallable(x)) return inc(x); if (v(x)->type == t_md1D) { Md1D* d = c(Md1D,x); - B m1 = d->m1; - if (v(m1)->type==t_md1BI && v(m1)->flags==n_const) return inc(d->f); + Md1* m1 = d->m1; + if (m1->type==t_md1BI && m1->flags==n_const) return inc(d->f); } return bi_N; } @@ -82,7 +81,7 @@ static B fork_uc1(B t, B o, B x) { B args[] = {g, o, f}; B tmp = m_nfn(ucwWrapDesc, tag(args, RAW_TAG)); B r = TI(h,fn_uc1)(h,tmp,x); - // f is consumed by the eventual ucwWrap call. this hopes that everything is nice and calls o only once, and within the under call, so any under interface must make they can't + // f is consumed by the eventual ucwWrap call. this hopes that everything is nice and calls o only once, and within the under call, so any under interface must make sure they can't dec(tmp); return r; } @@ -93,13 +92,12 @@ static B ucwWrap_c1(B t, B x) { return TI(g,fn_ucw)(g, args[1], args[2], x); } -// TODO (+ md2D_uc1 and probably more things in the future): remove flags checks when all builtins have at least native wrappers -static B md1D_im(B t, B x) { Md1D* d = c(Md1D,t); return isMd1(d->m1) && !d->flags? TI(d->m1,m1_im)(d, x) : def_fn_im(t, x); } -static B md1D_iw(B t, B w, B x) { Md1D* d = c(Md1D,t); return isMd1(d->m1) && !d->flags? TI(d->m1,m1_iw)(d, w, x) : def_fn_iw(t, w, x); } -static B md1D_ix(B t, B w, B x) { Md1D* d = c(Md1D,t); return isMd1(d->m1) && !d->flags? TI(d->m1,m1_ix)(d, w, x) : def_fn_ix(t, w, x); } -static B md2D_im(B t, B x) { Md2D* d = c(Md2D,t); return isMd2(d->m2) && !d->flags? TI(d->m2,m2_im)(d, x) : def_fn_im(t, x); } -static B md2D_iw(B t, B w, B x) { Md2D* d = c(Md2D,t); return isMd2(d->m2) && !d->flags? TI(d->m2,m2_iw)(d, w, x) : def_fn_iw(t, w, x); } -static B md2D_ix(B t, B w, B x) { Md2D* d = c(Md2D,t); return isMd2(d->m2) && !d->flags? TI(d->m2,m2_ix)(d, w, x) : def_fn_ix(t, w, x); } +static B md1D_im(B t, B x) { Md1D* d = c(Md1D,t); return TIv(d->m1,m1_im)(d, x); } +static B md1D_iw(B t, B w, B x) { Md1D* d = c(Md1D,t); return TIv(d->m1,m1_iw)(d, w, x); } +static B md1D_ix(B t, B w, B x) { Md1D* d = c(Md1D,t); return TIv(d->m1,m1_ix)(d, w, x); } +static B md2D_im(B t, B x) { Md2D* d = c(Md2D,t); return TIv(d->m2,m2_im)(d, x); } +static B md2D_iw(B t, B w, B x) { Md2D* d = c(Md2D,t); return TIv(d->m2,m2_iw)(d, w, x); } +static B md2D_ix(B t, B w, B x) { Md2D* d = c(Md2D,t); return TIv(d->m2,m2_ix)(d, w, x); } void derv_init() { diff --git a/src/core/derv.h b/src/core/derv.h index 0e32638f..0aeacf2c 100644 --- a/src/core/derv.h +++ b/src/core/derv.h @@ -2,17 +2,17 @@ struct Md1D { // F _md struct Fun; - B m1; + Md1* m1; B f; }; struct Md2D { // F _md_ G struct Fun; - B m2; + Md2* m2; B f, g; }; typedef struct Md2H { // _md_ G struct Md1; - B m2; + Md2* m2; B g; } Md2H; typedef struct Fork { @@ -35,11 +35,11 @@ B fork_c2(B t, B w, B x); B md2H_c1(Md1D* d, B x); B md2H_c2(Md1D* d, B w, B x); // consume all args -static B m_md1D(B m, B f ) { Md1D* r = mm_alloc(sizeof(Md1D), t_md1D); r->f = f; r->m1 = m; r->c1=md1D_c1; r->c2=md1D_c2; return tag(r,FUN_TAG); } -static B m_md2D(B m, B f, B g) { Md2D* r = mm_alloc(sizeof(Md2D), t_md2D); r->f = f; r->m2 = m; r->g = g; r->c1=md2D_c1; r->c2=md2D_c2; return tag(r,FUN_TAG); } -static B m_md2H(B m, B g) { Md2H* r = mm_alloc(sizeof(Md2H), t_md2H); r->m2 = m; r->g = g; r->c1=md2H_c1; r->c2=md2H_c2; return tag(r,MD1_TAG); } -static B m_fork(B f, B g, B h) { Fork* r = mm_alloc(sizeof(Fork), t_fork); r->f = f; r->g = g; r->h = h; r->c1=fork_c1; r->c2=fork_c2; return tag(r,FUN_TAG); } -static B m_atop( B g, B h) { Atop* r = mm_alloc(sizeof(Atop), t_atop); r->g = g; r->h = h; r->c1=tr2D_c1; r->c2=tr2D_c2; return tag(r,FUN_TAG); } +static B m_md1D(B m, B f ) { Md1D* r = mm_alloc(sizeof(Md1D), t_md1D); r->f = f; r->m1 = c(Md1,m); r->c1=md1D_c1; r->c2=md1D_c2; return tag(r,FUN_TAG); } +static B m_md2D(B m, B f, B g) { Md2D* r = mm_alloc(sizeof(Md2D), t_md2D); r->f = f; r->m2 = c(Md2,m); r->g = g; r->c1=md2D_c1; r->c2=md2D_c2; return tag(r,FUN_TAG); } +static B m_md2H(B m, B g) { Md2H* r = mm_alloc(sizeof(Md2H), t_md2H); r->m2 = c(Md2,m); r->g = g; r->c1=md2H_c1; r->c2=md2H_c2; return tag(r,MD1_TAG); } +static B m_fork(B f, B g, B h) { Fork* r = mm_alloc(sizeof(Fork), t_fork); r->f = f; r->g = g; r->h = h; r->c1=fork_c1; r->c2=fork_c2; return tag(r,FUN_TAG); } +static B m_atop( B g, B h) { Atop* r = mm_alloc(sizeof(Atop), t_atop); r->g = g; r->h = h; r->c1=tr2D_c1; r->c2=tr2D_c2; return tag(r,FUN_TAG); } // consume all args static B m1_d(B m, B f ) { if(isMd1(m)) return TI(m,m1_d)(m, f ); thrM("Interpreting non-1-modifier as 1-modifier"); } diff --git a/src/rtwrap.c b/src/rtwrap.c index 4e0a397d..86020b8f 100644 --- a/src/rtwrap.c +++ b/src/rtwrap.c @@ -113,60 +113,56 @@ struct WMd2 { WMd2* lastWM2; void wm2_visit(Value* x) { mm_visit(((WMd2*)x)->v); } -B wm1_c1(Md1D* d, B x) { B f = d->f; B t = d->m1; +B wm1_c1(Md1D* d, B x) { B f = d->f; WMd1* t = (WMd1*)d->m1; u64 pfwt=fwTotal; fwTotal = 0; - WMd1* c = c(WMd1,t); - B om = c->v; + B om = t->v; u64 s = nsTime(); B fn = m1_d(inc(om), inc(f)); B r = c1(fn, x); u64 e = nsTime(); dec(fn); - c->c1a++; - c->c1t+= e-s - fwTotal; + t->c1a++; + t->c1t+= e-s - fwTotal; fwTotal = pfwt + e-s + 30; return r; } -B wm1_c2(Md1D* d, B w, B x) { B f = d->f; B t = d->m1; +B wm1_c2(Md1D* d, B w, B x) { B f = d->f; WMd1* t = (WMd1*)d->m1; u64 pfwt=fwTotal; fwTotal = 0; - WMd1* c = c(WMd1,t); - B om = c->v; + B om = t->v; u64 s = nsTime(); B fn = m1_d(inc(om), inc(f)); B r = c2(fn, w, x); u64 e = nsTime(); dec(fn); - c->c2a++; - c->c2t+= e-s - fwTotal; + t->c2a++; + t->c2t+= e-s - fwTotal; fwTotal = pfwt + e-s + 30; return r; } -B wm2_c1(Md2D* d, B x) { B f = d->f; B g = d->g; B t = d->m2; +B wm2_c1(Md2D* d, B x) { B f = d->f; B g = d->g; WMd2* t = (WMd2*)d->m2; u64 pfwt=fwTotal; fwTotal = 0; - WMd1* c = c(WMd1,t); - B om = c->v; + B om = t->v; u64 s = nsTime(); B fn = m2_d(inc(om), inc(f), inc(g)); B r = c1(fn, x); u64 e = nsTime(); dec(fn); - c->c1a++; - c->c1t+= e-s - fwTotal; + t->c1a++; + t->c1t+= e-s - fwTotal; fwTotal = pfwt + e-s + 30; return r; } -B wm2_c2(Md2D* d, B w, B x) { B f = d->f; B g = d->g; B t = d->m2; +B wm2_c2(Md2D* d, B w, B x) { B f = d->f; B g = d->g; WMd2* t = (WMd2*)d->m2; u64 pfwt=fwTotal; fwTotal = 0; - WMd1* c = c(WMd1,t); - B om = c->v; + B om = t->v; u64 s = nsTime(); B fn = m2_d(inc(om), inc(f), inc(g)); B r = c2(fn, w, x); u64 e = nsTime(); dec(fn); - c->c2a++; - c->c2t+= e-s - fwTotal; + t->c2a++; + t->c2t+= e-s - fwTotal; fwTotal = pfwt + e-s + 30; return r; } diff --git a/src/vm.c b/src/vm.c index a29411c2..224a46ee 100644 --- a/src/vm.c +++ b/src/vm.c @@ -839,22 +839,22 @@ FORCE_INLINE B execBlock(Block* block, Body* body, Scope* psc, i32 ga, B* svar) return r; } -B funBl_c1(B t, B x) { FunBlock* b=c(FunBlock, t ); ptr_inc(b); return execBlock(b->bl, b->bl->bodies[0], b->sc, 3, (B[]){t, x, bi_N }); } -B funBl_c2(B t, B w, B x) { FunBlock* b=c(FunBlock, t ); ptr_inc(b); return execBlock(b->bl, b->bl->dyBody, b->sc, 3, (B[]){t, x, w }); } -B md1Bl_c1(Md1D* d, B x) { Md1Block* b=c(Md1Block, d->m1); ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, inc(d->m1), inc(d->f) }); } -B md1Bl_c2(Md1D* d, B w, B x) { Md1Block* b=c(Md1Block, d->m1); ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(d->m1), inc(d->f) }); } -B md2Bl_c1(Md2D* d, B x) { Md2Block* b=c(Md2Block, d->m2); ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, inc(d->m2), inc(d->f), inc(d->g)}); } -B md2Bl_c2(Md2D* d, B w, B x) { Md2Block* b=c(Md2Block, d->m2); ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(d->m2), inc(d->f), inc(d->g)}); } +B funBl_c1(B t, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->bodies[0], b->sc, 3, (B[]){t, x, bi_N }); } +B funBl_c2(B t, B w, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->dyBody, b->sc, 3, (B[]){t, x, w }); } +B md1Bl_c1(Md1D* d, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m1,MD1_TAG)), inc(d->f) }); } +B md1Bl_c2(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m1,MD1_TAG)), inc(d->f) }); } +B md2Bl_c1(Md2D* d, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); } +B md2Bl_c2(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); } -B funBl_im(B t, B x) { FunBlock* b=c(FunBlock, t ); ptr_inc(b); return execBlock(b->bl, b->bl->invMBody, b->sc, 3, (B[]){t, x, bi_N}); } -B funBl_iw(B t, B w, B x) { FunBlock* b=c(FunBlock, t ); ptr_inc(b); return execBlock(b->bl, b->bl->invWBody, b->sc, 3, (B[]){t, x, w }); } -B funBl_ix(B t, B w, B x) { FunBlock* b=c(FunBlock, t ); ptr_inc(b); return execBlock(b->bl, b->bl->invXBody, b->sc, 3, (B[]){t, x, w }); } -B md1Bl_im(Md1D* d, B x) { Md1Block* b=c(Md1Block, d->m1); ptr_inc(d); return execBlock(b->bl, b->bl->invMBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, inc(d->m1), inc(d->f)}); } -B md1Bl_iw(Md1D* d, B w, B x) { Md1Block* b=c(Md1Block, d->m1); ptr_inc(d); return execBlock(b->bl, b->bl->invWBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(d->m1), inc(d->f)}); } -B md1Bl_ix(Md1D* d, B w, B x) { Md1Block* b=c(Md1Block, d->m1); ptr_inc(d); return execBlock(b->bl, b->bl->invXBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(d->m1), inc(d->f)}); } -B md2Bl_im(Md2D* d, B x) { Md2Block* b=c(Md2Block, d->m2); ptr_inc(d); return execBlock(b->bl, b->bl->invMBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, inc(d->m2), inc(d->f), inc(d->g)}); } -B md2Bl_iw(Md2D* d, B w, B x) { Md2Block* b=c(Md2Block, d->m2); ptr_inc(d); return execBlock(b->bl, b->bl->invWBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(d->m2), inc(d->f), inc(d->g)}); } -B md2Bl_ix(Md2D* d, B w, B x) { Md2Block* b=c(Md2Block, d->m2); ptr_inc(d); return execBlock(b->bl, b->bl->invXBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(d->m2), inc(d->f), inc(d->g)}); } +B funBl_im(B t, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->invMBody, b->sc, 3, (B[]){t, x, bi_N}); } +B funBl_iw(B t, B w, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->invWBody, b->sc, 3, (B[]){t, x, w }); } +B funBl_ix(B t, B w, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->invXBody, b->sc, 3, (B[]){t, x, w }); } +B md1Bl_im(Md1D* d, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->invMBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m1,MD1_TAG)), inc(d->f)}); } +B md1Bl_iw(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->invWBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m1,MD1_TAG)), inc(d->f)}); } +B md1Bl_ix(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->invXBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m1,MD1_TAG)), inc(d->f)}); } +B md2Bl_im(Md2D* d, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->invMBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); } +B md2Bl_iw(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->invWBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); } +B md2Bl_ix(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->invXBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); } B md1Bl_d(B m, B f ) { Md1Block* c = c(Md1Block,m); Block* bl=c(Md1Block, m)->bl; return c->bl->imm? execBlock(bl, bl->bodies[0], c(Md1Block, m)->sc, 2, (B[]){m, f }) : m_md1D(m,f ); } B md2Bl_d(B m, B f, B g) { Md2Block* c = c(Md2Block,m); Block* bl=c(Md2Block, m)->bl; return c->bl->imm? execBlock(bl, bl->bodies[0], c(Md2Block, m)->sc, 3, (B[]){m, f, g}) : m_md2D(m,f,g); }