MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaV_execute

Function luaV_execute

extlibs/lua/src/lvm.c:1127–1810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1125
1126
1127void luaV_execute (lua_State *L, CallInfo *ci) {
1128 LClosure *cl;
1129 TValue *k;
1130 StkId base;
1131 const Instruction *pc;
1132 int trap;
1133#if LUA_USE_JUMPTABLE
1134#include "ljumptab.h"
1135#endif
1136 tailcall:
1137 trap = L->hookmask;
1138 cl = clLvalue(s2v(ci->func));
1139 k = cl->p->k;
1140 pc = ci->u.l.savedpc;
1141 if (trap) {
1142 if (cl->p->is_vararg)
1143 trap = 0; /* hooks will start after VARARGPREP instruction */
1144 else if (pc == cl->p->code) /* first instruction (not resuming)? */
1145 luaD_hookcall(L, ci);
1146 ci->u.l.trap = 1; /* there may be other hooks */
1147 }
1148 base = ci->func + 1;
1149 /* main loop of interpreter */
1150 for (;;) {
1151 Instruction i; /* instruction being executed */
1152 StkId ra; /* instruction's A register */
1153 vmfetch();
1154 lua_assert(base == ci->func + 1);
1155 lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
1156 /* invalidate top for instructions not expecting it */
1157 lua_assert(isIT(i) || (cast_void(L->top = base), 1));
1158 vmdispatch (GET_OPCODE(i)) {
1159 vmcase(OP_MOVE) {
1160 setobjs2s(L, ra, RB(i));
1161 vmbreak;
1162 }
1163 vmcase(OP_LOADI) {
1164 lua_Integer b = GETARG_sBx(i);
1165 setivalue(s2v(ra), b);
1166 vmbreak;
1167 }
1168 vmcase(OP_LOADF) {
1169 int b = GETARG_sBx(i);
1170 setfltvalue(s2v(ra), cast_num(b));
1171 vmbreak;
1172 }
1173 vmcase(OP_LOADK) {
1174 TValue *rb = k + GETARG_Bx(i);
1175 setobj2s(L, ra, rb);
1176 vmbreak;
1177 }
1178 vmcase(OP_LOADKX) {
1179 TValue *rb;
1180 rb = k + GETARG_Ax(*pc); pc++;
1181 setobj2s(L, ra, rb);
1182 vmbreak;
1183 }
1184 vmcase(OP_LOADFALSE) {

Callers 3

luaD_callFunction · 0.85
unrollFunction · 0.85
resumeFunction · 0.85

Calls 15

luaD_hookcallFunction · 0.85
luaV_finishgetFunction · 0.85
luaV_finishsetFunction · 0.85
luaH_newFunction · 0.85
luaH_resizeFunction · 0.85
luaV_shiftlFunction · 0.85
luaT_trybinTMFunction · 0.85
luaT_trybiniTMFunction · 0.85
luaT_trybinassocTMFunction · 0.85
luaV_objlenFunction · 0.85
luaV_concatFunction · 0.85
luaF_closeFunction · 0.85

Tested by

no test coverage detected