]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix BC_UCLO/BC_JMP join optimization in Lua parser.
authorMike Pall <mike>
Mon, 5 Jan 2015 22:39:37 +0000 (23:39 +0100)
committerMike Pall <mike>
Mon, 5 Jan 2015 22:39:37 +0000 (23:39 +0100)
src/lj_parse.c

index e8aafba20819b8f26247e6ff073da87af52d3ff3..5ced1dd8166ae0625864af66f4fc4c17599f4f8e 100644 (file)
@@ -685,10 +685,12 @@ static BCPos bcemit_jmp(FuncState *fs)
   BCPos j = fs->pc - 1;
   BCIns *ip = &fs->bcbase[j].ins;
   fs->jpc = NO_JMP;
-  if ((int32_t)j >= (int32_t)fs->lasttarget && bc_op(*ip) == BC_UCLO)
+  if ((int32_t)j >= (int32_t)fs->lasttarget && bc_op(*ip) == BC_UCLO) {
     setbc_j(ip, NO_JMP);
-  else
+    fs->lasttarget = j+1;
+  } else {
     j = bcemit_AJ(fs, BC_JMP, fs->freereg, NO_JMP);
+  }
   jmp_append(fs, &j, jpc);
   return j;
 }