aboutsummaryrefslogtreecommitdiff
path: root/lvm.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Negation in constant folding of '>>' may overflowRoberto Ierusalimschy2022-09-231-3/+1
|
* 'luaV_concat' can use invalidated pointer to stackRoberto Ierusalimschy2022-05-231-3/+3
| | | | Bug introduced in commit 42d40581.
* Save stack space while handling errorsRoberto Ierusalimschy2022-05-201-2/+4
| | | | | | | | | | Because error handling (luaG_errormsg) uses slots from EXTRA_STACK, and some errors can recur (e.g., string overflow while creating an error message in 'luaG_runerror', or a C-stack overflow before calling the message handler), the code should use stack slots with parsimony. This commit fixes the bug "Lua-stack overflow when C stack overflows while handling an error".
* DetailsRoberto Ierusalimschy2022-04-011-1/+1
| | | | | Comments + manual + identation + asserts about stack limits that were not allowing the use of the full stack
* Avoid computing invalid addressesRoberto Ierusalimschy2022-02-181-32/+89
| | | | | | luaV_execute should compute 'ra' only when the instruction uses it. Computing an illegal address is undefined behavior even if the address is never dereferenced.
* More uniform implementation for tail callsRoberto Ierusalimschy2021-10-291-14/+5
| | | | | | | | | | | 'luaD_pretailcall' mimics 'luaD_precall', handling call metamethods and calling C functions directly. That makes the code in the interpreter loop simpler. This commit also goes back to emulating the tail call in 'luaD_precall' with a goto, as C compilers may not do proper tail calls and the C stack can overflow much sooner than the Lua stack (which grows as the metamethod is added to it).
* DocumentationRoberto Ierusalimschy2021-10-111-1/+1
| | | | | Better explanation about the guaranties of multiple assignment in the manual.
* Using 'inline' in some functionsRoberto Ierusalimschy2021-09-151-6/+6
| | | | | According to ISO C, "making a function an inline function suggests that calls to the function be as fast as possible." (Not available in C89.)
* 'luaD_tryfuncTM' checks stack space by itselfRoberto Ierusalimschy2021-08-181-5/+6
|
* Undo simplification of tail calls (commit 901d760)Roberto Ierusalimschy2021-08-181-4/+17
| | | | Not that simpler and slower.
* Bug: Negation in 'luaV_shiftr' may overflowRoberto Ierusalimschy2021-07-221-1/+1
| | | | Negation of an unchecked lua_Integer overflows with mininteger.
* Simplification in the parameters of 'luaD_precall'Roberto Ierusalimschy2021-06-301-2/+2
| | | | | | The parameters 'nresults' and 'delta1', in 'luaD_precall', were never meaningful simultaneously. So, they were combined in a single parameter 'retdel'.
* C functions can be tail called, tooRoberto Ierusalimschy2021-06-141-8/+1
| | | | | A tail call to a C function can have the behavior of a "real" tail call, reusing the stack frame of the caller.
* Simpler implementation for tail callsRoberto Ierusalimschy2021-06-111-13/+7
| | | | | Tail calls handled by 'luaD_precall', like regular calls, to avoid code duplication.
* Bug: yielding in '__close' mess up number of returnsRoberto Ierusalimschy2021-04-161-1/+11
| | | | | Yielding in a __close metamethod called when returning vararg results changes the top and so messes up the number of returned values.
* Bug: Lua source should not use C99 comments ("//")Roberto Ierusalimschy2021-04-101-2/+4
|
* Don't use tointegerns when luaV_tointegerns will doRoberto Ierusalimschy2021-02-241-2/+7
| | | | | | | | Some places don't need the "fast path" macro tointegerns, either because speed is not essential (lcode.c) or because the value is not supposed to be an integer already (luaV_equalobj and luaG_tointerror). Moreover, luaV_equalobj should always use F2Ieq, even if Lua is compiled to "round to floor".
* DetailsRoberto Ierusalimschy2021-02-241-2/+2
| | | | | Added documentation and asserts that constants for arithmetic opcodes must be numbers.
* Broadening the use of branch hintsRoberto Ierusalimschy2021-02-241-19/+20
| | | | | | More uses of macros 'likely'/'unlikely' (renamed to 'l_likely'/'l_unlikely'), both in range (extended to the libraries) and in scope (extended to hooks, stack growth).
* New implementation for to-be-closed variablesRoberto Ierusalimschy2021-02-091-4/+2
| | | | | | | | To-be-closed variables are linked in their own list, embedded into the stack elements. (Due to alignment, this information does not change the size of the stack elements in most architectures.) This new list does not produce garbage and avoids memory errors when creating tbc variables.
* Fixed some bugs around stack reallocationRoberto Ierusalimschy2021-02-051-0/+2
| | | | Long time without using HARDSTACKTESTS...