aboutsummaryrefslogtreecommitdiff
path: root/testes (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Randomness added to table length computationRoberto Ierusalimschy2025-07-181-0/+12
| | | | | | | A bad actor could fill only a few entries in a table (power of twos in decreasing order, see tests) and produce a small table with a huge length. If your program builds a table with external data and iterates over its length, this behavior could be an issue.
* Correction in utf8.offsetRoberto Ierusalimschy2025-07-181-0/+9
| | | | Wrong utf-8 character may have no continuation bytes.
* Short strings can be external, tooRoberto Ierusalimschy2025-07-151-7/+21
| | | | | | | That complicates a little object equality (and therefore table access for long strings), but the old behavior was somewhat weird. (Short strings, a concept otherwise absent from the manual, could not be external.)
* New method to unload DLLsRoberto Ierusalimschy2025-07-092-1/+58
| | | | | | | | | | External strings created by DLLs may need the DLL code to be deallocated. This implies that a DLL can only be unloaded after all its strings were deallocated, which happen only after the run of all finalizers. To ensure that order, we create a 'library string' to represent each DLL and keep it locked. When this string is deallocated (after the deallocation of any string created by the DLL) it closes its corresponding DLL.
* lua option '--' may not be followed by scriptRoberto Ierusalimschy2025-07-081-4/+5
|
* Optional initialization for global declarationsRoberto Ierusalimschy2025-07-085-7/+28
|
* No need to limit variable declarations to 250Roberto Ierusalimschy2025-06-182-6/+34
| | | | Only local variables, which use registers, need this low limit.
* New metatable in an all-weak table can fool the GCRoberto Ierusalimschy2025-06-161-0/+10
| | | | | | All-weak tables are not being revisited after being visited during propagation; if it gets a new metatable after that, the new metatable may not be marked.
* Simpler code for 'traversetable'Roberto Ierusalimschy2025-06-161-0/+5
| | | | | Check the mode in a separate function (getmode), instead of using comma expressions inside the 'if' condition.
* Dump uses varints also for integer constantsRoberto Ierusalimschy2025-06-131-0/+18
| | | | | | Unlike sizes, these constants can be negative, so it encodes those integers into unsigned integers in a way that keeps small numbers small.
* The main thread cannot be closedRoberto Ierusalimschy2025-06-131-0/+5
| | | | | | No thread started with pcall (instead of resume) can be closed, because coroutine.close would not respect the expected number of results from the protected call.
* A coroutine can close itselfRoberto Ierusalimschy2025-06-121-9/+53
| | | | | A call to close itself will close all its to-be-closed variables and return to the resume that (re)started the coroutine.
* New way to control preambular declarationRoberto Ierusalimschy2025-05-202-2/+22
| | | | | Validity of the preambular global declaration in controled together with all declarations, when checking variable names.
* Proper error message when jumping into 'global *'Roberto Ierusalimschy2025-05-181-5/+8
| | | | | | A goto cannot jump into the scope of any variable declaration, including 'global *'. To report the error, it needs a "name" for the scope it is entering.
* Variable attributes can prefix name listRoberto Ierusalimschy2025-05-1813-25/+36
| | | | | In this format, the attribute applies to all names in the list; e.g. "global<const> print, require, math".
* DetailRoberto Ierusalimschy2025-05-161-2/+2
| | | | | Reports errors with "?:?:" (instead of "?:-1:") when there is no debug information.
* Collective declaration for globals ('global *')Roberto Ierusalimschy2025-05-1312-26/+61
|
* Correct line in error message for constant functionRoberto Ierusalimschy2025-05-121-0/+7
|
* New syntax 'global function'Roberto Ierusalimschy2025-05-082-1/+30
|
* Checks for read-only globalsRoberto Ierusalimschy2025-05-061-0/+10
|
* First implementation of global declarationsRoberto Ierusalimschy2025-05-053-4/+57
|
* Details (typos in comments)Roberto Ierusalimschy2025-04-2312-26/+26
|
* Order change in 'pushfuncname'Roberto Ierusalimschy2025-04-031-2/+2
| | | | | 'pushglobalfuncname' can be quite slow (as it traverses all globals and all loaded modules), so try first to get a name from the code.
* Tiny refactoring in io.flushRoberto Ierusalimschy2025-04-031-1/+18
|
* io.write returns number of written bytes on errorRoberto Ierusalimschy2025-04-031-0/+31
|
* DetailsRoberto Ierusalimschy2025-03-241-0/+0
| | | | | | Small changes in test library: - execute mode added to 'all.lua'; - more information about subtypes (tags) when printing a stack.
* New function 'resetCI'Roberto Ierusalimschy2025-03-171-0/+19
| | | | | | | | New function 'resetCI' resets the CallInfo list of a thread, ensuring a proper state when creating a new thread, closing a thread, or closing a state, so that we can run code after that. (When closing a thread, we need to run its __close metamethods; when closing a state, we need to run its __close metamethods and its finalizers.)
* Wrong error message when using "_ENV" fieldsRoberto Ierusalimschy2025-03-141-0/+3
| | | | | The string "_ENV" is erroneously identified as a variable _ENV, so that results from a field is classified as a global.
* Missing GC barrier in 'luaV_finishset'Roberto Ierusalimschy2025-03-141-0/+15
|
* Use after free in 'luaV_finishset'Roberto Ierusalimschy2025-03-131-1/+12
| | | | | | If a metatable is a weak table, its __newindex field could be collected by an emergency collection while being used in 'luaV_finishset'. (This bug has similarities with bug 5.3.2-1, fixed in commit a272fa66.)
* 'luaD_seterrorobj' should not raise errorsRoberto Ierusalimschy2025-03-121-2/+2
| | | | | | This function can be called unprotected, so it should not raise any kind of errors. (It could raise a memory-allocation error when creating a message).
* Removed copyright notice from 'testes/all.lua'Roberto Ierusalimschy2025-03-1232-60/+33
| | | | All test files refer to the main copyright notice in 'lua.h'.
* New test file 'memerr.lua'Roberto Ierusalimschy2025-03-124-243/+268
| | | | | | Tests for memory-allocation errors moved from 'api.lua' to this new file, as 'api.lua' was already too big. (Besides, these tests have nothing to do with the API.)
* Checks for type 'int' added to binary headerRoberto Ierusalimschy2025-03-101-17/+30
| | | | | The structure 'AbsLineInfo' is hard-dumped into binary chunks, and it comprises two 'int' fields.
* Error object cannot be nilRoberto Ierusalimschy2025-02-281-3/+3
| | | | | Lua will change a nil as error object to a string message, so that it never reports an error with nil as the error object.
* '__close' gets no error object if there is no errorRoberto Ierusalimschy2025-02-281-8/+36
| | | | | Instead of receiving nil as a second argument, __close metamethods are called with just one argument when there are no errors.
* 'lua_State.nci' must be an integerRoberto Ierusalimschy2025-02-261-0/+12
| | | | | | Lua can easily overflow an unsigned short counting nested calls. (The limit to this value is the maximum stack size, LUAI_MAXSTACK, which is currently 1e6.)
* DetailsRoberto Ierusalimschy2025-02-263-4/+28
| | | | | Comments, small changes in the manual, an extra test for errors in error handling, small changes in tests.
* CallInfo bit CIST_CLSRET broken in twoRoberto Ierusalimschy2025-01-281-6/+31
| | | | | | | | | Since commit f407b3c4a, it was being used for two distinct (and incompatible) meanings: A: Function has TBC variables (now bit CIST_TBC) B: Interpreter is closing TBC variables (original bit CIST_CLSRET) B implies A, but A does not imply B.
* Parameters for 'lua_createtable' back to intRoberto Ierusalimschy2025-01-211-2/+4
| | | | Tables don't accept sizes larger than int.
* fixing 'lua_status' in panic.Roberto Ierusalimschy2025-01-161-0/+19
| | | | | 'luaD_throw' may call 'luaE_resetthread', which returns an error code but clears 'L->status'; so, 'luaD_throw' should set that status again.
* DetailsRoberto Ierusalimschy2025-01-161-4/+3
| | | | New year (2024->2025), typos in comments
* Fixed conversion warnings from clangRoberto Ierusalimschy2025-01-141-1/+1
| | | | | Plus some other details. (Option '-Wuninitialized' was removed from the makefile because it is already enabled by -Wall.)
* Another way to compile goto'sRoberto Ierusalimschy2025-01-103-13/+37
| | | | | | | | | | | | The compilation of a goto or a label just create an entry and generate boilerplate code for the gotos. As we don't know yet whether it needs a CLOSE, we code a jump followed by a CLOSE, which is then dead code. When a block ends (and then we know for sure whether there are variables that need to be closed), we check the goto's against the labels of that block. When closing a goto against a label, if it needs a CLOSE, the compiler swaps the order of the jump and the CLOSE, making the CLOSE active.
* OP_SELF restricted to constant short stringsRoberto Ierusalimschy2024-12-111-1/+2
| | | | | | Optimize this opcode for the common case. For long names or method calls after too many constants, operation can be coded as a move followed by 'gettable'.
* New way to keep hints for table lengthRoberto Ierusalimschy2024-11-291-15/+14
| | | | | | | | | | Instead of using 'alimit' for keeping the size of the array and at the same time being a hint for '#t', a table now keeps these two values separate. The Table structure has a field 'asize' with the size of the array, while the length hint is kept in the array itself. That way, tables with no array part waste no space with that field. Moreover, the space for the hint may have zero cost for small arrays, if the array of tags plus the hint still fits in a single word.
* Change to macro 'LUAI_TRY'Roberto Ierusalimschy2024-11-251-0/+1
| | | | The call to 'f' is done by the macro, to give it more flexibility.
* Debug information about extra arguments from __callRoberto Ierusalimschy2024-11-193-0/+39
| | | | | | 'debug.getinfo' can return number of extra arguments added to a call by a chain of __call metavalues. That information is being used to improve error messages about errors in these extra arguments.
* Counter for length of chains of __call metamethodsRoberto Ierusalimschy2024-11-161-3/+20
| | | | | This counter will allow (in a later commit) error messages to correct argument numbers in functions called through __call metamethods.
* Add extra size when resizing tables with deleted keysRoberto Ierusalimschy2024-11-141-1/+61
| | | | | | | | Without this extra space, sequences of insertions/deletions (and some other uses) can have unpexpected low performances. See the added tests for an example, and *Mathematical Models to Analyze Lua Hybrid Tables and Why They Need a Fix* (Martínez, Nicaud, Rotondo; arXiv:2208.13602v2) for detais.