MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaV_execute

Function luaV_execute

Source/Misc/lua/src/lua.c:15206–15595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15204
15205
15206void luaV_execute (lua_State *L, int nexeccalls) {
15207LClosure *cl;
15208StkId base;
15209TValue *k;
15210const Instruction *pc;
15211reentry: /* entry point */
15212lua_assert(isLua(L->ci));
15213pc = L->savedpc;
15214cl = &clvalue(L->ci->func)->l;
15215base = L->base;
15216k = cl->p->k;
15217/* main loop of interpreter */
15218for (;;) {
15219const Instruction i = *pc++;
15220StkId ra;
15221if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
15222(--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
15223traceexec(L, pc);
15224if (L->status == LUA_YIELD) { /* did hook yield? */
15225L->savedpc = pc - 1;
15226return;
15227}
15228base = L->base;
15229}
15230/* warning!! several calls may realloc the stack and invalidate `ra' */
15231ra = RA(i);
15232lua_assert(base == L->base && L->base == L->ci->base);
15233lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);
15234lua_assert(L->top == L->ci->top || luaG_checkopenop(i));
15235switch (GET_OPCODE(i)) {
15236case OP_MOVE: {
15237setobjs2s(L, ra, RB(i));
15238continue;
15239}
15240case OP_LOADK: {
15241setobj2s(L, ra, KBx(i));
15242continue;
15243}
15244case OP_LOADBOOL: {
15245setbvalue(ra, GETARG_B(i));
15246if (GETARG_C(i)) pc++; /* skip next instruction (if C) */
15247continue;
15248}
15249case OP_LOADNIL: {
15250TValue *rb = RB(i);
15251do {
15252setnilvalue(rb--);
15253} while (rb >= ra);
15254continue;
15255}
15256case OP_GETUPVAL: {
15257int b = GETARG_B(i);
15258setobj2s(L, ra, cl->upvals[b]->v);
15259continue;
15260}
15261case OP_GETGLOBAL: {
15262TValue g;
15263TValue *rb = KBx(i);

Callers 2

luaD_callFunction · 0.85
resumeFunction · 0.85

Calls 15

traceexecFunction · 0.85
luaG_checkopenopFunction · 0.85
luaV_gettableFunction · 0.85
luaV_settableFunction · 0.85
luaH_newFunction · 0.85
luaO_fb2intFunction · 0.85
ArithFunction · 0.85
luaH_getnFunction · 0.85
call_binTMFunction · 0.85
luaG_typeerrorFunction · 0.85
luaV_concatFunction · 0.85
luaV_lessthanFunction · 0.85

Tested by

no test coverage detected