issue #157 rename the array get/set op codes

pull/159/head
Dibyendu Majumdar 6 years ago
parent eec9a49414
commit 7041827d53

@ -232,13 +232,13 @@ OP_RAVI_MOVEAI, /* A B R(A) := R(B), check R(B) is array of int */
OP_RAVI_MOVEAF, /* A B R(A) := R(B), check R(B) is array of floats */
OP_RAVI_MOVETAB, /* A B R(A) := R(B), check R(B) is a table */
OP_RAVI_GETTABLE_AI,/* A B C R(A) := R(B)[RK(C)] where R(B) is array of integers and RK(C) is int */
OP_RAVI_GETTABLE_AF,/* A B C R(A) := R(B)[RK(C)] where R(B) is array of floats and RK(C) is int */
OP_RAVI_IARRAY_GET,/* A B C R(A) := R(B)[RK(C)] where R(B) is array of integers and RK(C) is int */
OP_RAVI_FARRAY_GET,/* A B C R(A) := R(B)[RK(C)] where R(B) is array of floats and RK(C) is int */
OP_RAVI_SETTABLE_AI,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints */
OP_RAVI_SETTABLE_AF,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats */
OP_RAVI_SETTABLE_AII,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
OP_RAVI_SETTABLE_AFF,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
OP_RAVI_IARRAY_SET,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints */
OP_RAVI_FARRAY_SET,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats */
OP_RAVI_IARRAY_SETI,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
OP_RAVI_FARRAY_SETF,/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
OP_RAVI_FORLOOP_IP,
OP_RAVI_FORLOOP_I1,

