From 75c6e98612422251723f26c293dcf1f46556a14d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 23 Nov 2021 19:41:30 +0100 Subject: [PATCH] :art: Small fork improvment --- src/emit/emit.c | 3 +-- src/vm/vm.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 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() -- 2.43.0