]> Nishi Git Mirror - gwion.git/commitdiff
:art: Small fork improvment
authorJérémie Astor <fennecdjay@gmail.com>
Tue, 23 Nov 2021 18:41:30 +0000 (19:41 +0100)
committerJérémie Astor <fennecdjay@gmail.com>
Tue, 23 Nov 2021 18:41:30 +0000 (19:41 +0100)
src/emit/emit.c
src/vm/vm.c

index 2758ac5bdcc00fee3a21800cdcb008bdbeb25aee..4726224df873508c28b9271407609e8c8f5c66f1 100644 (file)
@@ -1860,12 +1860,11 @@ ANN static void spork_ini(const Emitter emit, const struct Sporker *sp) {
   if (sp->is_spork) {
     const Instr instr = emit_add_instr(emit, SporkIni);
     instr->m_val      = (m_uint)sp->vm_code;
-    instr->m_val2     = sp->is_spork;
     return;
   }
-  regpushi(emit, (m_uint)sp->type);
   const Instr instr = emit_add_instr(emit, ForkIni);
   instr->m_val      = (m_uint)sp->vm_code;
+  instr->m_val2 = (m_uint)sp->type;
 }
 
 ANN m_bool emit_exp_spork(const Emitter emit, const Exp_Unary *unary) {
index 8bb3f6bd3f2e3ad5f8532dc404e8906ebd907dab..738d9ca31b866a691f81ff5dcd1dce750245b9e3 100644 (file)
@@ -969,8 +969,7 @@ vm_run(const VM *vm) { // lgtm [cpp/use-of-goto]
       child = init_spork_shred(shred, (VM_Code)VAL);
       DISPATCH()
     forkini:
-      reg -= SZ_INT;
-      child = init_fork_shred(shred, (VM_Code)VAL, *(Type *)reg),
+      child = init_fork_shred(shred, (VM_Code)VAL, (Type)VAL2);
       DISPATCH()
     sporkfunc:
       PRAGMA_PUSH()