@ -1328,16 +1328,16 @@ class RaviCodeGenerator {
void emit_TFORLOOP(RaviFunctionDef *def, int A, int j, int pc);
void emit_GETTABLE_AF(RaviFunctionDef *def, int A, int B, int C,
void emit_FARRAY_GET(RaviFunctionDef *def, int A, int B, int C,
bool omitArrayGetRangeCheck, int pc);
void emit_GETTABLE_AI(RaviFunctionDef *def, int A, int B, int C,
void emit_IARRAY_GET(RaviFunctionDef *def, int A, int B, int C,
bool omitArrayGetRangeCheck, int pc);
void emit_SETTABLE_AF(RaviFunctionDef *def, int A, int B, int C,
void emit_FARRAY_SET(RaviFunctionDef *def, int A, int B, int C,
bool known_int, int pc);
void emit_SETTABLE_AI(RaviFunctionDef *def, int A, int B, int C,
void emit_IARRAY_SET(RaviFunctionDef *def, int A, int B, int C,
bool known_float, int pc);
void emit_MOVEAI(RaviFunctionDef *def, int A, int B, int pc);

@ -81,10 +81,10 @@ opcodes_coverage.MOVEI = 0
opcodes_coverage.MOVEF = 0
opcodes_coverage.MOVEAI = 0
opcodes_coverage.MOVEAF = 0
opcodes_coverage.GETTABLE_AI = 0
opcodes_coverage.GETTABLE_AF = 0
opcodes_coverage.SETTABLE_AI = 0
opcodes_coverage.SETTABLE_AF = 0
opcodes_coverage.IARRAY_GET = 0
opcodes_coverage.FARRAY_GET = 0
opcodes_coverage.IARRAY_SET = 0
opcodes_coverage.FARRAY_SET = 0
opcodes_coverage.FORLOOP_IP = 0
opcodes_coverage.FORLOOP_I1 = 0
opcodes_coverage.FORPREP_IP = 0
@ -93,8 +93,8 @@ opcodes_coverage.SETUPVALI = 0
opcodes_coverage.SETUPVALF = 0
opcodes_coverage.SETUPVALAI = 0
opcodes_coverage.SETUPVALAF = 0
opcodes_coverage.SETTABLE_AII = 0
opcodes_coverage.SETTABLE_AFF = 0
opcodes_coverage.IARRAY_SETI = 0
opcodes_coverage.FARRAY_SETF = 0
opcodes_coverage.BAND_II = 0
opcodes_coverage.BOR_II = 0
opcodes_coverage.BXOR_II = 0
@ -484,7 +484,7 @@ end
assert(x() == 55.0)
check(x, 'NEWARRAYF', 'LOADNIL', 'LOADFZ',
'LOADK', 'LOADK', 'LOADK', 'FORPREP_I1',
'SETTABLE_AF', 'GETTABLE_AF', 'ADDFF',
'FARRAY_SET', 'FARRAY_GET', 'ADDFF',
'FORLOOP_I1', 'RETURN', 'RETURN')
compile(x)
assert(x() == 55.0)

@ -83,10 +83,10 @@ opcodes_coverage.MOVEI = 0
opcodes_coverage.MOVEF = 0
opcodes_coverage.MOVEAI = 0
opcodes_coverage.MOVEAF = 0
opcodes_coverage.GETTABLE_AI = 0
opcodes_coverage.GETTABLE_AF = 0
opcodes_coverage.SETTABLE_AI = 0
opcodes_coverage.SETTABLE_AF = 0
opcodes_coverage.IARRAY_GET = 0
opcodes_coverage.FARRAY_GET = 0
opcodes_coverage.IARRAY_SET = 0
opcodes_coverage.FARRAY_SET = 0
opcodes_coverage.FORLOOP_IP = 0
opcodes_coverage.FORLOOP_I1 = 0
opcodes_coverage.FORPREP_IP = 0
@ -95,8 +95,8 @@ opcodes_coverage.SETUPVALI = 0
opcodes_coverage.SETUPVALF = 0
opcodes_coverage.SETUPVALAI = 0
opcodes_coverage.SETUPVALAF = 0
opcodes_coverage.SETTABLE_AII = 0
opcodes_coverage.SETTABLE_AFF = 0
opcodes_coverage.IARRAY_SETI = 0
opcodes_coverage.FARRAY_SETF = 0
opcodes_coverage.BAND_II = 0
opcodes_coverage.BOR_II = 0
opcodes_coverage.BXOR_II = 0

@ -610,10 +610,10 @@ Assignment statements have to be enhanced to perform similar type checks as for
/* table value set - if array access then use specialized versions */
if (var->ravi_type == RAVI_TARRAYFLT &&
var->u.ind.key_type == RAVI_TNUMINT)
op = OP_RAVI_SETTABLE_AF;
op = OP_RAVI_FARRAY_SET;
else if (var->ravi_type == RAVI_TARRAYINT &&
var->u.ind.key_type == RAVI_TNUMINT)
op = OP_RAVI_SETTABLE_AI;
op = OP_RAVI_IARRAY_SET;
}
int e = luaK_exp2RK(fs, ex);
luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);
@ -817,10 +817,10 @@ When expression reference indexed variables, i.e., tables, we need to emit speci
/* table access - set specialized op codes if array types are detected */
if (e->ravi_type == RAVI_TARRAYFLT &&
e->u.ind.key_type == RAVI_TNUMINT)
op = OP_RAVI_GETTABLE_AF;
op = OP_RAVI_FARRAY_GET;
else if (e->ravi_type == RAVI_TARRAYINT &&
e->u.ind.key_type == RAVI_TNUMINT)
op = OP_RAVI_GETTABLE_AI;
op = OP_RAVI_IARRAY_GET;
else
op = OP_GETTABLE;
if (e->ravi_type == RAVI_TARRAYFLT || e->ravi_type == RAVI_TARRAYINT)

@ -206,16 +206,16 @@ Note that if a Lua functions contains a bytecode that cannot be be JITed then th
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_MOVEAF | YES | R(A) := R(B), check R(B) is array of numbers |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_GETTABLE_AI | YES | R(A) := R(B)[RK(C)] where R(B) is array of |
| OP_RAVI_IARRAY_GET | YES | R(A) := R(B)[RK(C)] where R(B) is array of |
| | | integers and RK(C) is integer |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_GETTABLE_AF | YES | R(A) := R(B)[RK(C)] where R(B) is array of |
| OP_RAVI_FARRAY_GET | YES | R(A) := R(B)[RK(C)] where R(B) is array of |
| | | numbers and RK(C) is integer |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_SETTABLE_AI | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| OP_RAVI_IARRAY_SET | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| | | R(A) is array of integers, and RK(C) is an int |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_SETTABLE_AF | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| OP_RAVI_FARRAY_SET | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| | | R(A) is array of numbers, and RK(C) is a number |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_FORLOOP_IP | YES | R(A)+=R(A+2); |
@ -240,11 +240,11 @@ Note that if a Lua functions contains a bytecode that cannot be be JITed then th
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_SETUPVALAF | YES (1) | UpValue[B] := toarrayflt(R(A)) |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_SETTABLE_AII | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| OP_RAVI_IARRAY_SETI | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| | | R(A) is array of integers, and RK(C) is an int |
| | | No conversion as input is known to be int |
+-------------------------+----------+--------------------------------------------------+
| OP_RAVI_SETTABLE_AFF | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| OP_RAVI_FARRAY_SETF | YES | R(A)[RK(B)] := RK(C) where RK(B) is an integer |
| | | R(A) is array of numbers, and RK(C) is a number |
| | | No conversion as input is known to be float |
+-------------------------+----------+--------------------------------------------------+

@ -601,9 +601,9 @@ void luaK_dischargevars (FuncState *fs, expdesc *e) {
/* TODO we should do this for upvalues too */
/* table access - set specialized op codes if array types are detected */
if (e->ravi_type == RAVI_TARRAYFLT && e->u.ind.key_ravi_type == RAVI_TNUMINT)
op = OP_RAVI_GETTABLE_AF;
op = OP_RAVI_FARRAY_GET;
else if (e->ravi_type == RAVI_TARRAYINT && e->u.ind.key_ravi_type == RAVI_TNUMINT)
op = OP_RAVI_GETTABLE_AI;
op = OP_RAVI_IARRAY_GET;
/* Check that we have a short string constant */
else if (e->ravi_type == RAVI_TTABLE && e->u.ind.key_ravi_type == RAVI_TSTRING && isshortstr(fs, e->u.ind.idx))
op = OP_RAVI_GETTABLE_S;
@ -998,18 +998,18 @@ void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
var->u.ind.key_ravi_type == RAVI_TNUMINT) {
if (!(ex->ravi_type == RAVI_TNUMFLT || (ex->k == VINDEXED && ex->ravi_type == RAVI_TARRAYFLT)))
/* input value may need conversion */
op = OP_RAVI_SETTABLE_AF;
op = OP_RAVI_FARRAY_SET;
else
/* input value is known to be number */
op = OP_RAVI_SETTABLE_AFF;
op = OP_RAVI_FARRAY_SETF;
} else if (var->ravi_type == RAVI_TARRAYINT &&
var->u.ind.key_ravi_type == RAVI_TNUMINT) {
if (!(ex->ravi_type == RAVI_TNUMINT || (ex->k == VINDEXED && ex->ravi_type == RAVI_TARRAYINT)))
/* input value may need conversion */
op = OP_RAVI_SETTABLE_AI;
op = OP_RAVI_IARRAY_SET;
else
/* input value is known to be integer */
op = OP_RAVI_SETTABLE_AII;
op = OP_RAVI_IARRAY_SETI;
} else if (/* var->ravi_type == RAVI_TTABLE &&*/ var->u.ind.key_ravi_type == RAVI_TNUMINT) {
/* table with integer key */
op = OP_RAVI_SETTABLE_I;

@ -480,8 +480,8 @@ static const char *getobjname (Proto *p, int lastpc, int reg,
case OP_RAVI_GETTABLE_I:
case OP_RAVI_GETTABLE_S:
case OP_RAVI_GETFIELD:
case OP_RAVI_GETTABLE_AI:
case OP_RAVI_GETTABLE_AF:
case OP_RAVI_IARRAY_GET:
case OP_RAVI_FARRAY_GET:
case OP_GETTABUP:
case OP_RAVI_GETTABUP_SK:
case OP_GETTABLE: {

@ -120,13 +120,13 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
"MOVEAF", /* A B R(A) := R(B), check R(B) is array of floats */
"MOVETAB", /* A B R(A) := R(B), check R(B) is a table */
"GETTABLE_AI",/* A B C R(A) := R(B)[RK(C)] where R(B) is array of integers and RK(C) is int */
"GETTABLE_AF",/* A B C R(A) := R(B)[RK(C)] where R(B) is array of floats and RK(C) is int */
"IARRAY_GET",/* A B C R(A) := R(B)[RK(C)] where R(B) is array of integers and RK(C) is int */
"FARRAY_GET",/* A B C R(A) := R(B)[RK(C)] where R(B) is array of floats and RK(C) is int */
"SETTABLE_AI",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
"SETTABLE_AF",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
"SETTABLE_AII",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
"SETTABLE_AFF",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
"IARRAY_SET",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
"FARRAY_SET",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
"IARRAY_SETI",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
"FARRAY_SETF",/* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
"FORLOOP_IP",
"FORLOOP_I1",
@ -261,13 +261,13 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_RAVI_MOVEAF A B R(A) := R(B), check R(B) is array of floats */
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_RAVI_MOVETAB A B R(A) := R(B), check R(B) is a table */
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_GETTABLE_AI A B C R(A) := R(B)[RK(C)] where R(B) is array of integers and RK(C) is int */
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_GETTABLE_AF A B C R(A) := R(B)[RK(C)] where R(B) is array of floats and RK(C) is int */
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_IARRAY_GET A B C R(A) := R(B)[RK(C)] where R(B) is array of integers and RK(C) is int */
,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_FARRAY_GET A B C R(A) := R(B)[RK(C)] where R(B) is array of floats and RK(C) is int */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_SETTABLE_AI A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_SETTABLE_AF A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_SETTABLE_AII A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_SETTABLE_AFF A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_IARRAY_SET A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_FARRAY_SET A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_IARRAY_SETI A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of ints, and RK(C) is an int */
,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_FARRAY_SETF A B C R(A)[RK(B)] := RK(C) where RK(B) is an int, R(A) is array of floats, and RK(C) is an float */
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_RAVI_FORLOOP_IP */
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_RAVI_FORLOOP_I1 */
@ -468,8 +468,8 @@ static void PrintCode(const Proto* f)
case OP_GETTABLE:
case OP_RAVI_GETTABLE_I:
case OP_RAVI_GETTABLE_S:
case OP_RAVI_GETTABLE_AF:
case OP_RAVI_GETTABLE_AI:
case OP_RAVI_FARRAY_GET:
case OP_RAVI_IARRAY_GET:
case OP_SELF:
case OP_RAVI_GETFIELD:
case OP_RAVI_SELF_S:
@ -480,10 +480,10 @@ static void PrintCode(const Proto* f)
case OP_RAVI_SETTABLE_I:
case OP_RAVI_SETTABLE_S:
case OP_RAVI_SETFIELD:
case OP_RAVI_SETTABLE_AF:
case OP_RAVI_SETTABLE_AFF:
case OP_RAVI_SETTABLE_AI:
case OP_RAVI_SETTABLE_AII:
case OP_RAVI_FARRAY_SET:
case OP_RAVI_FARRAY_SETF:
case OP_RAVI_IARRAY_SET:
case OP_RAVI_IARRAY_SETI:
case OP_ADD:
case OP_RAVI_ADDFF:
case OP_RAVI_ADDFI:

@ -1222,12 +1222,12 @@ int luaV_execute (lua_State *L) {
&&vmlabel(OP_RAVI_MOVEAI),
&&vmlabel(OP_RAVI_MOVEAF),
&&vmlabel(OP_RAVI_MOVETAB),
&&vmlabel(OP_RAVI_GETTABLE_AI),
&&vmlabel(OP_RAVI_GETTABLE_AF),
&&vmlabel(OP_RAVI_SETTABLE_AI),
&&vmlabel(OP_RAVI_SETTABLE_AF),
&&vmlabel(OP_RAVI_SETTABLE_AII),
&&vmlabel(OP_RAVI_SETTABLE_AFF),
&&vmlabel(OP_RAVI_IARRAY_GET),
&&vmlabel(OP_RAVI_FARRAY_GET),
&&vmlabel(OP_RAVI_IARRAY_SET),
&&vmlabel(OP_RAVI_FARRAY_SET),
&&vmlabel(OP_RAVI_IARRAY_SETI),
&&vmlabel(OP_RAVI_FARRAY_SETF),
&&vmlabel(OP_RAVI_FORLOOP_IP),
&&vmlabel(OP_RAVI_FORLOOP_I1),
&&vmlabel(OP_RAVI_FORPREP_IP),
@ -2128,7 +2128,7 @@ int luaV_execute (lua_State *L) {
}
vmbreak;
}
vmcase(OP_RAVI_GETTABLE_AI) {
vmcase(OP_RAVI_IARRAY_GET) {
TValue *rb = RB(i);
TValue *rc = RKC(i);
lua_Integer idx = ivalue(rc);
@ -2136,7 +2136,7 @@ int luaV_execute (lua_State *L) {
raviH_get_int_inline(L, t, idx, ra);
vmbreak;
}
vmcase(OP_RAVI_GETTABLE_AF) {
vmcase(OP_RAVI_FARRAY_GET) {
TValue *rb = RB(i);
TValue *rc = RKC(i);
lua_Integer idx = ivalue(rc);
@ -2144,7 +2144,7 @@ int luaV_execute (lua_State *L) {
raviH_get_float_inline(L, t, idx, ra);
vmbreak;
}
vmcase(OP_RAVI_SETTABLE_AI) {
vmcase(OP_RAVI_IARRAY_SET) {
Table *t = hvalue(ra);
TValue *rb = RKB(i);
TValue *rc = RKC(i);
@ -2161,7 +2161,7 @@ int luaV_execute (lua_State *L) {
}
vmbreak;
}
vmcase(OP_RAVI_SETTABLE_AII) {
vmcase(OP_RAVI_IARRAY_SETI) {
Table *t = hvalue(ra);
TValue *rb = RKB(i);
TValue *rc = RKC(i);
@ -2169,7 +2169,7 @@ int luaV_execute (lua_State *L) {
raviH_set_int_inline(L, t, idx, ivalue(rc));
vmbreak;
}
vmcase(OP_RAVI_SETTABLE_AF) {
vmcase(OP_RAVI_FARRAY_SET) {
Table *t = hvalue(ra);
TValue *rb = RKB(i);
TValue *rc = RKC(i);
@ -2186,7 +2186,7 @@ int luaV_execute (lua_State *L) {
}
vmbreak;
}
vmcase(OP_RAVI_SETTABLE_AFF) {
vmcase(OP_RAVI_FARRAY_SETF) {
Table *t = hvalue(ra);
TValue *rb = RKB(i);
TValue *rc = RKC(i);

@ -628,8 +628,8 @@ bool raviJ_cancompile(Proto *p) {
case OP_RAVI_SETUPVALAF:
case OP_RAVI_SETUPVALT:
case OP_RAVI_GETTABLE_S:
case OP_RAVI_GETTABLE_AI:
case OP_RAVI_GETTABLE_AF:
case OP_RAVI_IARRAY_GET:
case OP_RAVI_FARRAY_GET:
case OP_RAVI_GETFIELD:
case OP_RAVI_GETTABLE_I:
case OP_GETTABLE:
@ -639,10 +639,10 @@ bool raviJ_cancompile(Proto *p) {
case OP_RAVI_SETFIELD:
case OP_RAVI_SETTABLE_S:
case OP_RAVI_SETTABLE_I:
case OP_RAVI_SETTABLE_AII:
case OP_RAVI_SETTABLE_AI:
case OP_RAVI_SETTABLE_AFF:
case OP_RAVI_SETTABLE_AF:
case OP_RAVI_IARRAY_SETI:
case OP_RAVI_IARRAY_SET:
case OP_RAVI_FARRAY_SETF:
case OP_RAVI_FARRAY_SET:
case OP_SETTABLE:
case OP_SETTABUP:
case OP_NEWTABLE:
@ -773,7 +773,7 @@ static void emit_reg_or_k(struct function *fn, const char *name, int regnum) {
}
}
static void emit_gettable_ai(struct function *fn, int A, int B, int C, bool omitArrayGetRangeCheck, int pc) {
static void emit_IARRAY_GET(struct function *fn, int A, int B, int C, bool omitArrayGetRangeCheck, int pc) {
(void)pc;
emit_reg(fn, "ra", A);
emit_reg(fn, "rb", B);
@ -795,7 +795,7 @@ static void emit_gettable_ai(struct function *fn, int A, int B, int C, bool omit
}
}
static void emit_gettable_af(struct function *fn, int A, int B, int C, bool omitArrayGetRangeCheck, int pc) {
static void emit_FARRAY_GET(struct function *fn, int A, int B, int C, bool omitArrayGetRangeCheck, int pc) {
(void)pc;
emit_reg(fn, "ra", A);
emit_reg(fn, "rb", B);
@ -817,7 +817,7 @@ static void emit_gettable_af(struct function *fn, int A, int B, int C, bool omit
}
}
static void emit_settable_aii(struct function *fn, int A, int B, int C, bool known_int, int pc) {
static void emit_IARRAY_SETI(struct function *fn, int A, int B, int C, bool known_int, int pc) {
(void)pc;
(void)known_int;
emit_reg(fn, "ra", A);
@ -833,7 +833,7 @@ static void emit_settable_aii(struct function *fn, int A, int B, int C, bool kno
membuff_add_string(&fn->body, "}\n");
}
static void emit_settable_ai(struct function *fn, int A, int B, int C, bool known_int, int pc) {
static void emit_IARRAY_SET(struct function *fn, int A, int B, int C, bool known_int, int pc) {
(void)pc;
(void)known_int;
emit_reg(fn, "ra", A);
@ -858,7 +858,7 @@ static void emit_settable_ai(struct function *fn, int A, int B, int C, bool know
membuff_add_string(&fn->body, "}\n");
}
static void emit_settable_aff(struct function *fn, int A, int B, int C, bool known_int, int pc) {
static void emit_FARRAY_SETF(struct function *fn, int A, int B, int C, bool known_int, int pc) {
(void)pc;
(void)known_int;
emit_reg(fn, "ra", A);
@ -874,7 +874,7 @@ static void emit_settable_aff(struct function *fn, int A, int B, int C, bool kno
membuff_add_string(&fn->body, "}\n");
}
static void emit_settable_af(struct function *fn, int A, int B, int C, bool known_int, int pc) {
static void emit_FARRAY_SET(struct function *fn, int A, int B, int C, bool known_int, int pc) {
(void)pc;
(void)known_int;
emit_reg(fn, "ra", A);
@ -1891,15 +1891,15 @@ bool raviJ_codegen(struct lua_State *L, struct Proto *p,
int C = GETARG_C(i);
emit_op_gettable(&fn, A, B, C, pc, op);
} break;
case OP_RAVI_GETTABLE_AI: {
case OP_RAVI_IARRAY_GET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_gettable_ai(&fn, A, B, C, options->omit_array_get_range_check, pc);
emit_IARRAY_GET(&fn, A, B, C, options->omit_array_get_range_check, pc);
} break;
case OP_RAVI_GETTABLE_AF: {
case OP_RAVI_FARRAY_GET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_gettable_af(&fn, A, B, C, options->omit_array_get_range_check, pc);
emit_FARRAY_GET(&fn, A, B, C, options->omit_array_get_range_check, pc);
} break;
case OP_RAVI_SETFIELD:
case OP_RAVI_SETTABLE_S:
@ -1909,25 +1909,25 @@ bool raviJ_codegen(struct lua_State *L, struct Proto *p,
int C = GETARG_C(i);
emit_op_settable(&fn, A, B, C, pc, op);
} break;
case OP_RAVI_SETTABLE_AII: {
case OP_RAVI_IARRAY_SETI: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_settable_aii(&fn, A, B, C, true, pc);
emit_IARRAY_SETI(&fn, A, B, C, true, pc);
} break;
case OP_RAVI_SETTABLE_AI: {
case OP_RAVI_IARRAY_SET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_settable_ai(&fn, A, B, C, true, pc);
emit_IARRAY_SET(&fn, A, B, C, true, pc);
} break;
case OP_RAVI_SETTABLE_AFF: {
case OP_RAVI_FARRAY_SETF: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_settable_aff(&fn, A, B, C, true, pc);
emit_FARRAY_SETF(&fn, A, B, C, true, pc);
} break;
case OP_RAVI_SETTABLE_AF: {
case OP_RAVI_FARRAY_SET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_settable_af(&fn, A, B, C, true, pc);
emit_FARRAY_SET(&fn, A, B, C, true, pc);
} break;
case OP_RAVI_GETTABUP_SK:
case OP_GETTABUP: {

@ -1682,27 +1682,27 @@ bool RaviCodeGenerator::compile(lua_State *L, Proto *p,
int C = GETARG_C(i);
emit_GETTABLE(def, A, B, C, pc);
} break;
case OP_RAVI_GETTABLE_AI: {
case OP_RAVI_IARRAY_GET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_GETTABLE_AI(def, A, B, C, omitArrayGetRangeCheck, pc);
emit_IARRAY_GET(def, A, B, C, omitArrayGetRangeCheck, pc);
} break;
case OP_RAVI_SETTABLE_AII:
case OP_RAVI_SETTABLE_AI: {
case OP_RAVI_IARRAY_SETI:
case OP_RAVI_IARRAY_SET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_SETTABLE_AI(def, A, B, C, op == OP_RAVI_SETTABLE_AII, pc);
emit_IARRAY_SET(def, A, B, C, op == OP_RAVI_IARRAY_SETI, pc);
} break;
case OP_RAVI_GETTABLE_AF: {
case OP_RAVI_FARRAY_GET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_GETTABLE_AF(def, A, B, C, omitArrayGetRangeCheck, pc);
emit_FARRAY_GET(def, A, B, C, omitArrayGetRangeCheck, pc);
} break;
case OP_RAVI_SETTABLE_AFF:
case OP_RAVI_SETTABLE_AF: {
case OP_RAVI_FARRAY_SETF:
case OP_RAVI_FARRAY_SET: {
int B = GETARG_B(i);
int C = GETARG_C(i);
emit_SETTABLE_AF(def, A, B, C, op == OP_RAVI_SETTABLE_AFF, pc);
emit_FARRAY_SET(def, A, B, C, op == OP_RAVI_FARRAY_SETF, pc);
} break;
case OP_RAVI_TOTAB: {
emit_TOARRAY(def, A, RAVI_TTABLE, "table expected", pc);

@ -472,7 +472,7 @@ void RaviCodeGenerator::emit_GETTABLE_S(RaviFunctionDef *def, int A, int B,
emit_common_GETTABLE_S(def, A, B, C, key);
}
void RaviCodeGenerator::emit_GETTABLE_AF(RaviFunctionDef *def, int A, int B,
void RaviCodeGenerator::emit_FARRAY_GET(RaviFunctionDef *def, int A, int B,
int C, bool omitArrayGetRangeCheck,
int pc) {
//#define raviH_get_float_inline(L, t, key, v)
@ -490,7 +490,7 @@ void RaviCodeGenerator::emit_GETTABLE_AF(RaviFunctionDef *def, int A, int B,
// Table *t = hvalue(rb);
// raviH_get_float_inline(L, t, idx, ra);
emit_debug_trace(def, OP_RAVI_GETTABLE_AF, pc);
emit_debug_trace(def, OP_RAVI_FARRAY_GET, pc);
emit_load_base(def);
llvm::Value *ra = emit_gep_register(def, A);
llvm::Value *rb = emit_gep_register(def, B);
@ -536,7 +536,7 @@ void RaviCodeGenerator::emit_GETTABLE_AF(RaviFunctionDef *def, int A, int B,
}
}
void RaviCodeGenerator::emit_GETTABLE_AI(RaviFunctionDef *def, int A, int B,
void RaviCodeGenerator::emit_IARRAY_GET(RaviFunctionDef *def, int A, int B,
int C, bool omitArrayGetRangeCheck,
int pc) {
//#define raviH_get_int_inline(L, t, key, v)
@ -554,7 +554,7 @@ void RaviCodeGenerator::emit_GETTABLE_AI(RaviFunctionDef *def, int A, int B,
// Table *t = hvalue(rb);
// raviH_get_int_inline(L, t, idx, ra);
emit_debug_trace(def, OP_RAVI_GETTABLE_AI, pc);
emit_debug_trace(def, OP_RAVI_IARRAY_GET, pc);
emit_load_base(def);
llvm::Value *ra = emit_gep_register(def, A);
llvm::Value *rb = emit_gep_register(def, B);
@ -601,7 +601,7 @@ void RaviCodeGenerator::emit_GETTABLE_AI(RaviFunctionDef *def, int A, int B,
}
}
void RaviCodeGenerator::emit_SETTABLE_AI(RaviFunctionDef *def, int A, int B,
void RaviCodeGenerator::emit_IARRAY_SET(RaviFunctionDef *def, int A, int B,
int C, bool known_int, int pc) {
//#define raviH_set_int_inline(L, t, key, value)
//{ unsigned ukey = (unsigned)((key));
@ -619,7 +619,7 @@ void RaviCodeGenerator::emit_SETTABLE_AI(RaviFunctionDef *def, int A, int B,
// lua_Integer value = ivalue(rc);
// raviH_set_int_inline(L, t, idx, value);
emit_debug_trace(def, known_int ? OP_RAVI_SETTABLE_AII : OP_RAVI_SETTABLE_AI,
emit_debug_trace(def, known_int ? OP_RAVI_IARRAY_SETI : OP_RAVI_IARRAY_SET,
pc);
emit_load_base(def);
llvm::Value *ra = emit_gep_register(def, A);
@ -661,7 +661,7 @@ void RaviCodeGenerator::emit_SETTABLE_AI(RaviFunctionDef *def, int A, int B,
def->builder->SetInsertPoint(end_block);
}
void RaviCodeGenerator::emit_SETTABLE_AF(RaviFunctionDef *def, int A, int B,
void RaviCodeGenerator::emit_FARRAY_SET(RaviFunctionDef *def, int A, int B,
int C, bool known_float, int pc) {
//#define raviH_set_float_inline(L, t, key, value)
//{ unsigned ukey = (unsigned)((key));
@ -684,7 +684,7 @@ void RaviCodeGenerator::emit_SETTABLE_AF(RaviFunctionDef *def, int A, int B,
//}
emit_debug_trace(
def, known_float ? OP_RAVI_SETTABLE_AFF : OP_RAVI_SETTABLE_AF, pc);
def, known_float ? OP_RAVI_FARRAY_SETF : OP_RAVI_FARRAY_SET, pc);
emit_load_base(def);
llvm::Value *ra = emit_gep_register(def, A);
llvm::Value *rb = emit_gep_register_or_constant(def, B);

@ -498,18 +498,18 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES + 1] =
"MOVEAF", /* A B R(A) := R(B), check R(B) is array of floats */
"MOVETAB", /* A B R(A) := R(B), check R(B) is a table */
"GETTABLE_AI", /* A B C R(A) := R(B)[RK(C)] where R(B) is array of
"IARRAY_GET", /* A B C R(A) := R(B)[RK(C)] where R(B) is array of
integers and RK(C) is int */
"GETTABLE_AF", /* A B C R(A) := R(B)[RK(C)] where R(B) is array of
"FARRAY_GET", /* A B C R(A) := R(B)[RK(C)] where R(B) is array of
floats and RK(C) is int */
"SETTABLE_AI", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
"IARRAY_SET", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
R(A) is array of ints, and RK(C) is an int */
"SETTABLE_AF", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
"FARRAY_SET", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
R(A) is array of floats, and RK(C) is an float */
"SETTABLE_AII", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
"IARRAY_SETI", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
R(A) is array of ints, and RK(C) is an int */
"SETTABLE_AFF", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
"FARRAY_SETF", /* A B C R(A)[RK(B)] := RK(C) where RK(B) is an int,
R(A) is array of floats, and RK(C) is an float */
"FORLOOP_IP",

Loading…
Cancel
Save