aboutsummaryrefslogtreecommitdiff
path: root/lcode.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Removed arithmetic opcodes with immediate operandRoberto Ierusalimschy2019-09-101-8/+8
| | | | | | | The difference in performance between immediate operands and K operands does not seem to justify all those extra opcodes. We only keep OP_ADDI, due to its ubiquity and because the difference is a little more relevant. (Later, OP_SUBI will be implemented by OP_ADDI, negating the constant.)
* Use of 'MMBIN' opcodes extended to shift operatorsRoberto Ierusalimschy2019-08-281-11/+15
| | | | Plus, this commit removes useless 'tm' parameters in 'op_*' macros.
* First version of OP_MMBIN opcodesRoberto Ierusalimschy2019-08-271-19/+27
| | | | | | | | | | | In arithmetic/bitwise operators, the call to metamethods is made in a separate opcode following the main one. (The main opcode skips this next one when the operation succeeds.) This change reduces slightly the size of the binary and the complexity of the arithmetic/bitwise opcodes. It also simplfies the treatment of errors and yeld/resume in these operations, as there are much fewer cases to consider. (Only OP_MMBIN/OP_MMBINI/OP_MMBINK, instead of all variants of all arithmetic/bitwise operators.)
* Fixed small issue with constant propagationRoberto Ierusalimschy2019-07-171-3/+15
| | | | | | | | Constants directly assigned to other constants were not propagating: For instance, in local <const> k1 = 10 local <const> k2 = k1 'k2' were not treated as a compile-time constant.
* New kind of expression VKSTRRoberto Ierusalimschy2019-07-171-10/+25
| | | | | | | String literal expressions have their own kind VKSTR, instead of the generic VK. This allows strings to "cross" functions without entering their constant tables (e.g., if they are used only by some nested function).
* Micro optimization in OP_RETURN and OP_TAILCALLRoberto Ierusalimschy2019-07-161-4/+4
| | | | | Many functions are vararg but create no upvalues, so it is better to separate the tests for these two kinds of "extra work".
* Unification of size representation in OP_NEWTABLE and OP_SETLISTRoberto Ierusalimschy2019-07-151-12/+28
| | | | | | Opcodes OP_NEWTABLE and OP_SETLIST use the same representation to store the size of the array part of a table. This new representation can go up to 2^33 (8 + 25 bits).
* OP_NEWTABLE keeps exact size of arraysRoberto Ierusalimschy2019-07-121-3/+3
| | | | | | OP_NEWTABLE is followed by an OP_EXTRAARG, so that it can keep the exact size of the array part of the table to be created. (Functions 'luaO_int2fb'/'luaO_fb2int' were removed.)
* First implementation of constant propagationRoberto Ierusalimschy2019-07-121-1/+55
| | | | | Local constant variables initialized with compile-time constants are optimized away from the code.
* Towards constant propagationRoberto Ierusalimschy2019-07-101-2/+2
| | | | | | | This commit detaches the number of active variables from the number of variables in the stack, during compilation. Soon, compile-time constants will be propagated and therefore will not exist during run time (in the stack).
* New implementation for constantsRoberto Ierusalimschy2019-07-091-47/+13
| | | | | | | | | VLOCAL expressions keep a reference to their corresponding 'Vardesc', and 'Upvaldesc' (for upvalues) has a field 'ro' (read-only). So, it is easier to check whether a variable is read-only. The decoupling in VLOCAL between 'vidx' ('Vardesc' index) and 'sidx' (stack index) should also help the forthcoming implementation of compile-time constant propagation.
* First take on constant propagationRoberto Ierusalimschy2019-07-011-14/+48
|
* First implementation for 'const' variablesRoberto Ierusalimschy2019-05-171-15/+21
| | | | | A variable can be declared const, which means it cannot be assigned to, with the syntax 'local <const> name = exp'.
* Keep correct type for immediate operands in comparisonsRoberto Ierusalimschy2019-03-221-19/+23
| | | | | | | | | | | | When calling metamethods for things like 'a < 3.0', which generates the opcode OP_LTI, the C register tells that the operand was converted to an integer, so that it can be corrected to float when calling a metamethod. This commit also includes some other stuff: - file 'onelua.c' added to the project - opcode OP_PREPVARARG renamed to OP_VARARGPREP - comparison opcodes rewritten through macros
* Added opcodes for arithmetic with K operandsRoberto Ierusalimschy2018-11-231-53/+73
| | | | | | | | Added opcodes for all seven arithmetic operators with K operands (that is, operands that are numbers in the array of constants of the function). They cover the cases of constant float operands (e.g., 'x + .0.0', 'x^0.5') and large integer operands (e.g., 'x % 10000').
* Big revamp in the implmentation of labels/gotosRoberto Ierusalimschy2018-10-291-34/+0
| | | | | | | | Added restriction that, when a label is created, there cannot be another label with the same name visible. That allows backward goto's to be resolved when they are read. Backward goto's get a close if they jump out of the scope of some variable; labels get a close only if previous goto to it jumps out of the scope of some upvalue.
* Towards "to closed" local variablesRoberto Ierusalimschy2018-10-081-2/+2
| | | | | | | | | | | | Start of the implementation of "scoped variables" or "to be closed" variables, local variables whose '__close' (or themselves) are called when they go out of scope. This commit implements the syntax, the opcode, and the creation of the corresponding upvalue, but it still does not call the finalizations when the variable goes out of scope (the most important part). Currently, the syntax is 'local scoped name = exp', but that will probably change.
* Fixed bug in line info. when using 'not' operatorRoberto Ierusalimschy2018-07-111-23/+53
| | | | | | | | | When creating code for a jump on a 'not' condition, the code generator was removing an instruction (the OP_NOT) without adjusting its corresponding line information. This fix also added tests for this case and extra functionality in the test library to debug line info. structures.
* no more nil-in-tableRoberto Ierusalimschy2018-04-041-52/+3
|
* FALLTHROUGH comment must be last "statement"Roberto Ierusalimschy2018-03-161-3/+2
| | | | (so it does not work when inside a block)
* new experimental syntax using reserved word 'undef'Roberto Ierusalimschy2018-03-071-3/+60
|
* better names for macros for tags and types.Roberto Ierusalimschy2018-02-261-2/+2
| | | | | rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag; tnov -> ttype
* new opcodes OP_GTI/OP_GEIRoberto Ierusalimschy2018-02-211-18/+12
|
* small reorganization of 'luaV_flttointeger'/'luaV_tointeger'Roberto Ierusalimschy2018-02-211-4/+2
|
* correct way to check stack space for vararg functionsRoberto Ierusalimschy2018-02-171-2/+2
|