mirror of
https://github.com/lua/lua.git
synced 2026-06-08 08:03:49 +00: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:
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 */
|
||||
|
||||
Reference in New Issue
Block a user