| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Even if the string fits in size_t, the whole size of the TString object
can overflow when we add the header.
|
|
|
|
|
| |
We may want to add other string variants in the future; this change
documents better where the code may need to handle those variants.
|
|
|
|
|
| |
Took the opportunity and moved the code that controls call hooks
in 'luaV_execute' into a function.
|
|
|
|
|
| |
Equality according to 'strcoll' does not imply that strings have
the same length.
|
|
|
|
|
| |
- Better comments about short strings in opcodes.
- luaH_newkey made static.
|
|
|
|
|
| |
It also causes 'L->top' to be wrong when the error happens,
triggering an 'assert'.
|
|
|
|
|
| |
That will allow to change pointers to offsets while reallocating
the stack.
|
| |
|
|
|
|
| |
Bug introduced in commit 42d40581.
|
|
|
|
|
|
|
|
|
|
| |
Because error handling (luaG_errormsg) uses slots from EXTRA_STACK,
and some errors can recur (e.g., string overflow while creating an
error message in 'luaG_runerror', or a C-stack overflow before calling
the message handler), the code should use stack slots with parsimony.
This commit fixes the bug "Lua-stack overflow when C stack overflows
while handling an error".
|
|
|
|
|
| |
Comments + manual + identation + asserts about stack limits that were
not allowing the use of the full stack
|
|
|
|
|
|
| |
luaV_execute should compute 'ra' only when the instruction uses it.
Computing an illegal address is undefined behavior even if the address
is never dereferenced.
|
|
|
|
|
|
|
|
|
|
|
| |
'luaD_pretailcall' mimics 'luaD_precall', handling call metamethods
and calling C functions directly. That makes the code in the
interpreter loop simpler.
This commit also goes back to emulating the tail call in 'luaD_precall'
with a goto, as C compilers may not do proper tail calls and the C
stack can overflow much sooner than the Lua stack (which grows as the
metamethod is added to it).
|
|
|
|
|
| |
Better explanation about the guaranties of multiple assignment in
the manual.
|
|
|
|
|
| |
According to ISO C, "making a function an inline function suggests that
calls to the function be as fast as possible." (Not available in C89.)
|
| |
|
|
|
|
| |
Not that simpler and slower.
|
|
|
|
| |
Negation of an unchecked lua_Integer overflows with mininteger.
|
|
|
|
|
|
| |
The parameters 'nresults' and 'delta1', in 'luaD_precall', were never
meaningful simultaneously. So, they were combined in a single parameter
'retdel'.
|
|
|
|
|
| |
A tail call to a C function can have the behavior of a "real" tail
call, reusing the stack frame of the caller.
|
|
|
|
|
| |
Tail calls handled by 'luaD_precall', like regular calls, to avoid
code duplication.
|
|
|
|
|
| |
Yielding in a __close metamethod called when returning vararg results
changes the top and so messes up the number of returned values.
|
| |
|
|
|
|
|
|
|
|
| |
Some places don't need the "fast path" macro tointegerns, either
because speed is not essential (lcode.c) or because the value is not
supposed to be an integer already (luaV_equalobj and luaG_tointerror).
Moreover, luaV_equalobj should always use F2Ieq, even if Lua is
compiled to "round to floor".
|
|
|
|
|
| |
Added documentation and asserts that constants for arithmetic opcodes
must be numbers.
|
|
|
|
|
|
| |
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
|
|
|
|
|
|
|
|
| |
To-be-closed variables are linked in their own list, embedded into the
stack elements. (Due to alignment, this information does not change
the size of the stack elements in most architectures.) This new list
does not produce garbage and avoids memory errors when creating tbc
variables.
|
|
|
|
| |
Long time without using HARDSTACKTESTS...
|
|
|
|
|
|
|
| |
Initial implementation to allow yields inside '__close' metamethods.
This current version still does not allow a '__close' metamethod
to yield when called due to an error. '__close' metamethods from
C functions also are not allowed to yield.
|
|
|
|
|
| |
Instead of protecting each individual metamethod call, protect the
entire call to 'luaF_close'.
|
|
|
|
|
| |
Functions to set values in a table (luaH_set, luaH_newkey, etc.) receive
the new value, instead of returning a slot where to put the value.
|
|
|
|
|
| |
Trace of vararg functions was skipping an instruction when returning
from a call. (Bug introduced by commit 5d8ce05b3.)
|
|
|
|
|
|
| |
The stack size is derived from 'stack_last', when needed. Moreover,
the handling of stack sizes is more consistent, always excluding the
extra space except when allocating/deallocating the array.
|
|
|
|
|
|
|
|
|
| |
The previous stackless implementations marked all 'luaV_execute'
invocations as fresh. However, re-entering 'luaV_execute' when
resuming a coroutine should not be a fresh invocation. (It works
because 'unroll' called 'luaV_execute' for each call entry, but
it was slower than letting 'luaV_execute' finish all non-fresh
invocations.)
|
|
|
|
|
|
| |
- more organized handling of 'nCcalls'
- comments
- deprecation of 'setcstacklimit'
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A "with stack" implementation gains too little in performance to be
worth all the noise from C-stack overflows.
This commit is almost a sketch, to test performance. There are several
pending stuff:
- review control of C-stack overflow and error messages;
- what to do with setcstacklimit;
- review comments;
- review unroll of Lua calls.
|
|
|
|
|
|
|
|
|
|
| |
The field 'L->oldpc' is not always updated when control returns to a
function; an invalid value can seg. fault when computing 'changedline'.
(One example is an error in a finalizer; control can return to
'luaV_execute' without executing 'luaD_poscall'.) Instead of trying to
fix all possible corner cases, it seems safer to be resilient to invalid
values for 'oldpc'. Valid but wrong values at most cause an extra call
to a line hook.
|
|
|
|
|
|
| |
Errors in finalizers need a valid 'pc' to produce an error message,
even if the error is not propagated. Therefore, calls to the GC (which
may call finalizers) inside luaV_execute must save the 'pc'.
|
|
|
|
|
|
|
|
| |
Macro 'checkstackGC' was doing a GC step after resizing the stack;
the GC could shrink the stack and undo the resize. Moreover, macro
'checkstackp' also does a GC step, which could remove the preallocated
CallInfo when calling a function. (Its name has been changed to
'checkstackGCp' to emphasize that it calls the GC.)
|
|
|
|
|
| |
Several of its callers needed that case and had to do the check
themselves.
|
|
|
|
|
| |
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
|
| |
|
|
|
|
|
| |
LUA_T* represents only types; tags (types + Variants) are represented
by LUA_V* constants.
|
|
|
|
|
|
|
| |
Instead of an explicit value (field 'b'), true and false use different
tag variants. This avoids reading an extra field and results in more
direct code. (Most code that uses booleans needs to distinguish between
true and false anyway.)
|
| |
|
| |
|
| |
|
|
|
|
| |
That macro is applied to float attributes, not to limits.
|
| |
|