aboutsummaryrefslogtreecommitdiff
path: root/lvm.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* New conceptual model for varargRoberto I2025-11-261-2/+3
| | | | | | Conceptually, all functions get their vararg arguments in a vararg table. The storing of vararg arguments in the stack is always treated as an optimization.
* External strings are as good as internal onesRoberto I2025-11-111-2/+7
| | | | A '__mode' metafield and an "n" key both can be external strings.
* Global initialization checks name conflictRoberto I2025-11-081-0/+6
| | | | | Initialization "global a = 10" raises an error if global 'a' is already defined, that is, it has a non-nil value.
* DetailsRoberto I2025-10-311-1/+9
| | | | | | - New macro l_strcoll to ease changing 'strcoll' to something else. - MAXINDEXRK==1 in 'ltests.h' is enough to run test 'code.lua'. - Removed unused '#include' in 'lutf8lib.c'.
* Optimization for vararg tablesRoberto I2025-09-241-0/+6
| | | | | | | 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.
* Vararg tableRoberto I2025-09-161-1/+1
| | | | Not yet optimized nor documented.
* Added limit to number of elements in a constructorRoberto I2025-08-271-1/+1
| | | | | The reasoning in commit 519c57d5 is wrong: A sequence of nils generates several fields with just one OP_LOADNIL.
* Removed code for compatibility with version 5.3Roberto I2025-08-201-6/+0
|
* Keep the order left-right in shiftsRoberto I2025-08-201-8/+8
| | | | | Opcodes OP_SHLI-OP_SHRI and the cases for opcodes OP_SHL-OP_SHR were out of order.
* Small cleaning servicesRoberto I2025-08-201-25/+29
|
* Randomness added to table length computationRoberto Ierusalimschy2025-07-181-1/+1
| | | | | | | 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.
* Short strings can be external, tooRoberto Ierusalimschy2025-07-151-42/+64
| | | | | | | 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.)
* Details (typos in comments)Roberto Ierusalimschy2025-04-231-1/+1
|
* New macro 'l_numbits'Roberto Ierusalimschy2025-03-271-1/+1
|
* Missing GC barrier in 'luaV_finishset'Roberto Ierusalimschy2025-03-141-1/+3
|
* Use after free in 'luaV_finishset'Roberto Ierusalimschy2025-03-131-0/+8
| | | | | | 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.)
* DetailsRoberto Ierusalimschy2025-01-161-2/+2
| | | | New year (2024->2025), typos in comments
* Another way to compile goto'sRoberto Ierusalimschy2025-01-101-0/+1
| | | | | | | | | | | | 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.
* OP_SELF restricted to constant short stringsRoberto Ierusalimschy2024-12-111-3/+3
| | | | | | 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-1/+1
| | | | | | | | | | 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.
* Added gcc option '-Wconversion'Roberto Ierusalimschy2024-07-271-18/+19
| | | | | No warnings for standard numerical types. Still pending alternative numerical types.
* 'nresults' moved into 'callstatus'Roberto Ierusalimschy2024-07-211-3/+3
| | | | That gives us more free bits in 'callstatus', for future use.
* New instruction format for SETLIST/NEWTABLERoberto Ierusalimschy2024-06-281-10/+15
| | | | | | New instruction format 'ivABC' (a variant of iABC where parameter vC has 10 bits) allows constructors of up to 1024 elements to be coded without EXTRAARG.
* 'isIT'/'isOT' turned from macros to functionsRoberto Ierusalimschy2024-06-271-2/+2
|
* Cleaning of llimits.hRoberto Ierusalimschy2024-06-201-0/+9
| | | | | | Several definitions that don't need to be "global" (that is, that concerns only specific parts of the code) moved out of llimits.h, to more appropriate places.
* Encoding of table indices (hres) must use C indicesRoberto Ierusalimschy2024-06-101-1/+1
| | | | | As the encoding of array indices is (~index), 0 is encoded as -1 and INT_MAX is encoded as INT_MIN.
* DetailsRoberto Ierusalimschy2024-05-081-4/+4
| | | | | Corrections in comments and manual. Added note in the manual about local variables in the REPL.
* Fixed dangling 'StkId' in 'luaV_finishget'Roberto Ierusalimschy2024-03-291-5/+5
| | | | Bug introduced in 05932567.
* 'luaH_get' functions return tag of the resultRoberto Ierusalimschy2024-03-211-31/+30
| | | | | | | Undoing previous commit. Returning TValue increases code size without any visible gains. Returning the tag is a little simpler than returning a special code (HOK/HNOTFOUND) and the tag is useful by itself in some cases.
* 'luaH_get' functions return 'TValue'Roberto Ierusalimschy2024-03-181-26/+28
| | | | | | Instead of receiving a parameter telling them where to put the result of the query, these functions return the TValue directly. (That is, they return a structure.)
* Merge branch 'master' into nextversionRoberto Ierusalimschy2024-01-251-1/+1
|\
| * Bug: Buffer overflow in string concatenationRoberto Ierusalimschy2023-12-211-1/+1
| | | | | | | | | | Even if the string fits in size_t, the whole size of the TString object can overflow when we add the header.
* | Merge branch 'newarray' into nextversionRoberto Ierusalimschy2023-11-071-76/+59
|\ \
| * | Merge branch 'master' into newarrayRoberto Ierusalimschy2023-11-031-39/+37
| |\|
| * | Full abstraction for representation of array valuesRoberto Ierusalimschy2023-10-301-1/+1
| | |
| * | Some cleaning in the new table APIRoberto Ierusalimschy2023-05-161-59/+53
| | |
| * | New table API for 'set' functionsRoberto Ierusalimschy2023-05-161-32/+32
| | |
| * | Towards a new implementation of arraysRoberto Ierusalimschy2023-05-151-39/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The array part of a table wastes too much space, due to padding. To avoid that, we need to store values in the array as something different from a TValue. Therefore, the API for table access should not assume that any value in a table lives in a *TValue. This commit is the first step to remove that assumption: functions luaH_get*, instead of returning a *TValue where the value lives, receive a *TValue where to put the value being accessed. (We still have to change the luaH_set* functions.)
* | | New macro 'getlstr'Roberto Ierusalimschy2023-08-301-7/+10
| | | | | | | | | | | | Accesses content and length of a 'TString'.
* | | Merge branch 'master' into nextversionRoberto Ierusalimschy2023-08-231-17/+13
|\ \ \ | | |/ | |/|
| * | More disciplined use of 'getstr' and 'tsslen'Roberto Ierusalimschy2023-08-171-7/+10
| | | | | | | | | | | | | | | We may want to add other string variants in the future; this change documents better where the code may need to handle those variants.
| * | Bug: Call hook may be called twice when count hook yieldsRoberto Ierusalimschy2023-07-251-10/+3
| | | | | | | | | | | | | | | Took the opportunity and moved the code that controls call hooks in 'luaV_execute' into a function.
* | | Merge branch 'master' into nextversionRoberto Ierusalimschy2023-06-221-22/+28
|\| |
| * | Bug: read overflow in 'l_strcmp'Roberto Ierusalimschy2023-06-141-18/+20
| | | | | | | | | | | | | | | Equality according to 'strcoll' does not imply that strings have the same length.
| * | DetailsRoberto Ierusalimschy2023-05-151-4/+4
| |/ | | | | | | | | - Better comments about short strings in opcodes. - luaH_newkey made static.
| * Bug: Wrong line in error message for arith. errorsRoberto Ierusalimschy2023-02-081-0/+4
| | | | | | | | | | It also causes 'L->top' to be wrong when the error happens, triggering an 'assert'.
* | Changes in opcodes for generic 'for'Roberto Ierusalimschy2022-12-221-15/+25
| | | | | | | | | | Again, as the control variable is read only, the code doesn't need to keep an internal copy of it.
* | Simplification in opcodes for numerical 'for'Roberto Ierusalimschy2022-12-211-25/+25
|/ | | | | As the control variable is read only, the code doesn't need to keep an internal copy of it.
* Stack indices changed to union'sRoberto Ierusalimschy2022-10-291-50/+50
| | | | | That will allow to change pointers to offsets while reallocating the stack.