static void lll_setlist(lua_State* L, TValue* ra, int fields, int n) { Table* h = hvalue(ra); unsigned int last = fields + n; if (last > h->sizearray) luaH_resizearray(L, h, last); for (; n > 0; n--) { TValue* val = ra + n; luaH_setint(L, h, last--, val); luaC_barrierback(L, h, val); } }
void vm_OP_SETLIST(lua_State *L, int a, int b, int c) { TValue *base = L->base; TValue *ra = base + a; int last; Table *h; fixedstack(L); if (b == 0) { b = cast_int(L->top - ra) - 1; L->top = L->ci->top; } runtime_check(L, ttistable(ra)); h = hvalue(ra); last = ((c-1)*LFIELDS_PER_FLUSH) + b; if (last > h->sizearray) /* needs more space? */ luaH_resizearray(L, h, last); /* pre-alloc it at once */ for (; b > 0; b--) { TValue *val = ra+b; setobj2t(L, luaH_setnum(L, h, last--), val); luaC_barriert(L, h, val); } unfixedstack(L); }