aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-27 11:24:27 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-06-27 11:24:27 -0300
commit9904c253da9690728710082cfb94654709ab89e7 (patch)
treef556ebbf8d99baa37ea8e39608a3d6bea77f8267 /lcode.c
parentfb7e5b76c9d41108c399cf4d16470018b717007b (diff)
downloadlua-9904c253da9690728710082cfb94654709ab89e7.tar.gz
lua-9904c253da9690728710082cfb94654709ab89e7.tar.bz2
lua-9904c253da9690728710082cfb94654709ab89e7.zip
Flexible limit for use of registers by constructors
Instead of a fixed limit of 50 registers (which, in a bad worst case, can limit the nesting of constructors to 5 levels), the compiler computes an individual limit for each constructor based on how many registers are available when it runs. This limit then controls the frequency of SETLIST instructions.
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lcode.c b/lcode.c
index bc0a3341..a74c2a16 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1804,7 +1804,7 @@ void luaK_settablesize (FuncState *fs, int pc, int ra, int asize, int hsize) {
1804** table (or LUA_MULTRET to add up to stack top). 1804** table (or LUA_MULTRET to add up to stack top).
1805*/ 1805*/
1806void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { 1806void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
1807 lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); 1807 lua_assert(tostore != 0);
1808 if (tostore == LUA_MULTRET) 1808 if (tostore == LUA_MULTRET)
1809 tostore = 0; 1809 tostore = 0;
1810 if (nelems <= MAXARG_C) 1810 if (nelems <= MAXARG_C)