Bug Summary

File:game/lua/lvm.cpp
Location:line 677, column 9
Description:Dereference of null pointer

Annotated Source Code

1/*
2** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $
3** Lua virtual machine
4** See Copyright Notice in lua.h
5*/
6
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11
12#define lvm_c
13#define LUA_CORE
14
15#include "lua.h"
16
17#include "ldebug.h"
18#include "ldo.h"
19#include "lfunc.h"
20#include "lgc.h"
21#include "lobject.h"
22#include "lopcodes.h"
23#include "lstate.h"
24#include "lstring.h"
25#include "ltable.h"
26#include "ltm.h"
27#include "lvm.h"
28
29
30
31/* limit for table tag-method chains (to avoid loops) */
32#define MAXTAGLOOP100 100
33
34
35const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
36 lua_Number num;
37 if (ttisnumber(obj)(((obj)->tt) == 3)) return obj;
38 if (ttisstring(obj)(((obj)->tt) == 4) && luaO_str2d(svalue(obj)((const char *)(((&(obj)->value.gc->ts)) + 1)), &num)) {
39 setnvalue(n, num){ TValue *i_o=(n); i_o->value.n=(num); i_o->tt=3; };
40 return n;
41 }
42 else
43 return NULL__null;
44}
45
46
47int luaV_tostring (lua_State *L, StkId obj) {
48 if (!ttisnumber(obj)(((obj)->tt) == 3))
49 return 0;
50 else {
51 char s[LUAI_MAXNUMBER2STR32];
52 lua_Number n = nvalue(obj)((obj)->value.n);
53 lua_number2str(s, n)sprintf((s), "%.14g", (n));
54 setsvalue2s(L, obj, luaS_new(L, s)){ TValue *i_o=(obj); i_o->value.gc=((GCObject *)(((luaS_newlstr
(L, s, strlen(s)))))); i_o->tt=4; ((void)0); }
;
55 return 1;
56 }
57}
58
59
60static void traceexec (lua_State *L, const Instruction *pc) {
61 lu_byte mask = L->hookmask;
62 const Instruction *oldpc = L->savedpc;
63 L->savedpc = pc;
64 if ((mask & LUA_MASKCOUNT(1 << 3)) && L->hookcount == 0) {
65 resethookcount(L)(L->hookcount = L->basehookcount);
66 luaD_callhook(L, LUA_HOOKCOUNT3, -1);
67 }
68 if (mask & LUA_MASKLINE(1 << 2)) {
69 Proto *p = ci_func(L->ci)((&((L->ci)->func)->value.gc->cl))->l.p;
70 int npc = pcRel(pc, p)(((int)((pc) - (p)->code)) - 1);
71 int newline = getline(p, npc)(((p)->lineinfo) ? (p)->lineinfo[npc] : 0);
72 /* call linehook when enter a new function, when jump back (loop),
73 or when enter a new line */
74 if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))(((p)->lineinfo) ? (p)->lineinfo[(((int)((oldpc) - (p)->
code)) - 1)] : 0)
)
75 luaD_callhook(L, LUA_HOOKLINE2, newline);
76 }
77}
78
79
80static void callTMres (lua_State *L, StkId res, const TValue *f,
81 const TValue *p1, const TValue *p2) {
82 ptrdiff_t result = savestack(L, res)((char *)(res) - (char *)L->stack);
83 setobj2s(L, L->top, f){ const TValue *o2=(f); TValue *o1=(L->top); o1->value =
o2->value; o1->tt=o2->tt; ((void)0); }
; /* push function */
84 setobj2s(L, L->top+1, p1){ const TValue *o2=(p1); TValue *o1=(L->top+1); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
; /* 1st argument */
85 setobj2s(L, L->top+2, p2){ const TValue *o2=(p2); TValue *o1=(L->top+2); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
; /* 2nd argument */
86 luaD_checkstack(L, 3)if ((char *)L->stack_last - (char *)L->top <= (3)*(int
)sizeof(TValue)) luaD_growstack(L, 3); else ((void)0);
;
87 L->top += 3;
88 luaD_call(L, L->top - 3, 1);
89 res = restorestack(L, result)((TValue *)((char *)L->stack + (result)));
90 L->top--;
91 setobjs2s(L, res, L->top){ const TValue *o2=(L->top); TValue *o1=(res); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
;
92}
93
94
95
96static void callTM (lua_State *L, const TValue *f, const TValue *p1,
97 const TValue *p2, const TValue *p3) {
98 setobj2s(L, L->top, f){ const TValue *o2=(f); TValue *o1=(L->top); o1->value =
o2->value; o1->tt=o2->tt; ((void)0); }
; /* push function */
99 setobj2s(L, L->top+1, p1){ const TValue *o2=(p1); TValue *o1=(L->top+1); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
; /* 1st argument */
100 setobj2s(L, L->top+2, p2){ const TValue *o2=(p2); TValue *o1=(L->top+2); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
; /* 2nd argument */
101 setobj2s(L, L->top+3, p3){ const TValue *o2=(p3); TValue *o1=(L->top+3); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
; /* 3th argument */
102 luaD_checkstack(L, 4)if ((char *)L->stack_last - (char *)L->top <= (4)*(int
)sizeof(TValue)) luaD_growstack(L, 4); else ((void)0);
;
103 L->top += 4;
104 luaD_call(L, L->top - 4, 0);
105}
106
107
108void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
109 int loop;
110 for (loop = 0; loop < MAXTAGLOOP100; loop++) {
111 const TValue *tm;
112 if (ttistable(t)(((t)->tt) == 5)) { /* `t' is a table? */
113 Table *h = hvalue(t)(&(t)->value.gc->h);
114 const TValue *res = luaH_get(h, key); /* do a primitive get */
115 if (!ttisnil(res)(((res)->tt) == 0) || /* result is no nil? */
116 (tm = fasttm(L, h->metatable, TM_INDEX)((h->metatable) == __null ? __null : ((h->metatable)->
flags & (1u<<(TM_INDEX))) ? __null : luaT_gettm(h->
metatable, TM_INDEX, ((L->l_G))->tmname[TM_INDEX]))
) == NULL__null) { /* or no TM? */
117 setobj2s(L, val, res){ const TValue *o2=(res); TValue *o1=(val); o1->value = o2
->value; o1->tt=o2->tt; ((void)0); }
;
118 return;
119 }
120 /* else will try the tag method */
121 }
122 else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))(((tm = luaT_gettmbyobj(L, t, TM_INDEX))->tt) == 0))
123 luaG_typeerror(L, t, "index");
124 if (ttisfunction(tm)(((tm)->tt) == 6)) {
125 callTMres(L, val, tm, t, key);
126 return;
127 }
128 t = tm; /* else repeat with `tm' */
129 }
130 luaG_runerror(L, "loop in gettable");
131}
132
133
134void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
135 int loop;
136 TValue temp;
137 for (loop = 0; loop < MAXTAGLOOP100; loop++) {
138 const TValue *tm;
139 if (ttistable(t)(((t)->tt) == 5)) { /* `t' is a table? */
140 Table *h = hvalue(t)(&(t)->value.gc->h);
141 TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
142 if (!ttisnil(oldval)(((oldval)->tt) == 0) || /* result is no nil? */
143 (tm = fasttm(L, h->metatable, TM_NEWINDEX)((h->metatable) == __null ? __null : ((h->metatable)->
flags & (1u<<(TM_NEWINDEX))) ? __null : luaT_gettm(
h->metatable, TM_NEWINDEX, ((L->l_G))->tmname[TM_NEWINDEX
]))
) == NULL__null) { /* or no TM? */
144 setobj2t(L, oldval, val){ const TValue *o2=(val); TValue *o1=(oldval); o1->value =
o2->value; o1->tt=o2->tt; ((void)0); }
;
145 luaC_barriert(L, h, val){ if (((((val)->tt) >= 4) && (((((val)->value
.gc))->gch.marked) & ((((1<<(0)) | (1<<(1)
)))))) && ((((((GCObject *)((h)))))->gch.marked) &
((1<<(2))))) luaC_barrierback(L,h); }
;
146 return;
147 }
148 /* else will try the tag method */
149 }
150 else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))(((tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))->tt) == 0))
151 luaG_typeerror(L, t, "index");
152 if (ttisfunction(tm)(((tm)->tt) == 6)) {
153 callTM(L, tm, t, key, val);
154 return;
155 }
156 /* else repeat with `tm' */
157 setobj(L, &temp, tm){ const TValue *o2=(tm); TValue *o1=(&temp); o1->value
= o2->value; o1->tt=o2->tt; ((void)0); }
; /* avoid pointing inside table (may rehash) */
158 t = &temp;
159 t = tm;
160 }
161 luaG_runerror(L, "loop in settable");
162}
163
164
165static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
166 StkId res, TMS event) {
167 const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */
168 if (ttisnil(tm)(((tm)->tt) == 0))
169 tm = luaT_gettmbyobj(L, p2, event); /* try second operand */
170 if (ttisnil(tm)(((tm)->tt) == 0)) return 0;
171 callTMres(L, res, tm, p1, p2);
172 return 1;
173}
174
175
176static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,
177 TMS event) {
178 const TValue *tm1 = fasttm(L, mt1, event)((mt1) == __null ? __null : ((mt1)->flags & (1u<<
(event))) ? __null : luaT_gettm(mt1, event, ((L->l_G))->
tmname[event]))
;
179 const TValue *tm2;
180 if (tm1 == NULL__null) return NULL__null; /* no metamethod */
181 if (mt1 == mt2) return tm1; /* same metatables => same metamethods */
182 tm2 = fasttm(L, mt2, event)((mt2) == __null ? __null : ((mt2)->flags & (1u<<
(event))) ? __null : luaT_gettm(mt2, event, ((L->l_G))->
tmname[event]))
;
183 if (tm2 == NULL__null) return NULL__null; /* no metamethod */
184 if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */
185 return tm1;
186 return NULL__null;
187}
188
189
190static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
191 TMS event) {
192 const TValue *tm1 = luaT_gettmbyobj(L, p1, event);
193 const TValue *tm2;
194 if (ttisnil(tm1)(((tm1)->tt) == 0)) return -1; /* no metamethod? */
195 tm2 = luaT_gettmbyobj(L, p2, event);
196 if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */
197 return -1;
198 callTMres(L, L->top, tm1, p1, p2);
199 return !l_isfalse(L->top)((((L->top)->tt) == 0) || ((((L->top)->tt) == 1) &&
((L->top)->value.b) == 0))
;
200}
201
202
203static int l_strcmp (const TString *ls, const TString *rs) {
204 const char *l = getstr(ls)((const char *)((ls) + 1));
205 size_t ll = ls->tsv.len;
206 const char *r = getstr(rs)((const char *)((rs) + 1));
207 size_t lr = rs->tsv.len;
208 for (;;) {
209 int temp = strcoll(l, r);
210 if (temp != 0) return temp;
211 else { /* strings are equal up to a `\0' */
212 size_t len = strlen(l); /* index of first `\0' in both strings */
213 if (len == lr) /* r is finished? */
214 return (len == ll) ? 0 : 1;
215 else if (len == ll) /* l is finished? */
216 return -1; /* l is smaller than r (because r is not finished) */
217 /* both strings longer than `len'; go on comparing (after the `\0') */
218 len++;
219 l += len; ll -= len; r += len; lr -= len;
220 }
221 }
222}
223
224
225int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
226 int res;
227 if (ttype(l)((l)->tt) != ttype(r)((r)->tt))
228 return luaG_ordererror(L, l, r);
229 else if (ttisnumber(l)(((l)->tt) == 3))
230 return luai_numlt(nvalue(l), nvalue(r))((((l)->value.n))<(((r)->value.n)));
231 else if (ttisstring(l)(((l)->tt) == 4))
232 return l_strcmp(rawtsvalue(l)(&(l)->value.gc->ts), rawtsvalue(r)(&(r)->value.gc->ts)) < 0;
233 else if ((res = call_orderTM(L, l, r, TM_LT)) != -1)
234 return res;
235 return luaG_ordererror(L, l, r);
236}
237
238
239static int lessequal (lua_State *L, const TValue *l, const TValue *r) {
240 int res;
241 if (ttype(l)((l)->tt) != ttype(r)((r)->tt))
242 return luaG_ordererror(L, l, r);
243 else if (ttisnumber(l)(((l)->tt) == 3))
244 return luai_numle(nvalue(l), nvalue(r))((((l)->value.n))<=(((r)->value.n)));
245 else if (ttisstring(l)(((l)->tt) == 4))
246 return l_strcmp(rawtsvalue(l)(&(l)->value.gc->ts), rawtsvalue(r)(&(r)->value.gc->ts)) <= 0;
247 else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */
248 return res;
249 else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */
250 return !res;
251 return luaG_ordererror(L, l, r);
252}
253
254
255int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
256 const TValue *tm;
257 lua_assert(ttype(t1) == ttype(t2))((void)0);
258 switch (ttype(t1)((t1)->tt)) {
259 case LUA_TNIL0: return 1;
260 case LUA_TNUMBER3: return luai_numeq(nvalue(t1), nvalue(t2))((((t1)->value.n))==(((t2)->value.n)));
261 case LUA_TBOOLEAN1: return bvalue(t1)((t1)->value.b) == bvalue(t2)((t2)->value.b); /* true must be 1 !! */
262 case LUA_TLIGHTUSERDATA2: return pvalue(t1)((t1)->value.p) == pvalue(t2)((t2)->value.p);
263 case LUA_TUSERDATA7: {
264 if (uvalue(t1)(&(&(t1)->value.gc->u)->uv) == uvalue(t2)(&(&(t2)->value.gc->u)->uv)) return 1;
265 tm = get_compTM(L, uvalue(t1)(&(&(t1)->value.gc->u)->uv)->metatable, uvalue(t2)(&(&(t2)->value.gc->u)->uv)->metatable,
266 TM_EQ);
267 break; /* will try TM */
268 }
269 case LUA_TTABLE5: {
270 if (hvalue(t1)(&(t1)->value.gc->h) == hvalue(t2)(&(t2)->value.gc->h)) return 1;
271 tm = get_compTM(L, hvalue(t1)(&(t1)->value.gc->h)->metatable, hvalue(t2)(&(t2)->value.gc->h)->metatable, TM_EQ);
272 break; /* will try TM */
273 }
274 default: return gcvalue(t1)((t1)->value.gc) == gcvalue(t2)((t2)->value.gc);
275 }
276 if (tm == NULL__null) return 0; /* no TM? */
277 callTMres(L, L->top, tm, t1, t2); /* call TM */
278 return !l_isfalse(L->top)((((L->top)->tt) == 0) || ((((L->top)->tt) == 1) &&
((L->top)->value.b) == 0))
;
279}
280
281
282void luaV_concat (lua_State *L, int total, int last) {
283 do {
284 StkId top = L->base + last + 1;
285 int n = 2; /* number of elements handled in this pass (at least 2) */
286 if (!(ttisstring(top-2)(((top-2)->tt) == 4) || ttisnumber(top-2)(((top-2)->tt) == 3)) || !tostring(L, top-1)((((top-1)->tt) == 4) || (luaV_tostring(L, top-1)))) {
287 if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
288 luaG_concaterror(L, top-2, top-1);
289 } else if (tsvalue(top-1)(&(&(top-1)->value.gc->ts)->tsv)->len == 0) /* second op is empty? */
290 (void)tostring(L, top - 2)((((top - 2)->tt) == 4) || (luaV_tostring(L, top - 2))); /* result is first op (as string) */
291 else {
292 /* at least two string values; get as many as possible */
293 size_t tl = tsvalue(top-1)(&(&(top-1)->value.gc->ts)->tsv)->len;
294 char *buffer;
295 int i;
296 /* collect total length */
297 for (n = 1; n < total && tostring(L, top-n-1)((((top-n-1)->tt) == 4) || (luaV_tostring(L, top-n-1))); n++) {
298 size_t l = tsvalue(top-n-1)(&(&(top-n-1)->value.gc->ts)->tsv)->len;
299 if (l >= MAX_SIZET((size_t)(~(size_t)0)-2) - tl) luaG_runerror(L, "string length overflow");
300 tl += l;
301 }
302 buffer = luaZ_openspace(L, &G(L)(L->l_G)->buff, tl);
303 tl = 0;
304 for (i=n; i>0; i--) { /* concat all strings */
305 size_t l = tsvalue(top-i)(&(&(top-i)->value.gc->ts)->tsv)->len;
306 memcpy(buffer+tl, svalue(top-i)((const char *)(((&(top-i)->value.gc->ts)) + 1)), l);
307 tl += l;
308 }
309 setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)){ TValue *i_o=(top-n); i_o->value.gc=((GCObject *)((luaS_newlstr
(L, buffer, tl)))); i_o->tt=4; ((void)0); }
;
310 }
311 total -= n-1; /* got `n' strings to create 1 new */
312 last -= n-1;
313 } while (total > 1); /* repeat until only 1 result left */
314}
315
316
317static void Arith (lua_State *L, StkId ra, const TValue *rb,
318 const TValue *rc, TMS op) {
319 TValue tempb, tempc;
320 const TValue *b, *c;
321 if ((b = luaV_tonumber(rb, &tempb)) != NULL__null &&
322 (c = luaV_tonumber(rc, &tempc)) != NULL__null) {
323 lua_Number nb = nvalue(b)((b)->value.n), nc = nvalue(c)((c)->value.n);
324 switch (op) {
325 case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)){ TValue *i_o=(ra); i_o->value.n=(((nb)+(nc))); i_o->tt
=3; }
; break;
326 case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)){ TValue *i_o=(ra); i_o->value.n=(((nb)-(nc))); i_o->tt
=3; }
; break;
327 case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)){ TValue *i_o=(ra); i_o->value.n=(((nb)*(nc))); i_o->tt
=3; }
; break;
328 case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)){ TValue *i_o=(ra); i_o->value.n=(((nb)/(nc))); i_o->tt
=3; }
; break;
329 case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)){ TValue *i_o=(ra); i_o->value.n=(((nb) - floor((nb)/(nc))
*(nc))); i_o->tt=3; }
; break;
330 case TM_POW: setnvalue(ra, luai_numpow(nb, nc)){ TValue *i_o=(ra); i_o->value.n=((pow(nb,nc))); i_o->tt
=3; }
; break;
331 case TM_UNM: setnvalue(ra, luai_numunm(nb)){ TValue *i_o=(ra); i_o->value.n=((-(nb))); i_o->tt=3; }; break;
332 default: lua_assert(0)((void)0); break;
333 }
334 }
335 else if (!call_binTM(L, rb, rc, ra, op))
336 luaG_aritherror(L, rb, rc);
337}
338
339
340
341/*
342** some macros for common tasks in `luaV_execute'
343*/
344
345#define runtime_check(L, c){ if (!(c)) break; } { if (!(c)) break; }
346
347#define RA(i)(base+(((int)(((i)>>(0 + 6)) & ((~((~(Instruction)0
)<<8))<<0)))))
(base+GETARG_A(i)(((int)(((i)>>(0 + 6)) & ((~((~(Instruction)0)<<
8))<<0))))
)
348/* to be used after possible stack reallocation */
349#define RB(i)(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
350#define RC(i)(base+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0)))))
check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))(base+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0)))))
351#define RKB(i)((((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(
Instruction)0)<<9))<<0))))) & ~(1 << (9
- 1))) : base+(((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0)))))
check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \((((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(
Instruction)0)<<9))<<0))))) & ~(1 << (9
- 1))) : base+(((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0)))))
352 ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))((((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(
Instruction)0)<<9))<<0))))) & ~(1 << (9
- 1))) : base+(((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0)))))
353#define RKC(i)((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))
check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))
354 ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))
355#define KBx(i)(k+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<(9 + 9)))<<0)))))
check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))(k+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<(9 + 9)))<<0)))))
356
357
358#define dojump(L,pc,i){(pc) += (i); {((void) 0); ((void) 0);};} {(pc) += (i); luai_threadyield(L){((void) 0); ((void) 0);};}
359
360
361#define Protect(x){ L->savedpc = pc; {x;}; base = L->base; } { L->savedpc = pc; {x;}; base = L->base; }
362
363
364#define arith_op(op,tm){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=(op(nb, nc)); i_o->tt=3; }; } else { L->
savedpc = pc; {Arith(L, ra, rb, rc, tm);}; base = L->base;
}; }
{ \
365 TValue *rb = RKB(i)((((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(
Instruction)0)<<9))<<0))))) & ~(1 << (9
- 1))) : base+(((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0)))))
; \
366 TValue *rc = RKC(i)((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))
; \
367 if (ttisnumber(rb)(((rb)->tt) == 3) && ttisnumber(rc)(((rc)->tt) == 3)) { \
368 lua_Number nb = nvalue(rb)((rb)->value.n), nc = nvalue(rc)((rc)->value.n); \
369 setnvalue(ra, op(nb, nc)){ TValue *i_o=(ra); i_o->value.n=(op(nb, nc)); i_o->tt=
3; }
; \
370 } \
371 else \
372 Protect(Arith(L, ra, rb, rc, tm)){ L->savedpc = pc; {Arith(L, ra, rb, rc, tm);}; base = L->
base; }
; \
373 }
374
375
376
377void luaV_execute (lua_State *L, int nexeccalls) {
378 LClosure *cl;
379 StkId base;
380 TValue *k;
381 const Instruction *pc;
382 reentry: /* entry point */
383 lua_assert(isLua(L->ci))((void)0);
384 pc = L->savedpc;
385 cl = &clvalue(L->ci->func)(&(L->ci->func)->value.gc->cl)->l;
386 base = L->base;
387 k = cl->p->k;
388 /* main loop of interpreter */
389 for (;;) {
1
Loop condition is true. Entering loop body
7
Loop condition is true. Entering loop body
13
Loop condition is true. Entering loop body
19
Loop condition is true. Entering loop body
390 const Instruction i = *pc++;
391 StkId ra;
392 if ((L->hookmask & (LUA_MASKLINE(1 << 2) | LUA_MASKCOUNT(1 << 3))) &&
2
Taking false branch
8
Taking false branch
14
Taking false branch
20
Taking false branch
393 (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE(1 << 2))) {
394 traceexec(L, pc);
395 if (L->status == LUA_YIELD1) { /* did hook yield? */
396 L->savedpc = pc - 1;
397 return;
398 }
399 base = L->base;
400 }
401 /* warning!! several calls may realloc the stack and invalidate `ra' */
402 ra = RA(i)(base+(((int)(((i)>>(0 + 6)) & ((~((~(Instruction)0
)<<8))<<0)))))
;
403 lua_assert(base == L->base && L->base == L->ci->base)((void)0);
404 lua_assert(base <= L->top && L->top <= L->stack + L->stacksize)((void)0);
405 lua_assert(L->top == L->ci->top || luaG_checkopenop(i))((void)0);
406 switch (GET_OPCODE(i)(((OpCode)(((i)>>0) & ((~((~(Instruction)0)<<
6))<<0))))
) {
3
Control jumps to 'case OP_VARARG:' at line 743
9
Control jumps to 'case OP_VARARG:' at line 743
15
Control jumps to 'case OP_VARARG:' at line 743
21
Control jumps to 'case OP_FORPREP:' at line 666
407 case OP_MOVE: {
408 setobjs2s(L, ra, RB(i)){ const TValue *o2=((base+(((int)(((i)>>(((0 + 6) + 8) +
9)) & ((~((~(Instruction)0)<<9))<<0)))))); TValue
*o1=(ra); o1->value = o2->value; o1->tt=o2->tt; (
(void)0); }
;
409 continue;
410 }
411 case OP_LOADK: {
412 setobj2s(L, ra, KBx(i)){ const TValue *o2=((k+(((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<(9 + 9)))<<0)))))); TValue
*o1=(ra); o1->value = o2->value; o1->tt=o2->tt; (
(void)0); }
;
413 continue;
414 }
415 case OP_LOADBOOL: {
416 setbvalue(ra, GETARG_B(i)){ TValue *i_o=(ra); i_o->value.b=((((int)(((i)>>(((0
+ 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))); i_o->tt=1; }
;
417 if (GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
) pc++; /* skip next instruction (if C) */
418 continue;
419 }
420 case OP_LOADNIL: {
421 TValue *rb = RB(i)(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
;
422 do {
423 setnilvalue(rb--)((rb--)->tt=0);
424 } while (rb >= ra);
425 continue;
426 }
427 case OP_GETUPVAL: {
428 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
429 setobj2s(L, ra, cl->upvals[b]->v){ const TValue *o2=(cl->upvals[b]->v); TValue *o1=(ra);
o1->value = o2->value; o1->tt=o2->tt; ((void)0);
}
;
430 continue;
431 }
432 case OP_GETGLOBAL: {
433 TValue g;
434 TValue *rb = KBx(i)(k+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<(9 + 9)))<<0)))))
;
435 sethvalue(L, &g, cl->env){ TValue *i_o=(&g); i_o->value.gc=((GCObject *)((cl->
env))); i_o->tt=5; ((void)0); }
;
436 lua_assert(ttisstring(rb))((void)0);
437 Protect(luaV_gettable(L, &g, rb, ra)){ L->savedpc = pc; {luaV_gettable(L, &g, rb, ra);}; base
= L->base; }
;
438 continue;
439 }
440 case OP_GETTABLE: {
441 Protect(luaV_gettable(L, RB(i), RKC(i), ra)){ L->savedpc = pc; {luaV_gettable(L, (base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0))))), ra);}; base = L->base; }
;
442 continue;
443 }
444 case OP_SETGLOBAL: {
445 TValue g;
446 sethvalue(L, &g, cl->env){ TValue *i_o=(&g); i_o->value.gc=((GCObject *)((cl->
env))); i_o->tt=5; ((void)0); }
;
447 lua_assert(ttisstring(KBx(i)))((void)0);
448 Protect(luaV_settable(L, &g, KBx(i), ra)){ L->savedpc = pc; {luaV_settable(L, &g, (k+(((int)(((
i)>>((0 + 6) + 8)) & ((~((~(Instruction)0)<<(
9 + 9)))<<0))))), ra);}; base = L->base; }
;
449 continue;
450 }
451 case OP_SETUPVAL: {
452 UpVal *uv = cl->upvals[GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
];
453 setobj(L, uv->v, ra){ const TValue *o2=(ra); TValue *o1=(uv->v); o1->value =
o2->value; o1->tt=o2->tt; ((void)0); }
;
454 luaC_barrier(L, uv, ra){ if (((((ra)->tt) >= 4) && (((((ra)->value.
gc))->gch.marked) & ((((1<<(0)) | (1<<(1))
))))) && ((((((GCObject *)((uv)))))->gch.marked) &
((1<<(2))))) luaC_barrierf(L,(((GCObject *)((uv)))),((
ra)->value.gc)); }
;
455 continue;
456 }
457 case OP_SETTABLE: {
458 Protect(luaV_settable(L, ra, RKB(i), RKC(i))){ L->savedpc = pc; {luaV_settable(L, ra, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0))))));}; base = L->base; }
;
459 continue;
460 }
461 case OP_NEWTABLE: {
462 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
463 int c = GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
;
464 sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))){ TValue *i_o=(ra); i_o->value.gc=((GCObject *)((luaH_new(
L, luaO_fb2int(b), luaO_fb2int(c))))); i_o->tt=5; ((void)0
); }
;
465 Protect(luaC_checkGC(L)){ L->savedpc = pc; {{ ((void)0); if ((L->l_G)->totalbytes
>= (L->l_G)->GCthreshold) luaC_step(L); };}; base =
L->base; }
;
466 continue;
467 }
468 case OP_SELF: {
469 StkId rb = RB(i)(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
;
470 setobjs2s(L, ra+1, rb){ const TValue *o2=(rb); TValue *o1=(ra+1); o1->value = o2
->value; o1->tt=o2->tt; ((void)0); }
;
471 Protect(luaV_gettable(L, rb, RKC(i), ra)){ L->savedpc = pc; {luaV_gettable(L, rb, ((((((int)(((i)>>
((0 + 6) + 8)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
((0 + 6) + 8)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
((0 + 6) + 8)) & ((~((~(Instruction)0)<<9))<<
0))))), ra);}; base = L->base; }
;
472 continue;
473 }
474 case OP_ADD: {
475 arith_op(luai_numadd, TM_ADD){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=(((nb)+(nc))); i_o->tt=3; }; } else { L
->savedpc = pc; {Arith(L, ra, rb, rc, TM_ADD);}; base = L->
base; }; }
;
476 continue;
477 }
478 case OP_SUB: {
479 arith_op(luai_numsub, TM_SUB){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=(((nb)-(nc))); i_o->tt=3; }; } else { L
->savedpc = pc; {Arith(L, ra, rb, rc, TM_SUB);}; base = L->
base; }; }
;
480 continue;
481 }
482 case OP_MUL: {
483 arith_op(luai_nummul, TM_MUL){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=(((nb)*(nc))); i_o->tt=3; }; } else { L
->savedpc = pc; {Arith(L, ra, rb, rc, TM_MUL);}; base = L->
base; }; }
;
484 continue;
485 }
486 case OP_DIV: {
487 arith_op(luai_numdiv, TM_DIV){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=(((nb)/(nc))); i_o->tt=3; }; } else { L
->savedpc = pc; {Arith(L, ra, rb, rc, TM_DIV);}; base = L->
base; }; }
;
488 continue;
489 }
490 case OP_MOD: {
491 arith_op(luai_nummod, TM_MOD){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=(((nb) - floor((nb)/(nc))*(nc))); i_o->
tt=3; }; } else { L->savedpc = pc; {Arith(L, ra, rb, rc, TM_MOD
);}; base = L->base; }; }
;
492 continue;
493 }
494 case OP_POW: {
495 arith_op(luai_numpow, TM_POW){ TValue *rb = ((((((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>(((0 + 6) + 8) + 9)
) & ((~((~(Instruction)0)<<9))<<0))))) & ~
(1 << (9 - 1))) : base+(((int)(((i)>>(((0 + 6) + 8
) + 9)) & ((~((~(Instruction)0)<<9))<<0)))));
TValue *rc = ((((((int)(((i)>>((0 + 6) + 8)) & ((~
((~(Instruction)0)<<9))<<0))))) & (1 <<
(9 - 1))) ? k+((int)((((int)(((i)>>((0 + 6) + 8)) &
((~((~(Instruction)0)<<9))<<0))))) & ~(1 <<
(9 - 1))) : base+(((int)(((i)>>((0 + 6) + 8)) & ((
~((~(Instruction)0)<<9))<<0))))); if ((((rb)->
tt) == 3) && (((rc)->tt) == 3)) { lua_Number nb = (
(rb)->value.n), nc = ((rc)->value.n); { TValue *i_o=(ra
); i_o->value.n=((pow(nb,nc))); i_o->tt=3; }; } else { L
->savedpc = pc; {Arith(L, ra, rb, rc, TM_POW);}; base = L->
base; }; }
;
496 continue;
497 }
498 case OP_UNM: {
499 TValue *rb = RB(i)(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
;
500 if (ttisnumber(rb)(((rb)->tt) == 3)) {
501 lua_Number nb = nvalue(rb)((rb)->value.n);
502 setnvalue(ra, luai_numunm(nb)){ TValue *i_o=(ra); i_o->value.n=((-(nb))); i_o->tt=3; };
503 }
504 else {
505 Protect(Arith(L, ra, rb, rb, TM_UNM)){ L->savedpc = pc; {Arith(L, ra, rb, rb, TM_UNM);}; base =
L->base; }
;
506 }
507 continue;
508 }
509 case OP_NOT: {
510 int res = l_isfalse(RB(i))(((((base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~(
(~(Instruction)0)<<9))<<0))))))->tt) == 0) || (
((((base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((
~(Instruction)0)<<9))<<0))))))->tt) == 1) &&
(((base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((
~(Instruction)0)<<9))<<0))))))->value.b) == 0)
)
; /* next assignment may change this value */
511 setbvalue(ra, res){ TValue *i_o=(ra); i_o->value.b=(res); i_o->tt=1; };
512 continue;
513 }
514 case OP_LEN: {
515 const TValue *rb = RB(i)(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
;
516 switch (ttype(rb)((rb)->tt)) {
517 case LUA_TTABLE5: {
518 setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))){ TValue *i_o=(ra); i_o->value.n=(((lua_Number)((luaH_getn
((&(rb)->value.gc->h)))))); i_o->tt=3; }
;
519 break;
520 }
521 case LUA_TSTRING4: {
522 setnvalue(ra, cast_num(tsvalue(rb)->len)){ TValue *i_o=(ra); i_o->value.n=(((lua_Number)(((&(&
(rb)->value.gc->ts)->tsv)->len)))); i_o->tt=3;
}
;
523 break;
524 }
525 default: { /* try metamethod */
526 Protect({ L->savedpc = pc; {if (!call_binTM(L, rb, (&luaO_nilobject_
), ra, TM_LEN)) luaG_typeerror(L, rb, "get length of");;}; base
= L->base; }
527 if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)){ L->savedpc = pc; {if (!call_binTM(L, rb, (&luaO_nilobject_
), ra, TM_LEN)) luaG_typeerror(L, rb, "get length of");;}; base
= L->base; }
528 luaG_typeerror(L, rb, "get length of");{ L->savedpc = pc; {if (!call_binTM(L, rb, (&luaO_nilobject_
), ra, TM_LEN)) luaG_typeerror(L, rb, "get length of");;}; base
= L->base; }
529 ){ L->savedpc = pc; {if (!call_binTM(L, rb, (&luaO_nilobject_
), ra, TM_LEN)) luaG_typeerror(L, rb, "get length of");;}; base
= L->base; }
530 }
531 }
532 continue;
533 }
534 case OP_CONCAT: {
535 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
536 int c = GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
;
537 Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)){ L->savedpc = pc; {luaV_concat(L, c-b+1, c); { ((void)0);
if ((L->l_G)->totalbytes >= (L->l_G)->GCthreshold
) luaC_step(L); };}; base = L->base; }
;
538 setobjs2s(L, RA(i), base+b){ const TValue *o2=(base+b); TValue *o1=((base+(((int)(((i)>>
(0 + 6)) & ((~((~(Instruction)0)<<8))<<0)))))
); o1->value = o2->value; o1->tt=o2->tt; ((void)0
); }
;
539 continue;
540 }
541 case OP_JMP: {
542 dojump(L, pc, GETARG_sBx(i)){(pc) += (((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};}
;
543 continue;
544 }
545 case OP_EQ: {
546 TValue *rb = RKB(i)((((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(
Instruction)0)<<9))<<0))))) & ~(1 << (9
- 1))) : base+(((int)(((i)>>(((0 + 6) + 8) + 9)) &
((~((~(Instruction)0)<<9))<<0)))))
;
547 TValue *rc = RKC(i)((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))
;
548 Protect({ L->savedpc = pc; {if ((((rb)->tt) == ((rc)->tt) &&
luaV_equalval(L, rb, rc)) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
549 if (equalobj(L, rb, rc) == GETARG_A(i)){ L->savedpc = pc; {if ((((rb)->tt) == ((rc)->tt) &&
luaV_equalval(L, rb, rc)) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
550 dojump(L, pc, GETARG_sBx(*pc));{ L->savedpc = pc; {if ((((rb)->tt) == ((rc)->tt) &&
luaV_equalval(L, rb, rc)) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
551 ){ L->savedpc = pc; {if ((((rb)->tt) == ((rc)->tt) &&
luaV_equalval(L, rb, rc)) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
552 pc++;
553 continue;
554 }
555 case OP_LT: {
556 Protect({ L->savedpc = pc; {if (luaV_lessthan(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
557 if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)){ L->savedpc = pc; {if (luaV_lessthan(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
558 dojump(L, pc, GETARG_sBx(*pc));{ L->savedpc = pc; {if (luaV_lessthan(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
559 ){ L->savedpc = pc; {if (luaV_lessthan(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
560 pc++;
561 continue;
562 }
563 case OP_LE: {
564 Protect({ L->savedpc = pc; {if (lessequal(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
565 if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)){ L->savedpc = pc; {if (lessequal(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
566 dojump(L, pc, GETARG_sBx(*pc));{ L->savedpc = pc; {if (lessequal(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
567 ){ L->savedpc = pc; {if (lessequal(L, ((((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & (1 << (9 - 1))) ? k+((int)((((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))) & ~(1 << (9 - 1))) : base+(((int)(((i)>>
(((0 + 6) + 8) + 9)) & ((~((~(Instruction)0)<<9))<<
0))))), ((((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & (1 << (9 - 1))) ? k+
((int)((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<9))<<0))))) & ~(1 << (9 - 1))) : base
+(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)
0)<<9))<<0)))))) == (((int)(((i)>>(0 + 6)) &
((~((~(Instruction)0)<<8))<<0))))) {(pc) += ((((
(int)(((*pc)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};};;}; base = L->base; }
568 pc++;
569 continue;
570 }
571 case OP_TEST: {
572 if (l_isfalse(ra)((((ra)->tt) == 0) || ((((ra)->tt) == 1) && ((ra
)->value.b) == 0))
!= GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
)
573 dojump(L, pc, GETARG_sBx(*pc)){(pc) += (((((int)(((*pc)>>((0 + 6) + 8)) & ((~((~(
Instruction)0)<<(9 + 9)))<<0))))-(((1<<(9 +
9))-1)>>1))); {((void) 0); ((void) 0);};}
;
574 pc++;
575 continue;
576 }
577 case OP_TESTSET: {
578 TValue *rb = RB(i)(base+(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0)))))
;
579 if (l_isfalse(rb)((((rb)->tt) == 0) || ((((rb)->tt) == 1) && ((rb
)->value.b) == 0))
!= GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
) {
580 setobjs2s(L, ra, rb){ const TValue *o2=(rb); TValue *o1=(ra); o1->value = o2->
value; o1->tt=o2->tt; ((void)0); }
;
581 dojump(L, pc, GETARG_sBx(*pc)){(pc) += (((((int)(((*pc)>>((0 + 6) + 8)) & ((~((~(
Instruction)0)<<(9 + 9)))<<0))))-(((1<<(9 +
9))-1)>>1))); {((void) 0); ((void) 0);};}
;
582 }
583 pc++;
584 continue;
585 }
586 case OP_CALL: {
587 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
588 int nresults = GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
- 1;
589 if (b != 0) L->top = ra+b; /* else previous instruction set top */
590 L->savedpc = pc;
591 switch (luaD_precall(L, ra, nresults)) {
592 case PCRLUA0: {
593 nexeccalls++;
594 goto reentry; /* restart luaV_execute over new Lua function */
595 }
596 case PCRC1: {
597 /* it was a C function (`precall' called it); adjust results */
598 if (nresults >= 0) L->top = L->ci->top;
599 base = L->base;
600 continue;
601 }
602 default: {
603 return; /* yield */
604 }
605 }
606 }
607 case OP_TAILCALL: {
608 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
609 if (b != 0) L->top = ra+b; /* else previous instruction set top */
610 L->savedpc = pc;
611 lua_assert(GETARG_C(i) - 1 == LUA_MULTRET)((void)0);
612 switch (luaD_precall(L, ra, LUA_MULTRET(-1))) {
613 case PCRLUA0: {
614 /* tail call: put new frame in place of previous one */
615 CallInfo *ci = L->ci - 1; /* previous frame */
616 int aux;
617 StkId func = ci->func;
618 StkId pfunc = (ci+1)->func; /* previous function index */
619 if (L->openupval) luaF_close(L, ci->base);
620 L->base = ci->base = ci->func + ((ci+1)->base - pfunc);
621 for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */
622 setobjs2s(L, func+aux, pfunc+aux){ const TValue *o2=(pfunc+aux); TValue *o1=(func+aux); o1->
value = o2->value; o1->tt=o2->tt; ((void)0); }
;
623 ci->top = L->top = func+aux; /* correct top */
624 lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize)((void)0);
625 ci->savedpc = L->savedpc;
626 ci->tailcalls++; /* one more call lost */
627 L->ci--; /* remove new frame */
628 goto reentry;
629 }
630 case PCRC1: { /* it was a C function (`precall' called it) */
631 base = L->base;
632 continue;
633 }
634 default: {
635 return; /* yield */
636 }
637 }
638 }
639 case OP_RETURN: {
640 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
641 if (b != 0) L->top = ra+b-1;
642 if (L->openupval) luaF_close(L, base);
643 L->savedpc = pc;
644 b = luaD_poscall(L, ra);
645 if (--nexeccalls == 0) /* was previous function running `here'? */
646 return; /* no: return */
647 else { /* yes: continue its execution */
648 if (b) L->top = L->ci->top;
649 lua_assert(isLua(L->ci))((void)0);
650 lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL)((void)0);
651 goto reentry;
652 }
653 }
654 case OP_FORLOOP: {
655 lua_Number step = nvalue(ra+2)((ra+2)->value.n);
656 lua_Number idx = luai_numadd(nvalue(ra), step)((((ra)->value.n))+(step)); /* increment index */
657 lua_Number limit = nvalue(ra+1)((ra+1)->value.n);
658 if (luai_numlt(0, step)((0)<(step)) ? luai_numle(idx, limit)((idx)<=(limit))
659 : luai_numle(limit, idx)((limit)<=(idx))) {
660 dojump(L, pc, GETARG_sBx(i)){(pc) += (((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};}
; /* jump back */
661 setnvalue(ra, idx){ TValue *i_o=(ra); i_o->value.n=(idx); i_o->tt=3; }; /* update internal index... */
662 setnvalue(ra+3, idx){ TValue *i_o=(ra+3); i_o->value.n=(idx); i_o->tt=3; }; /* ...and external index */
663 }
664 continue;
665 }
666 case OP_FORPREP: {
667 const TValue *init = ra;
668 const TValue *plimit = ra+1;
669 const TValue *pstep = ra+2;
670 L->savedpc = pc; /* next steps may throw errors */
671 if (!tonumber(init, ra)(((init)->tt) == 3 || (((init) = luaV_tonumber(init,ra)) !=
__null))
)
22
Taking false branch
672 luaG_runerror(L, LUA_QL("for")"'" "for" "'" " initial value must be a number");
673 else if (!tonumber(plimit, ra+1)(((plimit)->tt) == 3 || (((plimit) = luaV_tonumber(plimit,
ra+1)) != __null))
)
23
Taking false branch
674 luaG_runerror(L, LUA_QL("for")"'" "for" "'" " limit must be a number");
675 else if (!tonumber(pstep, ra+2)(((pstep)->tt) == 3 || (((pstep) = luaV_tonumber(pstep,ra+
2)) != __null))
)
24
Taking true branch
676 luaG_runerror(L, LUA_QL("for")"'" "for" "'" " step must be a number");
677 setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))){ TValue *i_o=(ra); i_o->value.n=(((((ra)->value.n))-((
(pstep)->value.n)))); i_o->tt=3; }
;
25
Within the expansion of the macro 'setnvalue':
a
Dereference of null pointer
678 dojump(L, pc, GETARG_sBx(i)){(pc) += (((((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction
)0)<<(9 + 9)))<<0))))-(((1<<(9 + 9))-1)>>
1))); {((void) 0); ((void) 0);};}
;
679 continue;
680 }
681 case OP_TFORLOOP: {
682 StkId cb = ra + 3; /* call base */
683 setobjs2s(L, cb+2, ra+2){ const TValue *o2=(ra+2); TValue *o1=(cb+2); o1->value = o2
->value; o1->tt=o2->tt; ((void)0); }
;
684 setobjs2s(L, cb+1, ra+1){ const TValue *o2=(ra+1); TValue *o1=(cb+1); o1->value = o2
->value; o1->tt=o2->tt; ((void)0); }
;
685 setobjs2s(L, cb, ra){ const TValue *o2=(ra); TValue *o1=(cb); o1->value = o2->
value; o1->tt=o2->tt; ((void)0); }
;
686 L->top = cb+3; /* func. + 2 args (state and index) */
687 Protect(luaD_call(L, cb, GETARG_C(i))){ L->savedpc = pc; {luaD_call(L, cb, (((int)(((i)>>(
(0 + 6) + 8)) & ((~((~(Instruction)0)<<9))<<0
)))));}; base = L->base; }
;
688 L->top = L->ci->top;
689 cb = RA(i)(base+(((int)(((i)>>(0 + 6)) & ((~((~(Instruction)0
)<<8))<<0)))))
+ 3; /* previous call may change the stack */
690 if (!ttisnil(cb)(((cb)->tt) == 0)) { /* continue loop? */
691 setobjs2s(L, cb-1, cb){ const TValue *o2=(cb); TValue *o1=(cb-1); o1->value = o2
->value; o1->tt=o2->tt; ((void)0); }
; /* save control variable */
692 dojump(L, pc, GETARG_sBx(*pc)){(pc) += (((((int)(((*pc)>>((0 + 6) + 8)) & ((~((~(
Instruction)0)<<(9 + 9)))<<0))))-(((1<<(9 +
9))-1)>>1))); {((void) 0); ((void) 0);};}
; /* jump back */
693 }
694 pc++;
695 continue;
696 }
697 case OP_SETLIST: {
698 int n = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
;
699 int c = GETARG_C(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<9))<<0))))
;
700 int last;
701 Table *h;
702 if (n == 0) {
703 n = cast_int(L->top - ra)((int)((L->top - ra))) - 1;
704 L->top = L->ci->top;
705 }
706 if (c == 0) c = cast_int(*pc++)((int)((*pc++)));
707 runtime_check(L, ttistable(ra)){ if (!((((ra)->tt) == 5))) break; };
708 h = hvalue(ra)(&(ra)->value.gc->h);
709 last = ((c-1)*LFIELDS_PER_FLUSH50) + n;
710 if (last > h->sizearray) /* needs more space? */
711 luaH_resizearray(L, h, last); /* pre-alloc it at once */
712 for (; n > 0; n--) {
713 TValue *val = ra+n;
714 setobj2t(L, luaH_setnum(L, h, last--), val){ const TValue *o2=(val); TValue *o1=(luaH_setnum(L, h, last--
)); o1->value = o2->value; o1->tt=o2->tt; ((void)
0); }
;
715 luaC_barriert(L, h, val){ if (((((val)->tt) >= 4) && (((((val)->value
.gc))->gch.marked) & ((((1<<(0)) | (1<<(1)
)))))) && ((((((GCObject *)((h)))))->gch.marked) &
((1<<(2))))) luaC_barrierback(L,h); }
;
716 }
717 continue;
718 }
719 case OP_CLOSE: {
720 luaF_close(L, ra);
721 continue;
722 }
723 case OP_CLOSURE: {
724 Proto *p;
725 Closure *ncl;
726 int nup, j;
727 p = cl->p->p[GETARG_Bx(i)(((int)(((i)>>((0 + 6) + 8)) & ((~((~(Instruction)0
)<<(9 + 9)))<<0))))
];
728 nup = p->nups;
729 ncl = luaF_newLclosure(L, nup, cl->env);
730 ncl->l.p = p;
731 for (j=0; j<nup; j++, pc++) {
732 if (GET_OPCODE(*pc)(((OpCode)(((*pc)>>0) & ((~((~(Instruction)0)<<
6))<<0))))
== OP_GETUPVAL)
733 ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)(((int)(((*pc)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
];
734 else {
735 lua_assert(GET_OPCODE(*pc) == OP_MOVE)((void)0);
736 ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)(((int)(((*pc)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
);
737 }
738 }
739 setclvalue(L, ra, ncl){ TValue *i_o=(ra); i_o->value.gc=((GCObject *)((ncl))); i_o
->tt=6; ((void)0); }
;
740 Protect(luaC_checkGC(L)){ L->savedpc = pc; {{ ((void)0); if ((L->l_G)->totalbytes
>= (L->l_G)->GCthreshold) luaC_step(L); };}; base =
L->base; }
;
741 continue;
742 }
743 case OP_VARARG: {
744 int b = GETARG_B(i)(((int)(((i)>>(((0 + 6) + 8) + 9)) & ((~((~(Instruction
)0)<<9))<<0))))
- 1;
745 int j;
746 CallInfo *ci = L->ci;
747 int n = cast_int(ci->base - ci->func)((int)((ci->base - ci->func))) - cl->p->numparams - 1;
748 if (b == LUA_MULTRET(-1)) {
4
Taking false branch
10
Taking false branch
16
Taking false branch
749 Protect(luaD_checkstack(L, n)){ L->savedpc = pc; {if ((char *)L->stack_last - (char *
)L->top <= (n)*(int)sizeof(TValue)) luaD_growstack(L, n
); else ((void)0);;}; base = L->base; }
;
750 ra = RA(i)(base+(((int)(((i)>>(0 + 6)) & ((~((~(Instruction)0
)<<8))<<0)))))
; /* previous call may change the stack */
751 b = n;
752 L->top = ra + n;
753 }
754 for (j = 0; j < b; j++) {
5
Loop condition is false. Execution continues on line 762
11
Loop condition is false. Execution continues on line 762
17
Loop condition is false. Execution continues on line 762
755 if (j < n) {
756 setobjs2s(L, ra + j, ci->base - n + j){ const TValue *o2=(ci->base - n + j); TValue *o1=(ra + j)
; o1->value = o2->value; o1->tt=o2->tt; ((void)0)
; }
;
757 }
758 else {
759 setnilvalue(ra + j)((ra + j)->tt=0);
760 }
761 }
762 continue;
6
Execution continues on line 389
12
Execution continues on line 389
18
Execution continues on line 389
763 }
764 }
765 }
766}