From f7dd6a13136622b7ba30f610102fdc0983dd8857 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 9 Sep 2018 20:35:37 +0200 Subject: [PATCH] - fix jump direction in EmitComparisonOpcode --- src/scripting/vm/jit.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/scripting/vm/jit.cpp b/src/scripting/vm/jit.cpp index c8ac4ea3c..7e564b26f 100644 --- a/src/scripting/vm/jit.cpp +++ b/src/scripting/vm/jit.cpp @@ -2812,16 +2812,18 @@ private: int i = (int)(ptrdiff_t)(pc - sfunc->Code); auto tmp = cc.newInt32(); - + cc.xor_(tmp, tmp); compFunc(tmp); bool check = static_cast(A & CMP_CHECK); - cc.test(tmp, tmp); - if (check) cc.je(labels[i + 2]); - else cc.jne(labels[i + 2]); + auto jmplabel = labels[i + 2 + JMPOFS(pc + 1)]; - cc.jmp(labels[i + 2 + JMPOFS(pc + 1)]); + cc.test(tmp, tmp); + if (check) cc.je(jmplabel); + else cc.jne(jmplabel); + + pc++; // This instruction uses two instruction slots - skip the next one } static int64_t ToMemAddress(const void *d)