aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Back with optimization for 'if cond then goto'Roberto Ierusalimschy2018-10-303-20/+100
| | | | | | | | | | | | Statements like 'if cond then goto label' generate code so that the jump in the 'if' goes directly to the given label. This optimization cannot be done when the jump is backwards leaving the scope of some variable, as it cannot add the needed 'close' instruction. (The jumps were already generated by the 'if'.) This commit also added 'likely'/'unlikely' for tests for errors in the parser, and it changed the way breaks outside loops are detected. (Now they are detected like other goto's with undefined labels.)
* Big revamp in the implmentation of labels/gotosRoberto Ierusalimschy2018-10-298-182/+131
| | | | | | | | 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-266-10/+14
| | | | | | | 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.
* To-be-closed variables in the C APIRoberto Ierusalimschy2018-10-256-16/+122
|
* Closing methods should not interfere with returning valuesRoberto Ierusalimschy2018-10-254-42/+98
| | | | | | | | | | | | A closing method cannot be called in its own stack slot, as there may be returning values in the stack after that slot, and the call would corrupt those values. Instead, the closing method must be copied to the top of the stack to be called. Moreover, even when a function returns no value, its return istruction still has to have its position (which will set the stack top) after the local variables, otherwise a closing method might corrupt another not-yet-called closing method.
* Added a '__close' metamethod to file handlesRoberto Ierusalimschy2018-10-232-22/+36
|
* Detail: bad assertion in 'luaM_free_'Roberto Ierusalimschy2018-10-231-1/+1
|
* Removed extra information from RCS keyword strings in testsRoberto Ierusalimschy2018-10-226-4/+4
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all test files; only the file name are kept.
* Small improvements in the manualRoberto Ierusalimschy2018-10-221-8/+18
|
* Complete implementation of to-be-closed variablesRoberto Ierusalimschy2018-10-223-12/+39
|
* Handling of memory errors when creating to-be-closed upvaluesRoberto Ierusalimschy2018-10-184-40/+148
|
* First "complete" implementation of to-be-closed variablesRoberto Ierusalimschy2018-10-1713-26/+145
| | | | | | | Still missing: - handling of memory errors when creating upvalue (must run closing method all the same) - interaction with coroutines
* Towards "to closed" local variablesRoberto Ierusalimschy2018-10-0815-22/+81
| | | | | | | | | | | | 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.
* Added "cost" for the use of C stack by a coroutine invocation.Roberto Ierusalimschy2018-09-111-2/+8
| | | | | | | | | Resuming a coroutine uses more C stack than other operations (such as function calls or recursive syntax). So, to avoid stack overflow in recursive coroutine invocations, either LUAI_MAXCCALLS must be too small or a coroutine invocation must "pay" a higher price. New constant LUAL_COROCSTK ("COROutine C STaK") defines how much is this price.
* Details (comments)Roberto Ierusalimschy2018-09-113-4/+11
|
* Corrections in the implementation of '%' for floats.Roberto Ierusalimschy2018-08-285-18/+87
| | | | | | | | | The multiplication (m*b) used to test whether 'm' is non-zero and 'm' and 'b' have different signs can underflow for very small numbers, giving a wrong result. The use of explicit comparisons solves this problem. This commit also adds several new tests for '%' (both for floats and for integers) to exercise more corner cases, such as very large and very small values.
* Deprecated the emulation of '__le' using '__lt'Roberto Ierusalimschy2018-08-248-40/+44
| | | | | | | | | | | As hinted in the manual for Lua 5.3, the emulation of the metamethod for '__le' using '__le' has been deprecated. It is slow, complicates the logic, and it is easy to avoid this emulation by defining a proper '__le' function. Moreover, often this emulation was used wrongly, with a programmer assuming that an order is total when it is not (e.g., NaN in floating-point numbers).
* Removed extra information from RCS keyword stringsRoberto Ierusalimschy2018-08-2351-51/+51
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all source files; only the file name are kept.
* detailsRoberto Ierusalimschy2018-08-171-6/+6
| | | | | Minor optimizations in 'lvm.c'. (Not exactly optimizations, but more chances for optimizations.)
* Removed use of 'rl_inhibit_completion' in 'lua.c'Roberto Ierusalimschy2018-08-161-3/+2
| | | | | | Some old systems (e.g., Mac OS X 10.4) do not define 'rl_inhibit_completion', even when line history is available. Anyway, the user can configure this option externally, using '~/.inputrc'.
* Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'Roberto Ierusalimschy2018-07-275-50/+71
| | | | | | | | These operations also can give errors for lack of resources, so they also will try "emergency collections" in case of resource errors. Because there are now two libraries with that kind of handling, 'resourcetryagain' was moved to the auxiliary library to be shared by the libraries.
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-2529-29/+29
| | | | | | | From the point of view of 'git', all names are relative to the root directory of the project. So, file names in '$Id:' also should be relative to that directory: the proper name for test file 'all.lua' is 'testes/all.lua'.
* Small improvements in the manualRoberto Ierusalimschy2018-07-251-5/+7
|
* File operations try an "emergency collection" when failingRoberto Ierusalimschy2018-07-252-6/+65
| | | | | | | | | If a file operation fails do to lack of resources (too many open files or not enough memory), it does a full garbage collection and tries the operation again. Lack of resources are "too many open files" (process wise and system wise) and "not enough memory". The code is full of '#if's because error codes are not part of the standard ISO C.
* Comments about OLD0/OLD1 agesRoberto Ierusalimschy2018-07-181-24/+30
| | | | | Improved the comments in file 'lgc.c' explaining the roles of "ages" OLD0 and OLD1 in the generacional collector.
* Fixed bug in generational collection of userdataRoberto Ierusalimschy2018-07-134-15/+102
| | | | | | | | | During generational collection, a userdatum must become gray and go to a gray list after being traversed (like tables), so that 'correctgraylist' can handle it to its next stage. This commit also added minimum tests for the generational collector, including one that would detect this bug.
* Avoid using 'int' for UTF-8 valuesRoberto Ierusalimschy2018-07-121-11/+22
| | | | | | An 'int' may have only 16 bits, so it may not be big enough for UTF-8 values. The new type 'utfint' (in the utf8 library) ensures at least 21 bits for those values.
* Bug: wrong 'nCcalls' when resuming a coroutineRoberto Ierusalimschy2018-07-112-5/+24
| | | | | | | | The counter 'nCcalls' now includes the number of CallInfo structures pre-allocated (so that these "potential" C calls can be made without checking 'nCcalls'). So, when copying this value from a thread to another, in 'lua_resume', it must be corrected to the number of CallInfo structures in the thread being resumed.
* Added definition for LUA_VERSION_RELEASE_NUMRoberto Ierusalimschy2018-07-111-1/+3
| | | | | LUA_VERSION_RELEASE_NUM is set to the release number of the Lua interpreter (e.g., 5.4.0 becomes the integer 50400).
* Fixed bug in line info. when using 'not' operatorRoberto Ierusalimschy2018-07-113-26/+93
| | | | | | | | | 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.
* In tests of opcodes, avoid coercion in bitwise operationRoberto Ierusalimschy2018-07-101-1/+1
|
* Improvements in the manualRoberto Ierusalimschy2018-07-101-14/+17
| | | | | | - More precise use of 'argument' x 'parameter'. - Clarification about what the lexer considers 'letter', 'space', and 'digit'.
* Added missing $Id$ to file 'ljumptab.h'Roberto Ierusalimschy2018-07-101-0/+7
|
* Generational mode may wait longer after a major collectionRoberto Ierusalimschy2018-07-091-8/+25
| | | | | | | | When Lua is building large long-duration structures, frequent small minor collections just waste time. Trying to avoid this, the collector will do a larger pause after a major collection when it does not collect enough garbage (which is a hint that memory is being used for long-lasting objects).
* 'searchpath' creates less temporary stringsRoberto Ierusalimschy2018-07-091-18/+34
| | | | | | | When creating error messages, package loaders may create dozens of temporary strings (one or more for each tried template). This change reduces the number of these strings, and avoid creating some of them if the search is successful.
* Bit-library file removed from the project (as it was deprecated)Roberto Ierusalimschy2018-07-091-7/+0
| | | | | This commit only removed the file 'lbitlib.c' from the project; the makefile already was not using it.
* Opcode names moved to a new header fileRoberto Ierusalimschy2018-07-094-94/+100
| | | | | | | 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.
* Fixed bug in OP_IDIVIRoberto Ierusalimschy2018-07-092-3/+14
| | | | | Opocode was using 'luai_numdiv' (float division) instead of 'luai_numidiv' (integer division).
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-0937-0/+22260
|
* opening functions must be exported!v5.4-w2Roberto Ierusalimschy2018-06-191-5/+3
|
* several detailsRoberto Ierusalimschy2018-06-181-11/+10
|
* in generational mode, an emergency collection can turn any object blackRoberto Ierusalimschy2018-06-181-3/+3
| | | | | | during any memory allocation + 'luaT_getvarargs' may reallocate the stack, and therefore the top must be correct.
* in generational mode, an emergency collection can turn any object blackRoberto Ierusalimschy2018-06-181-2/+2
| | | | during any memory allocation.
* change in 'LUAI_DDEC' to allow variables to be static in 'onelua'Roberto Ierusalimschy2018-06-184-13/+17
| | | | + change in 'LUAMOD_API' as opening functions do not need to be global
* no need to check whether libraries and host use the same kernel;Roberto Ierusalimschy2018-06-186-23/+18
| | | | Lua should work correctly with several copies of the kernel
* new field 'nilvalue' in struct 'global_State' to avoid the use ofRoberto Ierusalimschy2018-06-155-22/+17
| | | | addresses of static variables
* removed unused macros 'isstackindex'/'api_checkstackindex' +Roberto Ierusalimschy2018-06-151-10/+2
| | | | macro 'api_checkvalidindex' (used only once) expanded and removed
* detail (removed unused definition for 'LUA_QS')Roberto Ierusalimschy2018-06-151-10/+2
|
* warning (comparison between signed and unsigned integers)Roberto Ierusalimschy2018-06-151-2/+3
|
* field 'sizearray' in struct 'Table' changed to 'alimit', which canRoberto Ierusalimschy2018-06-157-54/+201
| | | | be used as a hint for '#t'