]> Nishi Git Mirror - gwion.git/commitdiff
:art: Optimize jumps to next pc
authorJérémie Astor <fennecdjay@gmail.com>
Sat, 23 Jan 2021 11:37:08 +0000 (12:37 +0100)
committerJérémie Astor <fennecdjay@gmail.com>
Sat, 23 Jan 2021 11:37:08 +0000 (12:37 +0100)
src/vm/vm_code.c

index d5ec5adfb32dde43aed070a4b61f3e162016c2ad..30d38ff60ecce4876d473179a8ac880d9d353c8c 100644 (file)
@@ -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);