diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-11-26 11:18:29 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-11-26 11:18:29 -0300 |
| commit | f33cc4ddec886ea499d7d41dd60cac5ddc5687db (patch) | |
| tree | 917dccdbb60f984b21f5f7e1c0c3aa4f4f758ddc /lcode.c | |
| parent | d94f7ba3040eb06895d7305014e88157d3bfd1a1 (diff) | |
| download | lua-f33cc4ddec886ea499d7d41dd60cac5ddc5687db.tar.gz lua-f33cc4ddec886ea499d7d41dd60cac5ddc5687db.tar.bz2 lua-f33cc4ddec886ea499d7d41dd60cac5ddc5687db.zip | |
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.
Diffstat (limited to 'lcode.c')
| -rw-r--r-- | lcode.c | 5 |
1 files changed, 5 insertions, 0 deletions
| @@ -1951,6 +1951,11 @@ void luaK_finish (FuncState *fs) { | |||
| 1951 | SET_OPCODE(*pc, OP_GETTABLE); /* must get vararg there */ | 1951 | SET_OPCODE(*pc, OP_GETTABLE); /* must get vararg there */ |
| 1952 | break; | 1952 | break; |
| 1953 | } | 1953 | } |
| 1954 | case OP_VARARG: { | ||
| 1955 | if (p->flag & PF_VATAB) /* function has a vararg table? */ | ||
| 1956 | SETARG_k(*pc, 1); /* must get vararg there */ | ||
| 1957 | break; | ||
| 1958 | } | ||
| 1954 | case OP_JMP: { /* to optimize jumps to jumps */ | 1959 | case OP_JMP: { /* to optimize jumps to jumps */ |
| 1955 | int target = finaltarget(p->code, i); | 1960 | int target = finaltarget(p->code, i); |
| 1956 | fixjump(fs, i, target); /* jump directly to final target */ | 1961 | fixjump(fs, i, target); /* jump directly to final target */ |
