aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* New function 'resetCI'Roberto Ierusalimschy4 days2-19/+39
| | | | | | | | 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.)
* New function 'printallstack' in test libraryRoberto Ierusalimschy4 days2-0/+24
|
* Wrong error message when using "_ENV" fieldsRoberto Ierusalimschy7 days3-6/+16
| | | | | 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 Ierusalimschy8 days3-3/+19
|
* Use after free in 'luaV_finishset'Roberto Ierusalimschy8 days3-1/+25
| | | | | | 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 Ierusalimschy9 days5-22/+25
| | | | | | 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).
* Small changes in the manualRoberto Ierusalimschy9 days1-16/+22
|
* Removed copyright notice from 'testes/all.lua'Roberto Ierusalimschy10 days32-60/+33
| | | | All test files refer to the main copyright notice in 'lua.h'.
* New test file 'memerr.lua'Roberto Ierusalimschy10 days4-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.)
* Small correction in 'traverseweakvalue'Roberto Ierusalimschy10 days1-3/+3
| | | | | | After a weak table is traversed in the atomic phase, if it does not have white values ('hasclears') it does not need to be retraversed again. (Comments were correct, but code did not agree with them.)
* Checks for type 'int' added to binary headerRoberto Ierusalimschy11 days4-36/+67
| | | | | The structure 'AbsLineInfo' is hard-dumped into binary chunks, and it comprises two 'int' fields.
* DetailRoberto Ierusalimschy2025-02-281-0/+4
| | | | | Added macro LUA_FAILISFALSE to make easier to change the fail value from nil to false.
* Error object cannot be nilRoberto Ierusalimschy2025-02-284-8/+23
| | | | | 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-284-27/+60
| | | | | 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-263-3/+18
| | | | | | 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-265-9/+33
| | | | | Comments, small changes in the manual, an extra test for errors in error handling, small changes in tests.
* Array sizes in undump changed from unsigned to intRoberto Ierusalimschy2025-02-202-33/+27
| | | | | Array sizes are always int and are dumped as int, so there is no reason to read them back as unsigned.
* Added macro LUAI_STRICT_ADDRESSRoberto Ierusalimschy2025-02-182-10/+22
| | | | | By default, the code assumes it is safe to use a dealocated pointer as long as the code does not access it.
* Main thread is a regular field of global_StateRoberto Ierusalimschy2025-01-316-75/+65
| | | | | They were already allocated as a single block, so there is no need for the global_State to point to its main thread.
* New type 'TStatus' for thread status/error codesRoberto Ierusalimschy2025-01-3010-46/+56
|
* Details (in test library)Roberto Ierusalimschy2025-01-291-5/+16
| | | | | - Added support for negative stack indices in the "C interpreter" - Improved format when printing values
* CallInfo bit CIST_CLSRET broken in twoRoberto Ierusalimschy2025-01-284-15/+44
| | | | | | | | | 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.
* Renaming two new functionsRoberto Ierusalimschy2025-01-277-13/+13
| | | | | 'lua_numbertostrbuff' -> 'lua_numbertocstring' 'lua_pushextlstring' -> 'lua_pushexternalstring'
* Parameters for 'lua_createtable' back to intRoberto Ierusalimschy2025-01-217-16/+18
| | | | Tables don't accept sizes larger than int.
* Small change in macro 'isvalid'Roberto Ierusalimschy2025-01-161-3/+1
| | | | | The "faster way" to check whether a value is not 'nilvalue' is not faster. (Both forms entail one memory access.)
* fixing 'lua_status' in panic.Roberto Ierusalimschy2025-01-163-2/+28
| | | | | '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-1615-25/+24
| | | | New year (2024->2025), typos in comments
* Fixed conversion warnings from clangRoberto Ierusalimschy2025-01-149-13/+17
| | | | | Plus some other details. (Option '-Wuninitialized' was removed from the makefile because it is already enabled by -Wall.)
* Error "break outside loop" made a syntax errorRoberto Ierusalimschy2025-01-131-11/+14
| | | | Syntax errors are easier to handle than semantic errors.
* Details in lparser.cRoberto Ierusalimschy2025-01-101-10/+13
| | | | | | Added comments so that all braces pair correctly. (The parser has several instances of unmatched braces as characters ('{' or '}'), which hinders matching regular braces in the code.)
* New optimization option for testingRoberto Ierusalimschy2025-01-101-1/+1
| | | | Using gcc's option '-Og' (instead of '-O0') for testing/debugging.
* Improvements in the manualRoberto Ierusalimschy2025-01-104-18/+23
| | | | Plus details
* Another way to compile goto'sRoberto Ierusalimschy2025-01-106-121/+119
| | | | | | | | | | | | 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.
* DetailRoberto Ierusalimschy2025-01-061-2/+6
| | | | Small improvement in line-tracing for internal debugging.
* Detail (debugging aid)Roberto Ierusalimschy2025-01-062-4/+6
| | | | | When compiling with option HARDMEMTESTS, every creation of a new key in a table forces an emergency GC.
* Scanner doesn't need to anchor reserved wordsRoberto Ierusalimschy2024-12-302-12/+20
|
* Small optimization in 'luaH_psetshortstr'Roberto Ierusalimschy2024-12-281-18/+63
| | | | | | | Do not optimize only for table updates (key already present). Creation of new short keys in new tables can be quite common in programs that create lots of small tables, for instance with constructors like {x=e1,y=e2}.
* When parser reuses constants, only floats can collideRoberto Ierusalimschy2024-12-281-26/+28
| | | | | Ensure that float constants never use integer keys, so that only floats can collide in 'k2proto'.
* Detail in 'luaD_inctop'Roberto Ierusalimschy2024-12-171-1/+1
| | | | | | Protect stack top before possible stack reallocation. (In the current implementation, a stack reallocation cannot call an emergency collection, so there is no bug, but it is safer not to depend on that.)
* Scanner and parser use different tables for constantsRoberto Ierusalimschy2024-12-176-28/+20
| | | | | | | | | | Moreover, each function being parsed has its own table. The code is cleaner when each table is used for one specific purpose: The scanner uses its table to anchor and unify strings, mapping strings to themselves; the parser uses it to reuse constants in the code, mapping constants to their indices in the constant table. A different table for each task avoids false collisions.
* 'addk' broken in two functionsRoberto Ierusalimschy2024-12-161-19/+28
|
* 'luaH_fastseti' uses 'checknoTM'Roberto Ierusalimschy2024-12-111-1/+1
| | | | | | The extra check in checknoTM (versus only checking whether there is a metatable) is cheap, and it is not that uncommon for a table to have a metatable without a __newindex metafield.
* OP_SELF restricted to constant short stringsRoberto Ierusalimschy2024-12-115-34/+35
| | | | | | 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'.
* Rehash reinserts elements with "lighter" functionsRoberto Ierusalimschy2024-12-051-17/+33
| | | | | | | | | | | | When reinserting elements into a table during a rehash, the code does not need to invoke all the complexity of a full 'luaH_set': - The table has space for all keys. - The key cannot exist in the new hash. - The keys are valid (not NaN nor nil). - The keys are normalized (1.0 -> 1). - The values cannot be nil. - No barrier needed (the table already pointed to the key and value).
* Refactoring of 'luaH_newkey'Roberto Ierusalimschy2024-12-052-56/+79
| | | | | Function broke in two and some checks moved to the caller. (We may want to call it without the checks.)
* Fix in the definition of 'sizeLclosure'Roberto Ierusalimschy2024-12-031-1/+1
| | | | | | | The array at the end of a Lua closure has pointers to upvalues, not to tagged values. This bug cannot cause any issue: The ISO C standard requires that all pointers to structures have the same representation, so sizeof(TValue*) must be equal to sizeof(UpVal*).
* New function 'lua_printvalue' for internal debuggingRoberto Ierusalimschy2024-12-022-4/+43
|
* DetailsRoberto Ierusalimschy2024-11-291-2/+2
| | | | Added two warnings to the makefile.
* New way to keep hints for table lengthRoberto Ierusalimschy2024-11-297-249/+146
| | | | | | | | | | 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.
* Avoid an extra call to 'concretesize' in 'resizearray'Roberto Ierusalimschy2024-11-271-5/+5
|