aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2025-09-24 18:33:08 -0300
committerRoberto I <roberto@inf.puc-rio.br>2025-09-24 18:33:08 -0300
commit25c54fe60e22d05cdfaa48c64372d354efa59547 (patch)
tree3ccaeded5e4363db358f73b7c8fc6b9f414a2f2a /lvm.c
parent0cc3c9447cca9abae9738ee77c24d88801c3916c (diff)
downloadlua-25c54fe60e22d05cdfaa48c64372d354efa59547.tar.gz
lua-25c54fe60e22d05cdfaa48c64372d354efa59547.tar.bz2
lua-25c54fe60e22d05cdfaa48c64372d354efa59547.zip
Optimization for vararg tables
A vararg table can be virtual. If the vararg table is used only as a base in indexing expressions, the code does not need to create an actual table for it. Instead, it compiles the indexing expressions into direct accesses to the internal vararg data.
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lvm.c b/lvm.c
index d88a80d1..3ce7e87f 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1926,6 +1926,12 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
1926 Protect(luaT_getvarargs(L, ci, ra, n)); 1926 Protect(luaT_getvarargs(L, ci, ra, n));
1927 vmbreak; 1927 vmbreak;
1928 } 1928 }
1929 vmcase(OP_GETVARG) {
1930 StkId ra = RA(i);
1931 TValue *rc = vRC(i);
1932 luaT_getvararg(ci, ra, rc);
1933 vmbreak;
1934 }
1929 vmcase(OP_VARARGPREP) { 1935 vmcase(OP_VARARGPREP) {
1930 ProtectNT(luaT_adjustvarargs(L, ci, cl->p)); 1936 ProtectNT(luaT_adjustvarargs(L, ci, cl->p));
1931 if (l_unlikely(trap)) { /* previous "Protect" updated trap */ 1937 if (l_unlikely(trap)) { /* previous "Protect" updated trap */