aboutsummaryrefslogtreecommitdiff
path: root/ldo.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* No more to-be-closed functionsRoberto Ierusalimschy2019-01-041-0/+1
| | | | | | | | | | | | | | | | | | | 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-24/+16
| | | | | | | | | | * 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/+4
| | | | | | 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...)
* DetailsRoberto Ierusalimschy2018-12-111-16/+13
| | | | | | | | - in 'luaB_tonumber', do not need to "checkany" when argument is a number. - in 'lua_resume', the call to 'luaD_rawrunprotected' cannot return a status equal to -1.
* Some bugs with stack reallocation by 'luaF_close'Roberto Ierusalimschy2018-11-241-3/+6
| | | | | | | (Long time without testing with '-DHARDSTACKTESTS'...) With the introduction of to-be-closed variables, calls to 'luaF_close' can move the stack, but some call sites where keeping pointers to the stack without correcting them.
* To-be-closed variables in the C APIRoberto Ierusalimschy2018-10-251-13/+19
|
* Complete implementation of to-be-closed variablesRoberto Ierusalimschy2018-10-221-3/+6
|
* First "complete" implementation of to-be-closed variablesRoberto Ierusalimschy2018-10-171-7/+13
| | | | | | | 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-081-2/+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.
* 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.
* Bug: wrong 'nCcalls' when resuming a coroutineRoberto Ierusalimschy2018-07-111-3/+6
| | | | | | | | 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.
* new macros 'likely'/'unlikely' with hints for jump predictionsRoberto Ierusalimschy2018-05-301-9/+9
| | | | (used only in errors for now)
* in 'luaD_poscall', there is no need to compute 'firstResult' when 'nres==0'Roberto Ierusalimschy2018-05-221-39/+30
|
* 'fTransfer' -> 'ftransfer' / 'nTransfer' -> 'ntransfer'Roberto Ierusalimschy2018-03-161-8/+8
| | | | (keep the standard of names in lower case)
* details (avoid using non-C89 '//' comment)Roberto Ierusalimschy2018-03-071-2/+1
|
* typo in commentRoberto Ierusalimschy2018-03-051-2/+2
|
* better names for macros for tags and types.Roberto Ierusalimschy2018-02-261-2/+2
| | | | | rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag; tnov -> ttype
* two new fields 'fTransfer'/'nTransfer' in 'lua_Debug' structureRoberto Ierusalimschy2018-02-171-9/+22
| | | | (for information about values being given and returned in function calls)
* in return hook, 'top' must be corrected only if smaller than 'ci->top'.Roberto Ierusalimschy2018-02-171-2/+3
| | | | | (It may be larger when returning multiple values, and then it must be larger to preserve that stack slice.)
* some simplifications/optimizations in returns from Lua functionsRoberto Ierusalimschy2018-02-151-8/+16
|
* vararg back to '...' (but with another implementation)Roberto Ierusalimschy2018-02-091-20/+17
| | | | new implementation should have zero overhead for non-vararg functions
* detailsRoberto Ierusalimschy2018-02-071-13/+16
|
* new opcode 'PREPVARARG'Roberto Ierusalimschy2018-02-071-14/+5
| | | | (avoids test for vararg function in all function calls)
* call hooks for Lua functions called by 'luaV_execute'Roberto Ierusalimschy2018-02-061-16/+14
|
* warnings in VS (implicit casts from ptrdiff_t to int)Roberto Ierusalimschy2018-01-291-2/+2
|
* bug in tailcall of vararg functionsRoberto Ierusalimschy2018-01-281-13/+16
| | | | (when adjusting missing parameters)
* calling a vararg function needs to check GCRoberto Ierusalimschy2018-01-281-7/+7
| | | | (because it creates a new table)
* 'luaD_tryfuncTM' can ensure it does not change the stackRoberto Ierusalimschy2018-01-101-7/+4
|
* by-one error when filling missing arguments in a tail callRoberto Ierusalimschy2017-12-291-3/+3
|
* when calling a hook, cannot decrease 'ci->top' (to preserve stackRoberto Ierusalimschy2017-12-281-6/+6
| | | | size if the stack is reallocated)
* when running Lua code, there is no need to keep 'L->top' "correct";Roberto Ierusalimschy2017-12-201-3/+6
| | | | set it only when needed.
* new macro 'isLuacode' (to distinguish regular Lua code fromRoberto Ierusalimschy2017-12-191-3/+4
| | | | hooks, where C code can run inside a Lua function).
* 'Proto->numparams' does not include vararg parameterRoberto Ierusalimschy2017-12-151-3/+3
| | | | (one less subtraction when calling functions...)
* when shrinking stack, always shrinks the CI list.Roberto Ierusalimschy2017-12-121-5/+2
| | | | (Stack overflow is not corelated to CI overflow anymore.)
* 'luaD_growstack' cannot raise any errors when 'raiseerror' isRoberto Ierusalimschy2017-12-111-14/+27
| | | | false (+ some comments)
* more freedom in handling memory-allocation errors (not all allocationsRoberto Ierusalimschy2017-12-081-19/+23
| | | | | automatically raise an error), which allows fixing a bug when resizing a table.
* detailRoberto Ierusalimschy2017-12-011-3/+3
|
* 'luaV_execute' gets call info as extra argument (it is alwaysRoberto Ierusalimschy2017-11-291-6/+7
| | | | available on call sites)
* small simplifications in 'luaD_poscall'Roberto Ierusalimschy2017-11-231-18/+18
|
* no more 'stackless' implementation; 'luaV_execute' calls itselfRoberto Ierusalimschy2017-11-231-48/+18
| | | | | recursively to execute function calls. 'unroll' continues all executions suspended by an yield (through a long jump)
* more direct implementation for tail calls.Roberto Ierusalimschy2017-11-211-10/+37
|
* using 'trap' to stop 'luaV_execute' when necessary (tracing andRoberto Ierusalimschy2017-11-131-3/+12
| | | | to update its copy of 'base' when the stack is reallocated)
* avoid accessing wrong union fieldRoberto Ierusalimschy2017-11-131-2/+3
|
* back to 'CallInfo' (no gains with its removal)Roberto Ierusalimschy2017-11-071-95/+95
|
* no more 'CallInfo' structureRoberto Ierusalimschy2017-11-041-42/+22
|
* 'lua_Debug' not using 'CallInfo'Roberto Ierusalimschy2017-11-031-3/+3
|
* no more useful fields in CallInfoRoberto Ierusalimschy2017-11-031-24/+30
|
* more fields moved out of 'CallInfo'Roberto Ierusalimschy2017-11-031-37/+43
|
* new API for 'lua_resume' + cleaning the uses of the 'extra' field inRoberto Ierusalimschy2017-11-021-6/+8
| | | | 'CallInfo'
* using 'L->func' when possibleRoberto Ierusalimschy2017-11-011-5/+5
|