| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
Removed the restriction that a '__call' metamethod must be an actual
function.
|
|
|
|
|
| |
Added new functions to dynamically set the C-stack limit
('lua_setCstacklimit' in the C-API, 'debug.setCstacklimit' in Lua).
|
|
|
|
|
| |
The field 'L->nCcalls' now counts downwards, so that the C-stack
limits do not depend on the stack size.
|
|
|
|
|
|
| |
- 'luaL_setfuncs' avoids creating closures for placeholders.
- Fixed some warnings about unused values in comma expressions.
- Comments.
|
|
|
|
|
|
| |
The test for dead coroutines done in the 'coro' library was moved
to 'lua_resume', in the kernel, which already does other similar
tests.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
The limit LUAI_MAXCCALLS was renamed LUAI_MAXCSTACK, which better
represents its meaning. Moreover, its definition was moved to
'luaconf.h', given its importance now that Lua does not use
a "stackless" implementation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* 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 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...)
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
|
| |
(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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Still missing:
- handling of memory errors when creating upvalue (must run closing
method all the same)
- interaction with coroutines
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
(used only in errors for now)
|
| |
|
|
|
|
| |
(keep the standard of names in lower case)
|
| |
|
| |
|
|
|
|
|
| |
rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag;
tnov -> ttype
|
|
|
|
| |
(for information about values being given and returned in function calls)
|
|
|
|
|
| |
(It may be larger when returning multiple values, and then it must
be larger to preserve that stack slice.)
|
| |
|
|
|
|
| |
new implementation should have zero overhead for non-vararg functions
|
| |
|
|
|
|
| |
(avoids test for vararg function in all function calls)
|
| |
|
| |
|
|
|
|
| |
(when adjusting missing parameters)
|
|
|
|
| |
(because it creates a new table)
|
| |
|
| |
|
|
|
|
| |
size if the stack is reallocated)
|
|
|
|
| |
set it only when needed.
|
|
|
|
| |
hooks, where C code can run inside a Lua function).
|
|
|
|
| |
(one less subtraction when calling functions...)
|
|
|
|
| |
(Stack overflow is not corelated to CI overflow anymore.)
|
|
|
|
| |
false (+ some comments)
|
|
|
|
|
| |
automatically raise an error), which allows fixing a bug when resizing
a table.
|
| |
|
|
|
|
| |
available on call sites)
|
| |
|
|
|
|
|
| |
recursively to execute function calls. 'unroll' continues all
executions suspended by an yield (through a long jump)
|
| |
|
|
|
|
| |
to update its copy of 'base' when the stack is reallocated)
|
| |
|