From: Jérémie Astor Date: Tue, 23 Nov 2021 18:41:30 +0000 (+0100) Subject: :art: Small fork improvment X-Git-Tag: nightly~398 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=75c6e98612422251723f26c293dcf1f46556a14d;p=gwion.git :art: Small fork improvment --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 2758ac5b..4726224d 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -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) { diff --git a/src/vm/vm.c b/src/vm/vm.c index 8bb3f6bd..738d9ca3 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -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()