Commit Graph

273 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
3e88b72b8e A return can have at most 254 values 2024-08-19 18:39:25 -03:00
Roberto Ierusalimschy
8b752ddf14 Bug: wrong code gen. for indices with comparisons
In function 'luaK_exp2val', used to generate code for indices: Macro
'hasjumps' does not consider the case when the whole expression is a
"jump" (a test). In all other of its uses, the surrounding code ensures
that the expression cannot be VJMP.
2024-08-17 12:47:28 -03:00
Roberto Ierusalimschy
1bf4b80f1a Floats formatted with "correct" precision
Conversion float->string ensures that, for any float f,
tonumber(tostring(f)) == f, but still avoiding noise like 1.1
converting to "1.1000000000000001".
2024-08-02 15:09:30 -03:00
Roberto Ierusalimschy
f2206b2abe '-Wconversion' extended to all options of Lua numbers 2024-07-27 15:13:21 -03:00
Roberto Ierusalimschy
f407b3c4a1 Using CIST_CLSRET instead of trick with 'nresults'
The callstatus flag CIST_CLSRET is used in all tests for the
presence of variables to be closed in C functions.
2024-07-19 17:34:22 -03:00
Roberto Ierusalimschy
6b45ccf4ed Removed compatibility with "= exp" in the REPL 2024-07-05 15:19:11 -03:00
Roberto Ierusalimschy
93fd6892f8 Fixed bug in 'multiline'
'incomplete' was popping error message that should be used in case
there is no more lines to complete the input, that is, 'pushline'
returns NULL, due to end of file.
2024-07-05 15:13:46 -03:00
Roberto Ierusalimschy
366c855648 lua.c loads 'readline' dynamically
(See comments in luaconf.h.) This change allows easier compilation,
as Lua compiles and works even if the package 'readline' is absent
from the system. Moreover, non-interactive uses don't load the library,
making the stand-alone slightly faster for small loads.
2024-07-04 17:11:58 -03:00
Roberto Ierusalimschy
9904c253da 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.
2024-06-27 11:24:27 -03:00
Roberto Ierusalimschy
fb7e5b76c9 Clearer code for controlling maximum registers
Plus, added a test to check that limit.
2024-06-26 14:46:44 -03:00
Roberto Ierusalimschy
ef28e5f789 Removed 'int' size limit for string.rep 2024-06-21 16:26:49 -03:00
Roberto Ierusalimschy
ec65ab878e Removed 'int' size limit for pack/unpack 2024-06-21 14:55:12 -03:00
Roberto Ierusalimschy
97ef8e7bd4 GC test was not restarting collector after pause 2024-06-18 17:14:23 -03:00
Roberto Ierusalimschy
b529aefc53 Bug: luaL_traceback may need more than 5 stack slots 2024-06-12 16:02:01 -03:00
Roberto Ierusalimschy
bdc85357aa Bug: Active-lines for stripped vararg functions
Lua seg. faults when asked to create the 'activelines' table for a
vararg function with no debug information.
2024-06-04 17:27:13 -03:00
Roberto Ierusalimschy
814213b65f utf8.offset returns also final position of character
'utf8.offset' returns two values: the initial and the final position
of the given character.
2024-05-27 11:29:39 -03:00
Roberto Ierusalimschy
262dc5729a Details
Corrections in comments and manual. Added note in the manual about
local variables in the REPL.
2024-05-08 17:50:10 -03:00
Roberto Ierusalimschy
88a50ffa71 Fixed dangling 'StkId' in 'luaV_finishget'
Bug introduced in 05932567.
2024-03-29 15:10:50 -03:00
Roberto Ierusalimschy
52aa2b5d24 Details
- 'unsigned int' -> 'unsigned'
- Some explicit casts to avoid warnings
- Test avoids printing the value of 'fail' (which may not be nil)
2024-03-13 09:20:34 -03:00
Roberto Ierusalimschy
65b07dd53d API asserts for illegal pops of to-be-closed variables 2024-03-11 14:05:06 -03:00
Roberto Ierusalimschy
165389b27b New interface to function 'luaL_openselectedlibs'
Instead of preloading all non-loaded libraries, there is another
mask to select which libraries to preload.
2024-02-15 11:17:39 -03:00
Roberto Ierusalimschy
0c9bec0d38 Better handling of size limit when resizing a table
Avoid silent conversions from int to unsigned int when calling
'luaH_resize'; avoid silent conversions from lua_Integer to int in
'table.create'; MAXASIZE corrected for the new implementation of arrays;
'luaH_resize' checks explicitly whether new size respects MAXASIZE.
(Even constructors were bypassing that check.)
2024-02-07 13:39:54 -03:00
Roberto Ierusalimschy
c31d6774ac Details 2024-01-29 14:29:24 -03:00
Roberto Ierusalimschy
108e0bdc84 Merge branch 'master' into nextversion 2024-01-25 13:52:52 -03:00
Roberto Ierusalimschy
3e9dbe143d New function 'table.create'
Creates a table preallocating memory. (It just exports to Lua the API
function 'lua_createtable'.)
2024-01-18 15:16:26 -03:00
Roberto Ierusalimschy
4a8e480864 New mechanism to query GC parameters 2024-01-16 17:02:55 -03:00
Roberto Ierusalimschy
17e0c29d9b Clear interface between references and predefines
The reference system has a defined way to add initial values to the
table where it operates.
2024-01-15 11:31:49 -03:00
Roberto Ierusalimschy
e288c5a918 Bug: Yielding in a hook stops in the wrong instruction
Yielding in a hook must decrease the program counter, because it already
counted an instruction that, in the end, was not executed. However,
that decrement should be done only when about to restart the thread.
Otherwise, inspecting the thread with the debug library shows it one
instruction behind of where it really is.
2024-01-11 13:44:16 -03:00
Roberto Ierusalimschy
e7af9cdf0b Fixed buffers reuse absolute line information 2023-12-27 17:42:00 -03:00
Roberto Ierusalimschy
12b6f610b0 Several tweaks in the garbage collector
- back with step size in collectgarbage("step")
- adjustments in defaults for some GC parameters
- adjustments in 'luaO_codeparam'
2023-12-27 12:09:11 -03:00
Roberto Ierusalimschy
e81f586001 Removed compatibility option LUA_COMPAT_GCPARAMS
The meaning of different GC parameters changed, so there is point in
supporting old values for them. The new code simply ignores the
parameters when changing the GC mode, so the incompatibility is small.
2023-12-22 14:57:43 -03:00
Roberto Ierusalimschy
e2cc179454 New option "setparms" for 'collectgarbage'
The generational mode also uses the parameters for the incremental
mode in its major collections, so it should be easy to change those
parameters without having to change the GC mode.
2023-12-22 14:48:07 -03:00
Roberto Ierusalimschy
666e95a66d Option 0 for step multiplier makes GC non-incremental 2023-12-20 11:06:27 -03:00
Roberto Ierusalimschy
b719ff9399 Removed parameter in 'collectgarbage("step")'
A call to 'collectgarbage("step")' always performs one GC basic step.
2023-12-01 16:38:28 -03:00
Roberto Ierusalimschy
35a2fed2d1 Removed deprecated options in 'lua_gc'
Options 'setpause' and 'setstepmul' were deprecated in Lua 5.4.
2023-11-30 15:51:02 -03:00
Roberto Ierusalimschy
6d042a178f Auxiliary buffer uses external strings
The buffer system from the auxiliary library reuses its buffer
as external memory when closing long strings.
2023-11-13 13:12:33 -03:00
Roberto Ierusalimschy
3b57e37e48 Fixed buffers save long strings as external. 2023-11-10 12:35:48 -03:00
Roberto Ierusalimschy
024f9064f1 External strings
Strings can use external buffers to store their contents.
2023-11-09 17:05:42 -03:00
Roberto Ierusalimschy
9e99f3071d Merge branch 'master' into nextversion 2023-11-07 17:25:46 -03:00
Roberto Ierusalimschy
7923dbbf72 Bug: Recursion in 'getobjname' can stack overflow
'getobjname' now broken in two, a basic version that handles locals,
upvalues, and constants, and a full version, which uses the basic
version to handle table accesses (globals and fields).
2023-11-01 12:00:54 -03:00
Roberto Ierusalimschy
6baee9ef9d Removed test for "corrupted binary dump"
Test is too non portable. (For instance, it does not work for
different number types.)
2023-09-08 16:19:21 -03:00
Roberto Ierusalimschy
14e416355f Added suport for Fixed Buffers
A fixed buffer keeps a binary chunk "forever", so that the program
does not need to copy some of its parts when loading it.
2023-09-05 15:30:45 -03:00
Roberto Ierusalimschy
c815c2f0eb Merge branch 'master' into nextversion 2023-08-23 15:14:03 -03:00
Roberto Ierusalimschy
5ab6a5756b Bug: Wrong line number for function calls 2023-08-23 13:49:27 -03:00
Roberto Ierusalimschy
f4211a5ea4 More control over encoding of test files
The few UTF-8 test files are commented as such, and there is only one
non UTF-8 test file (to test non UTF-8 sources).
2023-08-17 10:42:56 -03:00
Roberto Ierusalimschy
cbae016202 Details 2023-07-03 14:12:54 -03:00
Roberto Ierusalimschy
ab6a949522 Merge branch 'master' into nextversion 2023-06-22 11:41:48 -03:00
Roberto Ierusalimschy
09f3c2372f Option '-l' discards version sufix from file name
Like 'require', the command-line option '-l' discards an optional
version suffix (everything after an hyphen) from a file name when
creating the module name.
2023-05-15 13:46:38 -03:00
Roberto Ierusalimschy
c197885cb0 Small improvements in tests 2023-05-15 10:20:13 -03:00
Roberto Ierusalimschy
ab859fe59b Bug: Loading a corrupted binary file can segfault
The size of the list of upvalue names are stored separated from the
size of the list of upvalues, but they share the same array.
2023-03-17 15:52:09 -03:00