]> Nishi Git Mirror - gwion.git/commitdiff
:art: Fix spork member fptr
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Tue, 26 Nov 2019 19:18:20 +0000 (20:18 +0100)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Tue, 26 Nov 2019 19:18:20 +0000 (20:18 +0100)
src/emit/emit.c
src/lib/shred.c
src/vm/vm.c

index 4cd85609082be828d2d08a7274128c2295556c19..20b1f07894707a3096f1246b5b65a4998348df1d 100644 (file)
@@ -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);
index 9793382b39dac61b8fc0a13e3bcab0416f7588a3..a2c23124ccf5be0d8a3c06f8e687c4977e55ef80 100644 (file)
@@ -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);
index e29d7a02af9b109d99d515b9af2c7d9b5121e14b..e7feefbe1c8c7b84228f56ed6319bb8eda1d881b 100644 (file)
@@ -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