From 553990b36329ae93af7af330036b01ab7fa26897 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 23 Jan 2021 12:37:08 +0100 Subject: [PATCH] :art: Optimize jumps to next pc --- src/vm/vm_code.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vm/vm_code.c b/src/vm/vm_code.c index d5ec5adf..30d38ff6 100644 --- a/src/vm/vm_code.c +++ b/src/vm/vm_code.c @@ -98,7 +98,10 @@ ANN static m_bit* tobytecode(MemPool p, const VM_Code code) { vector_add(&nop, i); continue; } - if(instr->opcode != eNoOp) + if(instr->opcode == eGoto && instr->m_val == i+1) { + instr->opcode = eNoOp; + vector_add(&nop, i); + } else if(instr->opcode != eNoOp) memcpy(data, instr, BYTECODE_SZ); else vector_add(&nop, i); -- 2.43.0