Fix BC_UCLO/BC_JMP join optimization in Lua parser.

This commit is contained in:
Mike Pall 2015-01-05 23:39:37 +01:00
parent 4d9e8e245a
commit 999f57de83

View 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;
}