2 ** $Id: lcode.c,v 2.25 2006/03/21 19:28:49 roberto Exp $
3 ** Code generator for Lua
4 ** See Copyright Notice in lua.h
27 #define hasjumps(e) ((e)->t != (e)->f)
30 static int isnumeral(expdesc
*e
) {
31 return (e
->k
== VKNUM
&& e
->t
== NO_JUMP
&& e
->f
== NO_JUMP
);
35 void luaK_nil (FuncState
*fs
, int from
, int n
) {
36 Instruction
*previous
;
37 if (fs
->pc
> fs
->lasttarget
) { /* no jumps to current position? */
38 if (fs
->pc
== 0) /* function start? */
39 return; /* positions are already clean */
40 if (GET_OPCODE(*(previous
= &fs
->f
->code
[fs
->pc
-1])) == OP_LOADNIL
) {
41 int pfrom
= GETARG_A(*previous
);
42 int pto
= GETARG_B(*previous
);
43 if (pfrom
<= from
&& from
<= pto
+1) { /* can connect both? */
45 SETARG_B(*previous
, from
+n
-1);
50 luaK_codeABC(fs
, OP_LOADNIL
, from
, from
+n
-1, 0); /* else no optimization */
54 int luaK_jump (FuncState
*fs
) {
55 int jpc
= fs
->jpc
; /* save list of jumps to here */
58 j
= luaK_codeAsBx(fs
, OP_JMP
, 0, NO_JUMP
);
59 luaK_concat(fs
, &j
, jpc
); /* keep them on hold */
64 void luaK_ret (FuncState
*fs
, int first
, int nret
) {
65 luaK_codeABC(fs
, OP_RETURN
, first
, nret
+1, 0);
69 static int condjump (FuncState
*fs
, OpCode op
, int A
, int B
, int C
) {
70 luaK_codeABC(fs
, op
, A
, B
, C
);
75 static void fixjump (FuncState
*fs
, int pc
, int dest
) {
76 Instruction
*jmp
= &fs
->f
->code
[pc
];
77 int offset
= dest
-(pc
+1);
78 lua_assert(dest
!= NO_JUMP
);
79 if (abs(offset
) > MAXARG_sBx
)
80 luaX_syntaxerror(fs
->ls
, "control structure too long");
81 SETARG_sBx(*jmp
, offset
);
86 ** returns current `pc' and marks it as a jump target (to avoid wrong
87 ** optimizations with consecutive instructions not in the same basic block).
89 int luaK_getlabel (FuncState
*fs
) {
90 fs
->lasttarget
= fs
->pc
;
95 static int getjump (FuncState
*fs
, int pc
) {
96 int offset
= GETARG_sBx(fs
->f
->code
[pc
]);
97 if (offset
== NO_JUMP
) /* point to itself represents end of list */
98 return NO_JUMP
; /* end of list */
100 return (pc
+1)+offset
; /* turn offset into absolute position */
104 static Instruction
*getjumpcontrol (FuncState
*fs
, int pc
) {
105 Instruction
*pi
= &fs
->f
->code
[pc
];
106 if (pc
>= 1 && testTMode(GET_OPCODE(*(pi
-1))))
114 ** check whether list has any jump that do not produce a value
115 ** (or produce an inverted value)
117 static int need_value (FuncState
*fs
, int list
) {
118 for (; list
!= NO_JUMP
; list
= getjump(fs
, list
)) {
119 Instruction i
= *getjumpcontrol(fs
, list
);
120 if (GET_OPCODE(i
) != OP_TESTSET
) return 1;
122 return 0; /* not found */
126 static int patchtestreg (FuncState
*fs
, int node
, int reg
) {
127 Instruction
*i
= getjumpcontrol(fs
, node
);
128 if (GET_OPCODE(*i
) != OP_TESTSET
)
129 return 0; /* cannot patch other instructions */
130 if (reg
!= NO_REG
&& reg
!= GETARG_B(*i
))
132 else /* no register to put value or register already has the value */
133 *i
= CREATE_ABC(OP_TEST
, GETARG_B(*i
), 0, GETARG_C(*i
));
139 static void removevalues (FuncState
*fs
, int list
) {
140 for (; list
!= NO_JUMP
; list
= getjump(fs
, list
))
141 patchtestreg(fs
, list
, NO_REG
);
145 static void patchlistaux (FuncState
*fs
, int list
, int vtarget
, int reg
,
147 while (list
!= NO_JUMP
) {
148 int next
= getjump(fs
, list
);
149 if (patchtestreg(fs
, list
, reg
))
150 fixjump(fs
, list
, vtarget
);
152 fixjump(fs
, list
, dtarget
); /* jump to default target */
158 static void dischargejpc (FuncState
*fs
) {
159 patchlistaux(fs
, fs
->jpc
, fs
->pc
, NO_REG
, fs
->pc
);
164 void luaK_patchlist (FuncState
*fs
, int list
, int target
) {
165 if (target
== fs
->pc
)
166 luaK_patchtohere(fs
, list
);
168 lua_assert(target
< fs
->pc
);
169 patchlistaux(fs
, list
, target
, NO_REG
, target
);
174 void luaK_patchtohere (FuncState
*fs
, int list
) {
176 luaK_concat(fs
, &fs
->jpc
, list
);
180 void luaK_concat (FuncState
*fs
, int *l1
, int l2
) {
181 if (l2
== NO_JUMP
) return;
182 else if (*l1
== NO_JUMP
)
187 while ((next
= getjump(fs
, list
)) != NO_JUMP
) /* find last element */
189 fixjump(fs
, list
, l2
);
194 void luaK_checkstack (FuncState
*fs
, int n
) {
195 int newstack
= fs
->freereg
+ n
;
196 if (newstack
> fs
->f
->maxstacksize
) {
197 if (newstack
>= MAXSTACK
)
198 luaX_syntaxerror(fs
->ls
, "function or expression too complex");
199 fs
->f
->maxstacksize
= cast_byte(newstack
);
204 void luaK_reserveregs (FuncState
*fs
, int n
) {
205 luaK_checkstack(fs
, n
);
210 static void freereg (FuncState
*fs
, int reg
) {
211 if (!ISK(reg
) && reg
>= fs
->nactvar
) {
213 lua_assert(reg
== fs
->freereg
);
218 static void freeexp (FuncState
*fs
, expdesc
*e
) {
219 if (e
->k
== VNONRELOC
)
220 freereg(fs
, e
->u
.s
.info
);
224 static int addk (FuncState
*fs
, TValue
*k
, TValue
*v
) {
225 lua_State
*L
= fs
->L
;
226 TValue
*idx
= luaH_set(L
, fs
->h
, k
);
228 int oldsize
= f
->sizek
;
229 if (ttisnumber(idx
)) {
230 lua_assert(luaO_rawequalObj(&fs
->f
->k
[cast_int(nvalue(idx
))], v
));
231 return cast_int(nvalue(idx
));
233 else { /* constant not found; create a new entry */
234 setnvalue(idx
, cast_num(fs
->nk
));
235 luaM_growvector(L
, f
->k
, fs
->nk
, f
->sizek
, TValue
,
236 MAXARG_Bx
, "constant table overflow");
237 while (oldsize
< f
->sizek
) setnilvalue(&f
->k
[oldsize
++]);
238 setobj(L
, &f
->k
[fs
->nk
], v
);
239 luaC_barrier(L
, f
, v
);
245 int luaK_stringK (FuncState
*fs
, TString
*s
) {
247 setsvalue(fs
->L
, &o
, s
);
248 return addk(fs
, &o
, &o
);
252 int luaK_numberK (FuncState
*fs
, lua_Number r
) {
255 return addk(fs
, &o
, &o
);
259 static int boolK (FuncState
*fs
, int b
) {
262 return addk(fs
, &o
, &o
);
266 static int nilK (FuncState
*fs
) {
269 /* cannot use nil as key; instead use table itself to represent nil */
270 sethvalue(fs
->L
, &k
, fs
->h
);
271 return addk(fs
, &k
, &v
);
275 void luaK_setreturns (FuncState
*fs
, expdesc
*e
, int nresults
) {
276 if (e
->k
== VCALL
) { /* expression is an open function call? */
277 SETARG_C(getcode(fs
, e
), nresults
+1);
279 else if (e
->k
== VVARARG
) {
280 SETARG_B(getcode(fs
, e
), nresults
+1);
281 SETARG_A(getcode(fs
, e
), fs
->freereg
);
282 luaK_reserveregs(fs
, 1);
287 void luaK_setoneret (FuncState
*fs
, expdesc
*e
) {
288 if (e
->k
== VCALL
) { /* expression is an open function call? */
290 e
->u
.s
.info
= GETARG_A(getcode(fs
, e
));
292 else if (e
->k
== VVARARG
) {
293 SETARG_B(getcode(fs
, e
), 2);
294 e
->k
= VRELOCABLE
; /* can relocate its simple result */
299 void luaK_dischargevars (FuncState
*fs
, expdesc
*e
) {
306 e
->u
.s
.info
= luaK_codeABC(fs
, OP_GETUPVAL
, 0, e
->u
.s
.info
, 0);
311 e
->u
.s
.info
= luaK_codeABx(fs
, OP_GETGLOBAL
, 0, e
->u
.s
.info
);
316 freereg(fs
, e
->u
.s
.aux
);
317 freereg(fs
, e
->u
.s
.info
);
318 e
->u
.s
.info
= luaK_codeABC(fs
, OP_GETTABLE
, 0, e
->u
.s
.info
, e
->u
.s
.aux
);
324 luaK_setoneret(fs
, e
);
327 default: break; /* there is one value available (somewhere) */
332 static int code_label (FuncState
*fs
, int A
, int b
, int jump
) {
333 luaK_getlabel(fs
); /* those instructions may be jump targets */
334 return luaK_codeABC(fs
, OP_LOADBOOL
, A
, b
, jump
);
338 static void discharge2reg (FuncState
*fs
, expdesc
*e
, int reg
) {
339 luaK_dischargevars(fs
, e
);
342 luaK_nil(fs
, reg
, 1);
345 case VFALSE
: case VTRUE
: {
346 luaK_codeABC(fs
, OP_LOADBOOL
, reg
, e
->k
== VTRUE
, 0);
350 luaK_codeABx(fs
, OP_LOADK
, reg
, e
->u
.s
.info
);
354 luaK_codeABx(fs
, OP_LOADK
, reg
, luaK_numberK(fs
, e
->u
.nval
));
358 Instruction
*pc
= &getcode(fs
, e
);
363 if (reg
!= e
->u
.s
.info
)
364 luaK_codeABC(fs
, OP_MOVE
, reg
, e
->u
.s
.info
, 0);
368 lua_assert(e
->k
== VVOID
|| e
->k
== VJMP
);
369 return; /* nothing to do... */
377 static void discharge2anyreg (FuncState
*fs
, expdesc
*e
) {
378 if (e
->k
!= VNONRELOC
) {
379 luaK_reserveregs(fs
, 1);
380 discharge2reg(fs
, e
, fs
->freereg
-1);
385 static void exp2reg (FuncState
*fs
, expdesc
*e
, int reg
) {
386 discharge2reg(fs
, e
, reg
);
388 luaK_concat(fs
, &e
->t
, e
->u
.s
.info
); /* put this jump in `t' list */
390 int final
; /* position after whole expression */
391 int p_f
= NO_JUMP
; /* position of an eventual LOAD false */
392 int p_t
= NO_JUMP
; /* position of an eventual LOAD true */
393 if (need_value(fs
, e
->t
) || need_value(fs
, e
->f
)) {
394 int fj
= (e
->k
== VJMP
) ? NO_JUMP
: luaK_jump(fs
);
395 p_f
= code_label(fs
, reg
, 0, 1);
396 p_t
= code_label(fs
, reg
, 1, 0);
397 luaK_patchtohere(fs
, fj
);
399 final
= luaK_getlabel(fs
);
400 patchlistaux(fs
, e
->f
, final
, reg
, p_f
);
401 patchlistaux(fs
, e
->t
, final
, reg
, p_t
);
403 e
->f
= e
->t
= NO_JUMP
;
409 void luaK_exp2nextreg (FuncState
*fs
, expdesc
*e
) {
410 luaK_dischargevars(fs
, e
);
412 luaK_reserveregs(fs
, 1);
413 exp2reg(fs
, e
, fs
->freereg
- 1);
417 int luaK_exp2anyreg (FuncState
*fs
, expdesc
*e
) {
418 luaK_dischargevars(fs
, e
);
419 if (e
->k
== VNONRELOC
) {
420 if (!hasjumps(e
)) return e
->u
.s
.info
; /* exp is already in a register */
421 if (e
->u
.s
.info
>= fs
->nactvar
) { /* reg. is not a local? */
422 exp2reg(fs
, e
, e
->u
.s
.info
); /* put value on it */
426 luaK_exp2nextreg(fs
, e
); /* default */
431 void luaK_exp2val (FuncState
*fs
, expdesc
*e
) {
433 luaK_exp2anyreg(fs
, e
);
435 luaK_dischargevars(fs
, e
);
439 int luaK_exp2RK (FuncState
*fs
, expdesc
*e
) {
446 if (fs
->nk
<= MAXINDEXRK
) { /* constant fit in RK operand? */
447 e
->u
.s
.info
= (e
->k
== VNIL
) ? nilK(fs
) :
448 (e
->k
== VKNUM
) ? luaK_numberK(fs
, e
->u
.nval
) :
449 boolK(fs
, (e
->k
== VTRUE
));
451 return RKASK(e
->u
.s
.info
);
456 if (e
->u
.s
.info
<= MAXINDEXRK
) /* constant fit in argC? */
457 return RKASK(e
->u
.s
.info
);
462 /* not a constant in the right range: put it in a register */
463 return luaK_exp2anyreg(fs
, e
);
467 void luaK_storevar (FuncState
*fs
, expdesc
*var
, expdesc
*ex
) {
471 exp2reg(fs
, ex
, var
->u
.s
.info
);
475 int e
= luaK_exp2anyreg(fs
, ex
);
476 luaK_codeABC(fs
, OP_SETUPVAL
, e
, var
->u
.s
.info
, 0);
480 int e
= luaK_exp2anyreg(fs
, ex
);
481 luaK_codeABx(fs
, OP_SETGLOBAL
, e
, var
->u
.s
.info
);
485 int e
= luaK_exp2RK(fs
, ex
);
486 luaK_codeABC(fs
, OP_SETTABLE
, var
->u
.s
.info
, var
->u
.s
.aux
, e
);
490 lua_assert(0); /* invalid var kind to store */
498 void luaK_self (FuncState
*fs
, expdesc
*e
, expdesc
*key
) {
500 luaK_exp2anyreg(fs
, e
);
503 luaK_reserveregs(fs
, 2);
504 luaK_codeABC(fs
, OP_SELF
, func
, e
->u
.s
.info
, luaK_exp2RK(fs
, key
));
511 static void invertjump (FuncState
*fs
, expdesc
*e
) {
512 Instruction
*pc
= getjumpcontrol(fs
, e
->u
.s
.info
);
513 lua_assert(testTMode(GET_OPCODE(*pc
)) && GET_OPCODE(*pc
) != OP_TESTSET
&&
514 GET_OPCODE(*pc
) != OP_TEST
);
515 SETARG_A(*pc
, !(GETARG_A(*pc
)));
519 static int jumponcond (FuncState
*fs
, expdesc
*e
, int cond
) {
520 if (e
->k
== VRELOCABLE
) {
521 Instruction ie
= getcode(fs
, e
);
522 if (GET_OPCODE(ie
) == OP_NOT
) {
523 fs
->pc
--; /* remove previous OP_NOT */
524 return condjump(fs
, OP_TEST
, GETARG_B(ie
), 0, !cond
);
526 /* else go through */
528 discharge2anyreg(fs
, e
);
530 return condjump(fs
, OP_TESTSET
, NO_REG
, e
->u
.s
.info
, cond
);
534 void luaK_goiftrue (FuncState
*fs
, expdesc
*e
) {
535 int pc
; /* pc of last jump */
536 luaK_dischargevars(fs
, e
);
538 case VK
: case VKNUM
: case VTRUE
: {
539 pc
= NO_JUMP
; /* always true; do nothing */
543 pc
= luaK_jump(fs
); /* always jump */
552 pc
= jumponcond(fs
, e
, 0);
556 luaK_concat(fs
, &e
->f
, pc
); /* insert last jump in `f' list */
557 luaK_patchtohere(fs
, e
->t
);
562 static void luaK_goiffalse (FuncState
*fs
, expdesc
*e
) {
563 int pc
; /* pc of last jump */
564 luaK_dischargevars(fs
, e
);
566 case VNIL
: case VFALSE
: {
567 pc
= NO_JUMP
; /* always false; do nothing */
571 pc
= luaK_jump(fs
); /* always jump */
579 pc
= jumponcond(fs
, e
, 1);
583 luaK_concat(fs
, &e
->t
, pc
); /* insert last jump in `t' list */
584 luaK_patchtohere(fs
, e
->f
);
589 static void codenot (FuncState
*fs
, expdesc
*e
) {
590 luaK_dischargevars(fs
, e
);
592 case VNIL
: case VFALSE
: {
596 case VK
: case VKNUM
: case VTRUE
: {
606 discharge2anyreg(fs
, e
);
608 e
->u
.s
.info
= luaK_codeABC(fs
, OP_NOT
, 0, e
->u
.s
.info
, 0);
613 lua_assert(0); /* cannot happen */
617 /* interchange true and false lists */
618 { int temp
= e
->f
; e
->f
= e
->t
; e
->t
= temp
; }
619 removevalues(fs
, e
->f
);
620 removevalues(fs
, e
->t
);
624 void luaK_indexed (FuncState
*fs
, expdesc
*t
, expdesc
*k
) {
625 t
->u
.s
.aux
= luaK_exp2RK(fs
, k
);
630 static int constfolding (OpCode op
, expdesc
*e1
, expdesc
*e2
) {
631 lua_Number v1
, v2
, r
;
632 if (!isnumeral(e1
) || !isnumeral(e2
)) return 0;
636 case OP_ADD
: r
= luai_numadd(v1
, v2
); break;
637 case OP_SUB
: r
= luai_numsub(v1
, v2
); break;
638 case OP_MUL
: r
= luai_nummul(v1
, v2
); break;
640 if (v2
== 0) return 0; /* do not attempt to divide by 0 */
641 r
= luai_numdiv(v1
, v2
); break;
643 if (v2
== 0) return 0; /* do not attempt to divide by 0 */
644 r
= luai_nummod(v1
, v2
); break;
645 case OP_POW
: r
= luai_numpow(v1
, v2
); break;
646 case OP_UNM
: r
= luai_numunm(v1
); break;
647 case OP_LEN
: return 0; /* no constant folding for 'len' */
648 default: lua_assert(0); r
= 0; break;
650 if (luai_numisnan(r
)) return 0; /* do not attempt to produce NaN */
656 static void codearith (FuncState
*fs
, OpCode op
, expdesc
*e1
, expdesc
*e2
) {
657 if (constfolding(op
, e1
, e2
))
660 int o1
= luaK_exp2RK(fs
, e1
);
661 int o2
= (op
!= OP_UNM
&& op
!= OP_LEN
) ? luaK_exp2RK(fs
, e2
) : 0;
664 e1
->u
.s
.info
= luaK_codeABC(fs
, op
, 0, o1
, o2
);
670 static void codecomp (FuncState
*fs
, OpCode op
, int cond
, expdesc
*e1
,
672 int o1
= luaK_exp2RK(fs
, e1
);
673 int o2
= luaK_exp2RK(fs
, e2
);
676 if (cond
== 0 && op
!= OP_EQ
) {
677 int temp
; /* exchange args to replace by `<' or `<=' */
678 temp
= o1
; o1
= o2
; o2
= temp
; /* o1 <==> o2 */
681 e1
->u
.s
.info
= condjump(fs
, op
, cond
, o1
, o2
);
686 void luaK_prefix (FuncState
*fs
, UnOpr op
, expdesc
*e
) {
688 e2
.t
= e2
.f
= NO_JUMP
; e2
.k
= VKNUM
; e2
.u
.nval
= 0;
692 luaK_exp2anyreg(fs
, e
); /* cannot operate on non-numeric constants */
693 codearith(fs
, OP_UNM
, e
, &e2
);
696 case OPR_NOT
: codenot(fs
, e
); break;
698 luaK_exp2anyreg(fs
, e
); /* cannot operate on constants */
699 codearith(fs
, OP_LEN
, e
, &e2
);
702 default: lua_assert(0);
707 void luaK_infix (FuncState
*fs
, BinOpr op
, expdesc
*v
) {
710 luaK_goiftrue(fs
, v
);
714 luaK_goiffalse(fs
, v
);
718 luaK_exp2nextreg(fs
, v
); /* operand must be on the `stack' */
722 if (!isnumeral(v
)) luaK_exp2RK(fs
, v
);
729 void luaK_posfix (FuncState
*fs
, BinOpr op
, expdesc
*e1
, expdesc
*e2
) {
732 lua_assert(e1
->t
== NO_JUMP
); /* list must be closed */
733 luaK_dischargevars(fs
, e2
);
734 luaK_concat(fs
, &e2
->f
, e1
->f
);
739 lua_assert(e1
->f
== NO_JUMP
); /* list must be closed */
740 luaK_dischargevars(fs
, e2
);
741 luaK_concat(fs
, &e2
->t
, e1
->t
);
746 luaK_exp2val(fs
, e2
);
747 if (e2
->k
== VRELOCABLE
&& GET_OPCODE(getcode(fs
, e2
)) == OP_CONCAT
) {
748 lua_assert(e1
->u
.s
.info
== GETARG_B(getcode(fs
, e2
))-1);
750 SETARG_B(getcode(fs
, e2
), e1
->u
.s
.info
);
751 e1
->k
= VRELOCABLE
; e1
->u
.s
.info
= e2
->u
.s
.info
;
754 luaK_exp2nextreg(fs
, e2
); /* operand must be on the 'stack' */
755 codearith(fs
, OP_CONCAT
, e1
, e2
);
759 case OPR_ADD
: codearith(fs
, OP_ADD
, e1
, e2
); break;
760 case OPR_SUB
: codearith(fs
, OP_SUB
, e1
, e2
); break;
761 case OPR_MUL
: codearith(fs
, OP_MUL
, e1
, e2
); break;
762 case OPR_DIV
: codearith(fs
, OP_DIV
, e1
, e2
); break;
763 case OPR_MOD
: codearith(fs
, OP_MOD
, e1
, e2
); break;
764 case OPR_POW
: codearith(fs
, OP_POW
, e1
, e2
); break;
765 case OPR_EQ
: codecomp(fs
, OP_EQ
, 1, e1
, e2
); break;
766 case OPR_NE
: codecomp(fs
, OP_EQ
, 0, e1
, e2
); break;
767 case OPR_LT
: codecomp(fs
, OP_LT
, 1, e1
, e2
); break;
768 case OPR_LE
: codecomp(fs
, OP_LE
, 1, e1
, e2
); break;
769 case OPR_GT
: codecomp(fs
, OP_LT
, 0, e1
, e2
); break;
770 case OPR_GE
: codecomp(fs
, OP_LE
, 0, e1
, e2
); break;
771 default: lua_assert(0);
776 void luaK_fixline (FuncState
*fs
, int line
) {
777 fs
->f
->lineinfo
[fs
->pc
- 1] = line
;
781 static int luaK_code (FuncState
*fs
, Instruction i
, int line
) {
783 dischargejpc(fs
); /* `pc' will change */
784 /* put new instruction in code array */
785 luaM_growvector(fs
->L
, f
->code
, fs
->pc
, f
->sizecode
, Instruction
,
786 MAX_INT
, "code size overflow");
788 /* save corresponding line information */
789 luaM_growvector(fs
->L
, f
->lineinfo
, fs
->pc
, f
->sizelineinfo
, int,
790 MAX_INT
, "code size overflow");
791 f
->lineinfo
[fs
->pc
] = line
;
796 int luaK_codeABC (FuncState
*fs
, OpCode o
, int a
, int b
, int c
) {
797 lua_assert(getOpMode(o
) == iABC
);
798 lua_assert(getBMode(o
) != OpArgN
|| b
== 0);
799 lua_assert(getCMode(o
) != OpArgN
|| c
== 0);
800 return luaK_code(fs
, CREATE_ABC(o
, a
, b
, c
), fs
->ls
->lastline
);
804 int luaK_codeABx (FuncState
*fs
, OpCode o
, int a
, unsigned int bc
) {
805 lua_assert(getOpMode(o
) == iABx
|| getOpMode(o
) == iAsBx
);
806 lua_assert(getCMode(o
) == OpArgN
);
807 return luaK_code(fs
, CREATE_ABx(o
, a
, bc
), fs
->ls
->lastline
);
811 void luaK_setlist (FuncState
*fs
, int base
, int nelems
, int tostore
) {
812 int c
= (nelems
- 1)/LFIELDS_PER_FLUSH
+ 1;
813 int b
= (tostore
== LUA_MULTRET
) ? 0 : tostore
;
814 lua_assert(tostore
!= 0);
816 luaK_codeABC(fs
, OP_SETLIST
, base
, b
, c
);
818 luaK_codeABC(fs
, OP_SETLIST
, base
, b
, 0);
819 luaK_code(fs
, cast(Instruction
, c
), fs
->ls
->lastline
);
821 fs
->freereg
= base
+ 1; /* free registers with list values */