refactoring via XmiliaH

pull/216/head
Dibyendu Majumdar 3 years ago
parent cb6943a1eb
commit 4a20693671

@ -600,19 +600,21 @@ void luaK_dischargevars (FuncState *fs, expdesc *e) {
freereg(fs, e->u.ind.t); freereg(fs, e->u.ind.t);
/* TODO we should do this for upvalues too */ /* TODO we should do this for upvalues too */
/* table access - set specialized op codes if array types are detected */ /* 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) if (e->u.ind.key_ravi_type == RAVI_TNUMINT) {
op = OP_RAVI_FARRAY_GET; if (e->ravi_type == RAVI_TARRAYFLT)
else if (e->ravi_type == RAVI_TARRAYINT && e->u.ind.key_ravi_type == RAVI_TNUMINT) op = OP_RAVI_FARRAY_GET;
op = OP_RAVI_IARRAY_GET; else if (e->ravi_type == RAVI_TARRAYINT)
op = OP_RAVI_IARRAY_GET;
else
op = OP_RAVI_GETI;
}
/* Check that we have a short string constant */ /* 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)) else if (e->u.ind.key_ravi_type == RAVI_TSTRING && isshortstr(fs, e->u.ind.idx)) {
op = OP_RAVI_TABLE_GETFIELD; op = e->ravi_type == RAVI_TTABLE ? OP_RAVI_TABLE_GETFIELD : OP_RAVI_GETFIELD;
else if (e->u.ind.key_ravi_type == RAVI_TNUMINT) }
op = OP_RAVI_GETI; else {
else if (e->u.ind.key_ravi_type == RAVI_TSTRING && isshortstr(fs, e->u.ind.idx))
op = OP_RAVI_GETFIELD;
else
op = OP_GETTABLE; op = OP_GETTABLE;
}
} }
else { else {
lua_assert(e->u.ind.vt == VUPVAL); lua_assert(e->u.ind.vt == VUPVAL);

Loading…
Cancel
Save