MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaV_execute

Function luaV_execute

other_src/lua/src/lvm.cpp:379–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377
378
379void luaV_execute (lua_State *L, int nexeccalls) {
380 LClosure *cl;
381 StkId base;
382 TValue *k;
383 const Instruction *pc;
384 reentry: /* entry point */
385 lua_assert(isLua(L->ci));
386 pc = L->savedpc;
387 cl = &clvalue(L->ci->func)->l;
388 base = L->base;
389 k = cl->p->k;
390 /* main loop of interpreter */
391 for (;;) {
392 const Instruction i = *pc++;
393 StkId ra;
394 if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
395 (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
396 traceexec(L, pc);
397 if (L->status == LUA_YIELD) { /* did hook yield? */
398 L->savedpc = pc - 1;
399 return;
400 }
401 base = L->base;
402 }
403 /* warning!! several calls may realloc the stack and invalidate `ra' */
404 ra = RA(i);
405 lua_assert(base == L->base && L->base == L->ci->base);
406 lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);
407 lua_assert(L->top == L->ci->top || luaG_checkopenop(i));
408 switch (GET_OPCODE(i)) {
409 case OP_MOVE: {
410 setobjs2s(L, ra, RB(i));
411 continue;
412 }
413 case OP_LOADK: {
414 setobj2s(L, ra, KBx(i));
415 continue;
416 }
417 case OP_LOADBOOL: {
418 setbvalue(ra, GETARG_B(i));
419 if (GETARG_C(i)) pc++; /* skip next instruction (if C) */
420 continue;
421 }
422 case OP_LOADNIL: {
423 TValue *rb = RB(i);
424 do {
425 setnilvalue(rb--);
426 } while (rb >= ra);
427 continue;
428 }
429 case OP_GETUPVAL: {
430 int b = GETARG_B(i);
431 setobj2s(L, ra, cl->upvals[b]->v);
432 continue;
433 }
434 case OP_GETGLOBAL: {
435 TValue g;
436 TValue *rb = KBx(i);

Callers 2

luaD_callFunction · 0.70
resumeFunction · 0.70

Calls 15

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

Tested by

no test coverage detected