Apply Lua.org patch

Lua can generate wrong code in functions with too many constants.

reported by Marco Schöpl on 17 Jul 2016. existed since 5.3.3.

Example:
    See http://lua-users.org/lists/lua-l/2016-07/msg00303.html.
This commit is contained in:
Gregory A Lundberg 2016-10-11 19:28:18 -05:00
parent ca883fe7bf
commit 82661505d1

View file

@ -1017,8 +1017,8 @@ static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) {
*/
static void codebinexpval (FuncState *fs, OpCode op,
expdesc *e1, expdesc *e2, int line) {
int rk1 = luaK_exp2RK(fs, e1); /* both operands are "RK" */
int rk2 = luaK_exp2RK(fs, e2);
int rk2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */
int rk1 = luaK_exp2RK(fs, e1);
freeexps(fs, e1, e2);
e1->u.info = luaK_codeABC(fs, op, 0, rk1, rk2); /* generate opcode */
e1->k = VRELOCABLE; /* all those operations are relocatable */