new instruction OP_LOADKX (to replace OP_LOADK with extra argument)

This commit is contained in:
Roberto Ierusalimschy
2011-04-07 15:14:12 -03:00
parent a958b711f5
commit 427ee519db
6 changed files with 27 additions and 19 deletions

10
lcode.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lcode.c,v 2.50 2011/01/31 14:28:41 roberto Exp roberto $
** $Id: lcode.c,v 2.51 2011/02/01 18:03:10 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -242,11 +242,11 @@ static int codeextraarg (FuncState *fs, int a) {
}
int luaK_codeABxX (FuncState *fs, OpCode o, int reg, int k) {
if (k < MAXARG_Bx)
return luaK_codeABx(fs, o, reg, k + 1);
int luaK_codek (FuncState *fs, int reg, int k) {
if (k <= MAXARG_Bx)
return luaK_codeABx(fs, OP_LOADK, reg, k);
else {
int p = luaK_codeABx(fs, o, reg, 0);
int p = luaK_codeABx(fs, OP_LOADKX, reg, 0);
codeextraarg(fs, k);
return p;
}