aboutsummaryrefslogtreecommitdiff
path: root/lcode.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.)
* 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'.
* Scanner and parser use different tables for constantsRoberto Ierusalimschy2024-12-171-6/+6
| | | | | | | | | | 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
|
* OP_SELF restricted to constant short stringsRoberto Ierusalimschy2024-12-111-16/+27
| | | | | | 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'.
* DetailsRoberto Ierusalimschy2024-09-061-2/+2
| | | | Identation + comments
* 'lcode.c' can use 'checklimit', tooRoberto Ierusalimschy2024-08-201-7/+3
|
* A return can have at most 254 valuesRoberto Ierusalimschy2024-08-191-0/+2
|
* Bug: wrong code gen. for indices with comparisonsRoberto Ierusalimschy2024-08-171-1/+2
| | | | | | | 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.
* Added gcc option '-Wconversion'Roberto Ierusalimschy2024-07-271-17/+17
| | | | | No warnings for standard numerical types. Still pending alternative numerical types.
* Explicit limit for number of results in a callRoberto Ierusalimschy2024-07-181-0/+2
| | | | | | The parameter 'nresults' in 'lua_call' and similar functions has a limit of 250. It already had an undocumented (and unchecked) limit of SHRT_MAX, but it is seldom larger than 2.
* New instruction format for SETLIST/NEWTABLERoberto Ierusalimschy2024-06-281-25/+34
| | | | | | 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-1/+3
|
* Flexible limit for use of registers by constructorsRoberto Ierusalimschy2024-06-271-1/+1
| | | | | | | | 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.
* Clearer code for controlling maximum registersRoberto Ierusalimschy2024-06-261-5/+1
| | | | Plus, added a test to check that limit.
* Cleaning of llimits.hRoberto Ierusalimschy2024-06-201-3/+3
| | | | | | 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.
* Bug: overlapping assignmentsRoberto Ierusalimschy2024-06-121-2/+4
| | | | | ISO C forbids assignment of a union field to another field of the same union.
* 'luaH_get' functions return tag of the resultRoberto Ierusalimschy2024-03-211-2/+3
| | | | | | | 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-3/+2
| | | | | | 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 'newarray' into nextversionRoberto Ierusalimschy2023-11-071-4/+4
|\
| * Merge branch 'master' into newarrayRoberto Ierusalimschy2023-11-031-14/+15
| |\
| * | Some cleaning in the new table APIRoberto Ierusalimschy2023-05-161-4/+4
| | |
* | | Field 'Proto.is_vararg' uses only one bitRoberto Ierusalimschy2023-08-301-2/+2
| |/ |/| | | | | So that the other bits can be used for other purposes.
* | Several functions turned 'static'Roberto Ierusalimschy2023-05-221-11/+11
| | | | | | | | | | Several functions that were already being used only inside their own file have been declared as 'static'.
* | DetailsRoberto Ierusalimschy2023-05-151-3/+4
|/ | | | | - Better comments about short strings in opcodes. - luaH_newkey made static.
* More orderliness in casts of enumerationsRoberto Ierusalimschy2023-03-271-14/+41
|
* More regularity in uses of enums in 'lcode.c'Roberto Ierusalimschy2023-03-241-18/+18
|
* Factoring out common parts of 'codearith' and 'codebitwise'Roberto Ierusalimschy2022-05-061-25/+33
|
* Bug: Wrong code generation in bitwise operationsRoberto Ierusalimschy2022-04-251-6/+10
|
* DetailRoberto Ierusalimschy2022-01-031-1/+1
| | | | Warnings with clang when using long double for Lua floats.
* Changes in cache for function constantsRoberto Ierusalimschy2021-03-301-8/+26
| | | | | | | | In 'lcode.c', when adding constants to the list of constants of a function, integers represent themselves in the cache and floats with integral values get a small delta to avoid collision with integers. (This change avoids creating artificial addresses; the old implementation converted integers to pointers to index the cache.)
* Don't use tointegerns when luaV_tointegerns will doRoberto Ierusalimschy2021-02-241-1/+2
| | | | | | | | 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".
* Optimization/simplification of 'getbaseline'Roberto Ierusalimschy2021-02-021-2/+2
| | | | | By producing absolute line information at regular intervals, a simple division can compute the correct entry for a given instruction.
* Optimizations for line hookRoberto Ierusalimschy2021-01-281-9/+0
| | | | | The function 'changedline' tries harder to avoid calling 'luaG_getfuncline' plus small changes in the use of 'L->oldpc'.
* Changes in the API of 'luaH_set' and related functionsRoberto Ierusalimschy2020-12-041-2/+6
| | | | | Functions to set values in a table (luaH_set, luaH_newkey, etc.) receive the new value, instead of returning a slot where to put the value.
* DetailsRoberto Ierusalimschy2020-12-021-3/+3
| | | | Names in the parser and other details that do not change actual code.
* DetailsRoberto Ierusalimschy2020-10-301-5/+9
| | | | | | - small corrections in the manual - ldo.c: 'docall' -> 'ccall' ('docall' already used in 'lua.c') - comments
* Fixed "conceptual" bug in 'luaK_setreturns'Roberto Ierusalimschy2020-03-021-4/+3
| | | | | | | | This function was computing invalid instruction addresses when the expression was not a multi-return instruction. (Virtually all machines don't raise errors when computing an invalid address, as long as the address is not accessed, but this computation is undefined behavior in ISO C.)
* DetailsRoberto Ierusalimschy2020-02-271-10/+5
| | | | | Several details in code (e.g., moving a variable to the most inner scope that encloses its uses), comments, parameter names, extra tests.
* OP_LOADFALSE broken in two instructionsRoberto Ierusalimschy2020-02-111-4/+4
|
* Clearer distinction between types and tagsRoberto Ierusalimschy2020-01-311-6/+6
| | | | | LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
* Changed internal representation of booleansRoberto Ierusalimschy2020-01-061-15/+35
| | | | | | | Instead of an explicit value (field 'b'), true and false use different tag variants. This avoids reading an extra field and results in more direct code. (Most code that uses booleans needs to distinguish between true and false anyway.)
* Comments (mosty typos)Roberto Ierusalimschy2019-12-301-1/+1
|
* Using an enumeration for float->integer coercion modesRoberto Ierusalimschy2019-12-051-2/+2
|
* Fixed warnings from Keil compilerRoberto Ierusalimschy2019-10-251-1/+1
|
* Fixed a warning and other minor issuesRoberto Ierusalimschy2019-10-041-2/+2
| | | | Fixed some minor issues from the feedback for 5.4-beta rc1.
* Janitorial workRoberto Ierusalimschy2019-10-011-32/+29
| | | | | | | - Several details in 'lcode.c' - A few more tests for code generation - Bug in assert in 'lcode.c' ("=" x "==") - Comments in 'lopcodes.h' and 'ltable.c'
* Subtraction of small constant integers optimized with OP_ADDIRoberto Ierusalimschy2019-09-241-27/+41
|
* Janitorial work in 'lcode.c'Roberto Ierusalimschy2019-09-191-33/+25
|
* Simplification in the call to 'constfolding'Roberto Ierusalimschy2019-09-111-15/+11
|