summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Improvements in the manual around metamethodsv5.4-betaRoberto Ierusalimschy2019-10-081-35/+42
|
* No coercion string->number in arithmetic with LUA_NOCVTS2NRoberto Ierusalimschy2019-10-081-0/+13
|
* Makefile compiles the Lua compiler with '-Os'Roberto Ierusalimschy2019-10-081-0/+10
| | | | | | The performance of the Lua compiler is not critical for Lua performance, but it is a big component in the source. So, it makes sense to trade speed for size in this component.
* Fixed a warning and other minor issuesRoberto Ierusalimschy2019-10-046-8/+9
| | | | Fixed some minor issues from the feedback for 5.4-beta rc1.
* Script 'packtests' gets Lua version as a parameterRoberto Ierusalimschy2019-10-021-1/+3
|
* Janitorial workRoberto Ierusalimschy2019-10-014-58/+62
| | | | | | | - 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'
* Details in the makefile (warning options)Roberto Ierusalimschy2019-09-241-8/+8
|
* Subtraction of small constant integers optimized with OP_ADDIRoberto Ierusalimschy2019-09-244-31/+46
|
* 'setCstacklimit' renamed to 'setcstacklimit'Roberto Ierusalimschy2019-09-245-23/+23
| | | | Function names in the API use only lowercase letters.
* Janitorial work in 'lcode.c'Roberto Ierusalimschy2019-09-192-38/+33
|
* Simplification in the call to 'constfolding'Roberto Ierusalimschy2019-09-112-17/+21
|
* Removed arithmetic opcodes with immediate operandRoberto Ierusalimschy2019-09-107-65/+17
| | | | | | | 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-063-94/+95
| | | | Macro 'testMMMode' checks whether opcode is an MM opcode.
* Undo change in the handling of 'L->top' (commit b80077b8f3)Roberto Ierusalimschy2019-08-294-16/+9
| | | | | | With MMBIN instructions, there are fewer opcodes that need to update 'L->top', so that change does not seem to pay for the increased complexity.
* Use of 'MMBIN' opcodes extended to shift operatorsRoberto Ierusalimschy2019-08-285-87/+60
| | | | Plus, this commit removes useless 'tm' parameters in 'op_*' macros.
* First version of OP_MMBIN opcodesRoberto Ierusalimschy2019-08-2711-104/+132
| | | | | | | | | | | 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 missing case in 'luaV_finishOp'Roberto Ierusalimschy2019-08-272-1/+7
| | | | | A metamethod call like '1 << a' was not being properly resumed if it got yielded.
* Fixed bug when yiedling inside OP_ADDK opcodeRoberto Ierusalimschy2019-08-212-0/+14
| | | | | | The family of opcodes OP_ADDK (arithmetic operators with K constant) were not being handled in 'luaV_finishOp', which completes their task after an yield.
* Default for warnings changed to "off"Roberto Ierusalimschy2019-08-2010-17/+23
| | | | | Warnings are mostly a tool to help developers (e.g., by showing hidden error messages); regular users usually don't need to see them.
* Detail (extra test for warnings when closing state)Roberto Ierusalimschy2019-08-191-0/+11
|
* Improvement in warn-mode '@store' (for testing)Roberto Ierusalimschy2019-08-185-31/+55
| | | | | | When using warn-mode '@store', from the test library, the tests ensure not only that the expected warnings were issued, but also that there was no extra warnings.
* Manual corrected with the new syntax for attributesRoberto Ierusalimschy2019-08-161-5/+5
| | | | | Commit 0d529138042, with the change in the syntax of attributes, did not update the manual accordingly.
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-1620-154/+176
| | | | | | | | The macro 'luaL_pushfail' documents all places in the standard libraries that return nil to signal some kind of failure. It is defined as 'lua_pushnil'. The manual also got a notation (@fail) to document those returns. The tests were changed to be agnostic regarding whether 'fail' is 'nil' or 'false'.
* Supressed errors in '__close' generate warningsRoberto Ierusalimschy2019-08-1610-43/+164
|
* Added control messages to warningsRoberto Ierusalimschy2019-08-159-49/+161
| | | | | | | Added the concept of control messages to the warning system, plus the implementation of the controls "@on"/"@off" to turn warnings on/off. Moreover, the warning system in the test library adds some other controls to ease the test of warnings.
* Small optimization in 'convergeephemerons'Roberto Ierusalimschy2019-08-121-9/+20
| | | | | | When converging marks on ephemeron tables, change the direction the tables are traversed at each iteration, to try to avoid bad-case scenarios with linked lists of entries in a table.
* Detail in the manual (method 'file:setvbuf')Roberto Ierusalimschy2019-08-121-16/+8
| | | | | ANSI C is vague about 'setvbuf'; most details are implementation defined. So, the manual cannot give any guaranties, either.
* DetailsRoberto Ierusalimschy2019-08-012-8/+13
| | | | | - removed rule about RCS from makefile - comments and nitpicking in 'llex.c'
* Correction in the documentation of 'io.lines'Roberto Ierusalimschy2019-07-312-7/+5
| | | | | | The loop does not end on end of file, but when the iterator function fails to read a value. (In particular, the format "a" never fails, so a loop with 'io.lines(fname, "a")' never ends.)
* Tracebacks recognize metamethods '__close'Roberto Ierusalimschy2019-07-312-4/+20
|
* To-be-closed variables must be closed on initializationRoberto Ierusalimschy2019-07-316-41/+70
| | | | | | | | | When initializing a to-be-closed variable, check whether it has a '__close' metamethod (or is a false value) and raise an error if if it hasn't. This produces more accurate error messages. (The check before closing still need to be done: in the C API, the value is not constant; and the object may lose its '__close' metamethod during the block.)
* Fixed test in 'main.lua'Roberto Ierusalimschy2019-07-301-7/+10
| | | | | | | The test "to-be-closed variables in main chunk" was broken, as it used the removed feature of functions as to-be-closed values. The error was not detected because its expected result had no lines to be checked (due to missing new lines).
* Change in the syntax of attributesRoberto Ierusalimschy2019-07-3011-102/+103
| | | | | | | Attributes changed to posfixed ('x <const>', instead of '<const> x'), and "toclose" renamed to "close". Posfixed attributes seem to make it clearer that it applies to only one variable when there are multiple variables.
* Change in the handling of 'L->top' when calling metamethodsRoberto Ierusalimschy2019-07-2610-29/+75
| | | | | | | Instead of updating 'L->top' in every place that may call a metamethod, the metamethod functions themselves (luaT_trybinTM and luaT_callorderTM) correct the top. (When calling metamethods from the C API, however, the callers must preserve 'L->top'.)
* Bug: 'Vardesc' array can be reallocated in 'localstat'Roberto Ierusalimschy2019-07-261-12/+15
| | | | | A reference to a 'Vardesc*' (as done by 'localstat') can be invalidated by the creation of any new variable.
* Small corrections when setting 'L->top'Roberto Ierusalimschy2019-07-254-6/+17
| | | | | | | | | - OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top); - OP_CLOSE doesn't need to set top ('Protect' already does that); - OP_TFORCALL must use 'ProtectNT', to preserve the top already set. (That was a small bug, because iterators could be called with extra parameters besides the state and the control variable.) - Comments and an extra test for the bug in previous item.
* Some improvements in date/time functionsRoberto Ierusalimschy2019-07-242-41/+100
| | | | | | - Range in date table extended to full 32 bits. - Easier support for times represented as floats. - Added more tests.
* Fixed bug in 'string.format' with option '%f'Roberto Ierusalimschy2019-07-232-8/+12
| | | | | | | | | | | As an example, 'print(string.format("%.99f", 1e70))' may have a lot of garbage after the number. The old test to ensure that 'string.format("%.99f", n)' was not too large, 'fabs(n) < 1e100', assumes that the number will fit in the 99 bytes; but the 99 is not the space for the number, it is the added extra zeros. The option worked for smaller numbers because of the extra space added to MAX_ITEM.
* Do not collect open upvaluesRoberto Ierusalimschy2019-07-224-14/+11
| | | | | | | | Open upvalues are kept alive together with their corresponding stack. This change makes a simpler and safer fix to the issue in commit 440a5ee78c8, about upvalues in the list of open upvalues being collected while others are being created. (That previous fix may not be correct.)
* 'math.randomseed' always returns the two seed componentsRoberto Ierusalimschy2019-07-193-11/+15
|
* Avoid using addresses of static variables as unique keysRoberto Ierusalimschy2019-07-193-16/+17
| | | | | | The addresses of static variables may be different for different instances of Lua, making these instances incompatible if they use these addresses as unique keys in the registry (or other tables).
* Fixed bug for emergency collection in upvalue creationRoberto Ierusalimschy2019-07-193-8/+10
| | | | | | | | | | | When creating an upvalue, an emergency collection can collect the previous upvalue where the new one would be linked. The following code can trigger the bug, using valgrind on Lua compiled with the -DHARDMEMTESTS option: local x; local y (function () return y end)(); (function () return x end)()
* Tag LUA_TUPVALTBC replaced by a flagRoberto Ierusalimschy2019-07-195-18/+13
| | | | | It is simpler to signal a to-be-closed upvalue with a boolean flag, instead of using a different tag.
* Some details in 'lmem.c' and 'lgc.c'Roberto Ierusalimschy2019-07-192-27/+42
| | | | | | | | - Several new comments in 'lmem.c'. - Both 'luaM_growaux_' and 'luaM_shrinkvector_' use 'luaM_saferealloc_' to check for errors. Moreover, the use of 'luaM_saferealloc_' makes 'luaM_shrinkvector_' try again if shrink fails (which can happen now). - In 'checkSizes', save old debt only when needed.
* DetailsRoberto Ierusalimschy2019-07-183-25/+17
| | | | | | | - Macro 'checkliveness' (for debug) always uses 'L', to avoid warnings. - Some old 'while' changed to 'for' in 'testes/gc.lua'. - In 'testes/libs/makefile', do not make files depend on 'ltests.h', which may not even exist.
* Reviving HARDMEMTESTSRoberto Ierusalimschy2019-07-184-15/+35
| | | | | | | | | | | This commit brings a new implementation for HARDMEMTESTS, which forces an emergency GC whenever possible. It also fixes some issues detected with this option: - A small bug in lvm.c: a closure could be collected by an emergency GC while being initialized. - Some tests: a memory address can be immediatly reused after a GC; for instance, two consecutive '{}' expressions can return exactly the same address, if the first one is not anchored.
* Small bug with stack reallocationRoberto Ierusalimschy2019-07-182-7/+9
| | | | | | | | OP_RETURN must update trap before updating stack. (Bug detected with -DHARDSTACKTESTS). Also, in 'luaF_close', do not create a variable with 'uplevel(uv)', as the stack may change and invalidate this value. (This is not a bug, but could become one if 'upl' was used again.)
* 'math.randomseed()' returns the seeds it usedRoberto Ierusalimschy2019-07-174-7/+27
| | | | | A call to 'math.randomseed()' returns the two components of the seed it set, so that they can be used to set that same seed again.
* Calls 'luaF_close' in 'lua_settop' only when neededRoberto Ierusalimschy2019-07-171-5/+7
| | | | | In 'lua_settop', avoid calling 'luaF_close' when increasing the stack or when the function has no to-be-closed variables.
* Fixed small issue with constant propagationRoberto Ierusalimschy2019-07-172-7/+21
| | | | | | | | 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.