summaryrefslogtreecommitdiff
path: root/lopcodes.h
Commit message (Collapse)AuthorAgeFilesLines
* DetailsRoberto Ierusalimschy2021-03-291-4/+17
| | | | Comments and small improvements in the manual.
* DetailsRoberto Ierusalimschy2021-02-241-7/+7
| | | | | Added documentation and asserts that constants for arithmetic opcodes must be numbers.
* DetailsRoberto Ierusalimschy2020-10-121-2/+2
| | | | | | | - After converting a generic GCObject to a specific type ('gco2*'), avoid using the original GCObject (to reduce aliasing). - Small corrections in comments in 'lopcodes.h' - Added tests about who calls __close metamethods
* Several details about 5.4.0 rc1Roberto Ierusalimschy2020-04-231-10/+10
| | | | | Corrected several small details: added 'const', adjusts in tabs x spaces, removed unused #includes and #defines, misspellings, etc.
* Added 'simplesect' sections to the manualRoberto Ierusalimschy2020-04-131-1/+1
| | | | | | | 'simplesect' encloses the introductory text of sections with subsections, so that each section either is all text or is all subsections. (This commit also corrects a small brace error in the manual and extra spaces/tabs in some other files.)
* OP_LOADFALSE broken in two instructionsRoberto Ierusalimschy2020-02-111-1/+2
|
* Clearer distinction between types and tagsRoberto Ierusalimschy2020-01-311-5/+5
| | | | | LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
* Changed internal representation of booleansRoberto Ierusalimschy2020-01-061-1/+2
| | | | | | | 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.)
* Better comments about the use of 'k' in opcodesRoberto Ierusalimschy2019-12-051-19/+23
|
* DetailsRoberto Ierusalimschy2019-11-181-2/+2
|
* Comments in 'lopcodes.h'Roberto Ierusalimschy2019-11-071-92/+92
| | | | | Both 'R' and 'K' are arrays, so the comments should use square brackets to index them.
* Janitorial workRoberto Ierusalimschy2019-10-011-4/+4
| | | | | | | - 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'
* Janitorial work in 'lcode.c'Roberto Ierusalimschy2019-09-191-5/+8
|
* Removed arithmetic opcodes with immediate operandRoberto Ierusalimschy2019-09-101-6/+0
| | | | | | | 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.)
* Added macro 'testMMMode'Roberto Ierusalimschy2019-09-061-1/+4
| | | | Macro 'testMMMode' checks whether opcode is an MM opcode.
* First version of OP_MMBIN opcodesRoberto Ierusalimschy2019-08-271-0/+4
| | | | | | | | | | | 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.)
* Micro optimization in OP_RETURN and OP_TAILCALLRoberto Ierusalimschy2019-07-161-4/+3
| | | | | 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-13/+10
| | | | | | 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-1/+9
| | | | | | 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.)
* Details (typos in comments)Roberto Ierusalimschy2019-07-051-3/+3
|
* A few changes in tests about number of bits in integersRoberto Ierusalimschy2019-05-131-5/+11
| | | | | | - The preprocessor must work with at least 'long', and therefore must do shifts of up to 31 bits correctly. - Whenever possible, use unsigned types in shifts.
* Keep correct type for immediate operands in comparisonsRoberto Ierusalimschy2019-03-221-1/+4
| | | | | | | | | | | | 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
* New semantics for the integer 'for' loopRoberto Ierusalimschy2019-03-191-4/+0
| | | | | | | | | | | The numerical 'for' loop over integers now uses a precomputed counter to control its number of iteractions. This change eliminates several weird cases caused by overflows (wrap-around) in the control variable. (It also ensures that every integer loop halts.) Also, the special opcodes for the usual case of step==1 were removed. (The new code is already somewhat complex for the usual case, but efficient.)
* DetailsRoberto Ierusalimschy2019-03-131-8/+7
| | | | | | | | | | Several small improvements (code style, warnings, comments, more tests), in particular: - 'lua_topointer' extended to handle strings - raises an error in 'string.format("%10q")' ('%q' with modifiers) - in the manual for 'string.format', the term "option" replaced by "conversion specifier" (the term used by the C standard)
* Added opcodes for arithmetic with K operandsRoberto Ierusalimschy2018-11-231-0/+10
| | | | | | | | 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').
* To-be-closed variable in 'for' loop separated from the stateRoberto Ierusalimschy2018-11-071-3/+3
| | | | | | | | | The variable to be closed in a generic 'for' loop now is the 4th value produced in the loop initialization, instead of being the loop state (the 2nd value produced). That allows a loop to use a state with a '__toclose' metamethod but do not close it. (As an example, 'f:lines()' might use the file 'f' as a state for the loop, but it should not close the file when the loop ends.)
* Big revamp in the implmentation of labels/gotosRoberto Ierusalimschy2018-10-291-6/+3
| | | | | | | | 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.
* More uniformity in code generation for 'for' loopsRoberto Ierusalimschy2018-10-261-0/+1
| | | | | | | Added new instruction 'OP_TFORPREP' to prepare a generic for loop. Currently it is equivalent to a jump (but with a format 'iABx', similar to other for-loop preparing instructions), but soon it will be the place to create upvalues for closing loop states.
* Towards "to closed" local variablesRoberto Ierusalimschy2018-10-081-0/+1
| | | | | | | | | | | | 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.
* Removed extra information from RCS keyword stringsRoberto Ierusalimschy2018-08-231-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all source files; only the file name are kept.
* Opcode names moved to a new header fileRoberto Ierusalimschy2018-07-091-4/+1
| | | | | | | The array with the names of the opcodes was moved to a header file ('lopnames.h'), as it is not used by the Lua kernel. Files that need that array ('luac.c' and 'ltests.c') include the header file to get a private (static) copy.
* change in 'LUAI_DDEC' to allow variables to be static in 'onelua'Roberto Ierusalimschy2018-06-181-3/+3
| | | | + change in 'LUAMOD_API' as opening functions do not need to be global
* detail in commentRoberto Ierusalimschy2018-06-081-2/+2
|
* no more nil-in-tableRoberto Ierusalimschy2018-04-041-4/+1
|
* new experimental syntax using reserved word 'undef'Roberto Ierusalimschy2018-03-071-1/+4
|
* new opcodes OP_GTI/OP_GEIRoberto Ierusalimschy2018-02-211-6/+3
|
* some simplifications/optimizations in returns from Lua functionsRoberto Ierusalimschy2018-02-151-10/+12
|
* vararg back to '...' (but with another implementation)Roberto Ierusalimschy2018-02-091-4/+6
| | | | new implementation should have zero overhead for non-vararg functions
* new opcode 'PREPVARARG'Roberto Ierusalimschy2018-02-071-0/+2
| | | | (avoids test for vararg function in all function calls)
* detailRoberto Ierusalimschy2018-02-071-6/+6
| | | | (order of 'OT' and 'IT' bits corresponds with macro 'opmode')
* janitor work on castsRoberto Ierusalimschy2018-01-281-6/+6
|
* OP_CONCAT does not move its result (to simplify its execution)Roberto Ierusalimschy2018-01-271-2/+2
|
* keep more opcode arguments byte-alignedRoberto Ierusalimschy2018-01-091-16/+20
|
* new macros 'isOT'/'isIT'Roberto Ierusalimschy2017-12-221-5/+15
| | | | | (plus exchanged parameters of OP_VARARG to make it similar to other 'isOT' instructions)
* new opcodes 'FORLOOP1'/'FORPREP1' for "basic for" (integer variableRoberto Ierusalimschy2017-12-181-1/+5
| | | | with increment of 1)
* some cleaning on signed opcode parametersRoberto Ierusalimschy2017-12-151-13/+16
|
* (1 << 31) with signed integer has undefined behavior in CRoberto Ierusalimschy2017-12-151-2/+2
|
* new opcodes BANDK/BORK/BXORK. (They do not use immediate operandsRoberto Ierusalimschy2017-12-131-1/+5
| | | | | because, too often, masks in bitwise operations are integers larger than one byte.)
* new opcodes OP_SHLI/OP_SHRIRoberto Ierusalimschy2017-12-041-1/+4
|
* details (comments)Roberto Ierusalimschy2017-11-301-5/+10
|