From: Jérémie Astor Date: Tue, 26 Nov 2019 19:18:20 +0000 (+0100) Subject: :art: Fix spork member fptr X-Git-Tag: nightly~2076^2~2 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=cc98a3cdb5ee0dc94301cb4bf894111a95ec934f;p=gwion.git :art: Fix spork member fptr --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 4cd85609..20b1f078 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1150,8 +1150,7 @@ ANN Instr emit_exp_spork(const Emitter emit, const Exp_Unary* unary) { const m_uint depth = f->def->stack_depth; regpop(emit, depth -SZ_INT); const Instr spork = emit_add_instr(emit, SporkMemberFptr); - spork->m_val = depth + SZ_INT; - spork->m_val2 = -SZ_INT*2; + spork->m_val = depth; } else emit_exp_spork_finish(emit, f->def->stack_depth); const Instr end = emit_add_instr(emit, is_spork ? SporkEnd : ForkEnd); diff --git a/src/lib/shred.c b/src/lib/shred.c index 9793382b..a2c23124 100644 --- a/src/lib/shred.c +++ b/src/lib/shred.c @@ -62,10 +62,7 @@ static MFUN(vm_shred_is_done) { static MFUN(shred_yield) { const VM_Shred s = ME(o); const Shreduler sh = s->tick->shreduler; - if(vector_size(shred->code->instr) - shred->pc > 1) - shredule(sh, s, GWION_EPSILON); - else - vm_shred_exit(shred); + shredule(sh, s, GWION_EPSILON); } static SFUN(vm_shred_from_id) { @@ -326,7 +323,7 @@ GWION_IMPORT(shred) { GWI_BB(gwi_union_add(gwi, "Vec4", "w")) GWI_BB(gwi_union_add(gwi, "VarObject", "o")) GWI_OB(gwi_union_end(gwi, ae_flag_const)) - gwi_func_ini(gwi, "int", "join"); + gwi_func_ini(gwi, "void", "join"); GWI_BB(gwi_func_end(gwi, fork_join, ae_flag_none)) GWI_BB(gwi_class_end(gwi)) SET_FLAG((t_fork), abstract); diff --git a/src/vm/vm.c b/src/vm/vm.c index e29d7a02..e7feefbe 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -640,11 +640,11 @@ PRAGMA_PUSH() DISPATCH() PRAGMA_POP() sporkmemberfptr: - for(m_uint i = 0; i < VAL-SZ_INT; i+= SZ_INT) - *(m_uint*)(a.child->reg + i) = *(m_uint*)(reg + i + (m_int)VAL2+SZ_INT); - *(m_uint*)(a.child->reg+VAL-SZ_INT) = *(m_uint*)(reg+SZ_INT); - *(m_uint*)(a.child->reg+VAL-SZ_INT*2) = *(m_uint*)(reg-SZ_INT*2); - a.child->reg += VAL; + for(m_uint i = 0; i < VAL; i+= SZ_INT) + *(m_uint*)(a.child->reg + i) = *(m_uint*)(reg - VAL + i); + *(m_uint*)(a.child->reg + VAL) = *(m_uint*)(reg - SZ_INT*2); + *(m_uint*)(a.child->reg + VAL + SZ_INT) = *(m_uint*)(reg + VAL - SZ_INT*2); + a.child->reg += VAL + SZ_INT*2; DISPATCH() sporkexp: // LOOP_OPTIM