summaryrefslogtreecommitdiff
path: root/testes/coroutine.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* First version of OP_MMBIN opcodesRoberto Ierusalimschy2019-08-271-1/+1
| | | | | | | | | | | 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-271-0/+6
| | | | | 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-211-0/+11
| | | | | | 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-201-0/+1
| | | | | Warnings are mostly a tool to help developers (e.g., by showing hidden error messages); regular users usually don't need to see them.
* Improvement in warn-mode '@store' (for testing)Roberto Ierusalimschy2019-08-181-3/+8
| | | | | | 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.
* Supressed errors in '__close' generate warningsRoberto Ierusalimschy2019-08-161-1/+4
|
* Change in the syntax of attributesRoberto Ierusalimschy2019-07-301-4/+4
| | | | | | | 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-261-1/+1
| | | | | | | 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'.)
* Details in testsRoberto Ierusalimschy2019-06-211-0/+4
| | | | | | | | | | - Added a test for calling 'debug.traceback' after yields inside hooks. (Lua 5.3 seems to have a bug there.) - Removed test "repeat test with '__open' metamethod instead of a function", as the previous test already uses the '__open' metamethod. (It changed when functions were removed as possible to-be-closed variables).
* Multiple errors in '__toclose' report the first oneRoberto Ierusalimschy2019-06-051-1/+9
| | | | | | | | When there are multiple errors when closing objects, the error reported by the protected call is the first one, for two reasons: First, other errors may be caused by this one; second, the first error is handled in the original execution context, and therefore has the full traceback.
* 'coroutine.kill' renamed 'coroutine.close'Roberto Ierusalimschy2019-06-031-11/+11
|
* Flag for to-be-closed variables changed to '<toclose>'Roberto Ierusalimschy2019-05-091-3/+3
| | | | | | | The flag for to-be-closed variables was changed from '*toclose' to '<toclose>'. Several people found confusing the old syntax and the new one has a clear terminator, making it more flexible for future changes.
* Coroutines do not unwind the stack in case of errorsRoberto Ierusalimschy2019-05-091-2/+6
| | | | | | | | | | | Back to how it was, a coroutine does not unwind its stack in case of errors (and therefore do not close its to-be-closed variables). This allows the stack to be examined after the error. The program can use 'coroutine.kill' to close the variables. The function created by 'coroutine.wrap', however, closes the coroutine's variables in case of errors, as it is impossible to examine the stack any way.
* Added an optional parameter to 'coroutine.isyieldable'Roberto Ierusalimschy2019-04-101-2/+5
|
* No more to-be-closed functionsRoberto Ierusalimschy2019-01-041-2/+11
| | | | | | | | | | | | | | | | | | | To-be-closed variables must contain objects with '__toclose' metamethods (or nil). Functions were removed for several reasons: * Functions interact badly with sandboxes. If a sandbox raises an error to interrupt a script, a to-be-closed function still can hijack control and continue running arbitrary sandboxed code. * Functions interact badly with coroutines. If a coroutine yields and is never resumed again, its to-be-closed functions will never run. To-be-closed objects, on the other hand, will still be closed, provided they have appropriate finalizers. * If you really need a function, it is easy to create a dummy object to run that function in its '__toclose' metamethod. This comit also adds closing of variables in case of panic.
* Changes in the control of C-stack overflowRoberto Ierusalimschy2018-12-271-2/+2
| | | | | | | | | | * unification of the 'nny' and 'nCcalls' counters; * external C functions ('lua_CFunction') count more "slots" in the C stack (to allow for their possible use of buffers) * added a new test script specific for C-stack overflows. (Most of those tests were already present, but concentrating them in a single script easies the task of checking whether 'LUAI_MAXCCALLS' is adequate in a system.)
* New functions 'lua_resetthread' and 'coroutine.kill'Roberto Ierusalimschy2018-12-131-0/+45
| | | | | | New functions to reset/kill a thread/coroutine, mainly (only?) to close any pending to-be-closed variable. ('lua_resetthread' also allows a thread to be reused...)
* Removed extra information from RCS keyword strings in testsRoberto Ierusalimschy2018-10-221-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all test files; only the file name are kept.
* Deprecated the emulation of '__le' using '__lt'Roberto Ierusalimschy2018-08-241-5/+3
| | | | | | | | | | | 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).
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-251-1/+1
| | | | | | | 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'.
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-091-0/+918