mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
New conceptual model for vararg
Conceptually, all functions get their vararg arguments in a vararg table. The storing of vararg arguments in the stack is always treated as an optimization.
This commit is contained in:
parent
d94f7ba304
commit
f33cc4ddec
11 changed files with 155 additions and 70 deletions
5
lcode.c
5
lcode.c
|
|
@ -1951,6 +1951,11 @@ void luaK_finish (FuncState *fs) {
|
|||
SET_OPCODE(*pc, OP_GETTABLE); /* must get vararg there */
|
||||
break;
|
||||
}
|
||||
case OP_VARARG: {
|
||||
if (p->flag & PF_VATAB) /* function has a vararg table? */
|
||||
SETARG_k(*pc, 1); /* must get vararg there */
|
||||
break;
|
||||
}
|
||||
case OP_JMP: { /* to optimize jumps to jumps */
|
||||
int target = finaltarget(p->code, i);
|
||||
fixjump(fs, i, target); /* jump directly to final target */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue