summaryrefslogtreecommitdiff
path: root/lopcodes.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* detail (spacing)Roberto Ierusalimschy2017-11-301-3/+3
|
* new opcodes OP_RETURN0/OP_RETURN1Roberto Ierusalimschy2017-11-291-1/+4
|
* using register 'k' for conditions in tests (we only need one bit there)Roberto Ierusalimschy2017-11-281-12/+18
|
* new opcodes 'OP_LTI' and 'OP_LEI'Roberto Ierusalimschy2017-11-271-1/+3
|
* using 'A' for register instead of 'B' in relational opcodesRoberto Ierusalimschy2017-11-221-6/+6
| | | | ('R(A)' is already created by default for all instructions.)
* new opcode 'OP_EQI' for equality with immediate numbersRoberto Ierusalimschy2017-11-221-1/+2
|
* new instruction 'OP_EQK' (for equality with constants)Roberto Ierusalimschy2017-11-161-1/+3
|
* new format for JUMP instructions (to allow larger offsets)Roberto Ierusalimschy2017-11-071-5/+25
|
* eplicit 1-bit opcode operand 'k'Roberto Ierusalimschy2017-10-041-42/+29
|
* new opcodes with immediate integer operand for all arithmetic operationsRoberto Ierusalimschy2017-10-041-1/+8
|
* opcode size increased to 7 bitsRoberto Ierusalimschy2017-10-021-8/+8
|
* avoid the use of bit 'Bk' ('B' will lose this bit soon)Roberto Ierusalimschy2017-10-011-6/+3
|
* no more 'getBMode'-'getCMode' (imprecise + we will need more spaceRoberto Ierusalimschy2017-09-281-30/+27
| | | | for op mode) + better control of op modes
* binary operators use R instead of RKRoberto Ierusalimschy2017-09-261-16/+16
| | | | | faster + nobody uses RK(B), so B can be smaller (freeing one bit for more opcodes, soon)
* new opcode OP_LOADF (load immediate float)Roberto Ierusalimschy2017-09-191-1/+2
|
* comments (documentation about instruction formats)Roberto Ierusalimschy2017-09-181-15/+14
|
* detail (keep OP_LOADK and OP_LOADKX together)Roberto Ierusalimschy2017-09-151-2/+2
|
* jumps do not close upvalues (to be faster and simpler);Roberto Ierusalimschy2017-09-131-2/+3
| | | | | | explicit instruction to close upvalues; command 'break' not handled like a 'goto' (to optimize removal of uneeded 'close' instructions)
* jumps in 'for' loops don't need to be signedRoberto Ierusalimschy2017-08-141-5/+5
|
* 'OP_VARARG' has the vararg parameter as an operandRoberto Ierusalimschy2017-06-291-3/+3
|