Commit Graph

773 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
b07fc10e91 Allow yields inside '__close' metamethods
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.
2021-01-13 13:54:10 -03:00
Roberto Ierusalimschy
7af27ef59d Cleaner handling of errors in '__close' metamethods
Instead of protecting each individual metamethod call, protect the
entire call to 'luaF_close'.
2020-12-28 11:40:30 -03:00
Roberto Ierusalimschy
23051e830a Changes in the API of 'luaH_set' and related functions
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.
2020-12-04 11:08:42 -03:00
Roberto Ierusalimschy
e4a38eb0e8 Fixed wrong trace of vararg functions
Trace of vararg functions was skipping an instruction when returning
from a call. (Bug introduced by commit 5d8ce05b3.)
2020-10-19 15:55:25 -03:00
Roberto Ierusalimschy
5aa36e894f No more field 'lua_State.stacksize'
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.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
490d42b5f8 Correct handling of 'luaV_execute' invocations
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.)
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
287b302acb Revision of stackless implementation
- more organized handling of 'nCcalls'
- comments
- deprecation of 'setcstacklimit'
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
5d8ce05b3f Back to a stackless implementation
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.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
a2195644d8 Fixed bug: invalid 'oldpc' when returning to a function
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.
2020-07-17 11:01:05 -03:00
Roberto Ierusalimschy
31b8c2d438 Fixed bug of access violation in finalizers
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'.
2020-07-08 12:02:56 -03:00
Roberto Ierusalimschy
eb41999461 Fixed bugs of stack reallocation x GC
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.)
2020-07-07 18:03:48 -03:00
Roberto Ierusalimschy
ae809e9fd1 'luaV_concat' can "concat" one single value
Several of its callers needed that case and had to do the check
themselves.
2020-07-03 11:54:58 -03:00
Roberto Ierusalimschy
6eb53b7526 Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
2020-02-27 12:59:22 -03:00
Roberto Ierusalimschy
9b7987a9d1 OP_LOADFALSE broken in two instructions 2020-02-11 11:12:33 -03:00
Roberto Ierusalimschy
46c3587a6f Clearer distinction between types and tags
LUA_T* represents only types; tags (types + Variants) are represented
by LUA_V* constants.
2020-01-31 11:09:53 -03:00
Roberto Ierusalimschy
5ff408d218 Changed internal representation of booleans
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.)
2020-01-06 11:38:31 -03:00
Roberto Ierusalimschy
1e0ad018ce Comment about LUA_COMPAT_LT_LE moved to proper place 2019-12-10 13:50:20 -03:00
Roberto Ierusalimschy
95735bda46 Simplifications in 'op_arith*' family of macros 2019-12-05 14:51:58 -03:00
Roberto Ierusalimschy
d30569c064 Using an enumeration for float->integer coercion modes 2019-12-05 14:14:29 -03:00
Roberto Ierusalimschy
2d92102dee 'l_mathlim' renamed to 'l_floatatt'
That macro is applied to float attributes, not to limits.
2019-12-05 13:31:07 -03:00
Roberto Ierusalimschy
490ecfcaa1 Better comments about the use of 'k' in opcodes 2019-12-05 12:59:42 -03:00
Roberto Ierusalimschy
81f2401c6d Code reorganization for opcodes OP_FORPREP and OP_FORLOOP
Parts of the code for opcodes OP_FORPREP and OP_FORLOOP were moved
to functions outside the interpreter loop.
2019-12-04 16:51:53 -03:00
Roberto Ierusalimschy
5f83fb6582 Details 2019-11-18 14:54:06 -03:00
Roberto Ierusalimschy
7d526e75a7 Fixed bug in tail calls of __call chains
A tail call of a __call chain (a __call metamethod that itself is
also not a function) was being perfomed as a regular call.
2019-10-28 15:58:07 -03:00
Roberto Ierusalimschy
c12983cf8a Fixed warnings from Keil compiler 2019-10-25 17:41:40 -03:00
Roberto Ierusalimschy
91dad09f65 Removed arithmetic opcodes with immediate operand
The difference in performance between immediate operands and K operands
does not seem to justify all those extra opcodes. We only keep OP_ADDI,
due to its ubiquity and because the difference is a little more relevant.
(Later, OP_SUBI will be implemented by OP_ADDI, negating the constant.)
2019-09-10 13:20:03 -03:00
Roberto Ierusalimschy
72a094bda7 Undo change in the handling of 'L->top' (commit b80077b8f3)
With MMBIN instructions, there are fewer opcodes that need to update
'L->top', so that change does not seem to pay for the increased
complexity.
2019-08-29 12:52:37 -03:00
Roberto Ierusalimschy
46b84580d6 Use of 'MMBIN' opcodes extended to shift operators
Plus, this commit removes useless 'tm' parameters in 'op_*' macros.
2019-08-28 09:58:03 -03:00
Roberto Ierusalimschy
df13f25948 First version of OP_MMBIN opcodes
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.)
2019-08-27 13:59:39 -03:00
Roberto Ierusalimschy
643188d6e5 Fixed missing case in 'luaV_finishOp'
A metamethod call like '1 << a' was not being properly resumed
if it got yielded.
2019-08-27 10:28:09 -03:00
Roberto Ierusalimschy
3df5624ff4 Fixed bug when yiedling inside OP_ADDK opcode
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.
2019-08-21 12:19:47 -03:00
Roberto Ierusalimschy
f645d31573 To-be-closed variables must be closed on initialization
When initializing a to-be-closed variable, check whether it has a
'__close' metamethod (or is a false value) and raise an error if
if it hasn't. This produces more accurate error messages. (The
check before closing still need to be done: in the C API, the value
is not constant; and the object may lose its '__close' metamethod
during the block.)
2019-07-31 10:43:51 -03:00
Roberto Ierusalimschy
b80077b8f3 Change in the handling of 'L->top' when calling metamethods
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'.)
2019-07-26 14:59:39 -03:00
Roberto Ierusalimschy
9a37dc0ce6 Small corrections when setting 'L->top'
- OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top);
- OP_CLOSE doesn't need to set top ('Protect' already does that);
- OP_TFORCALL must use 'ProtectNT', to preserve the top already set.
  (That was a small bug, because iterators could be called with
   extra parameters besides the state and the control variable.)
- Comments and an extra test for the bug in previous item.
2019-07-25 13:55:29 -03:00
Roberto Ierusalimschy
9e6807c3c9 Do not collect open upvalues
Open upvalues are kept alive together with their corresponding
stack. This change makes a simpler and safer fix to the issue in
commit 440a5ee78c, about upvalues in the list of open upvalues
being collected while others are being created. (That previous fix
may not be correct.)
2019-07-22 09:41:10 -03:00
Roberto Ierusalimschy
440a5ee78c Fixed bug for emergency collection in upvalue creation
When creating an upvalue, an emergency collection can collect the
previous upvalue where the new one would be linked. The following
code can trigger the bug, using valgrind on Lua compiled with the
-DHARDMEMTESTS option:

  local x; local y
  (function () return y end)();
  (function () return x end)()
2019-07-19 12:13:00 -03:00
Roberto Ierusalimschy
d36a31e673 Reviving HARDMEMTESTS
This commit brings a new implementation for HARDMEMTESTS, which forces
an emergency GC whenever possible. It also fixes some issues detected
with this option:
  - A small bug in lvm.c: a closure could be collected by an emergency
  GC while being initialized.
  - Some tests: a memory address can be immediatly reused after a GC;
  for instance, two consecutive '{}' expressions can return exactly the
  same address, if the first one is not anchored.
2019-07-18 14:58:15 -03:00
Roberto Ierusalimschy
024a6071ca Small bug with stack reallocation
OP_RETURN must update trap before updating stack. (Bug detected with
-DHARDSTACKTESTS). Also, in 'luaF_close', do not create a variable
with 'uplevel(uv)', as the stack may change and invalidate this
value. (This is not a bug, but could become one if 'upl' was used
again.)
2019-07-18 11:26:03 -03:00
Roberto Ierusalimschy
4846f7e3bb Micro optimization in OP_RETURN and OP_TAILCALL
Many functions are vararg but create no upvalues, so it is better
to separate the tests for these two kinds of "extra work".
2019-07-16 15:44:37 -03:00
Roberto Ierusalimschy
298f383ffc Avoid setting the stack top below upvalues to be closed
When leaving a scope, the new stack top should be set only after
closing any upvalue, to avoid manipulating values in an "invalid"
part of the stack.
2019-07-16 14:13:22 -03:00
Roberto Ierusalimschy
758c1ef445 Unification of size representation in OP_NEWTABLE and OP_SETLIST
Opcodes OP_NEWTABLE and OP_SETLIST use the same representation to
store the size of the array part of a table. This new representation
can go up to 2^33 (8 + 25 bits).
2019-07-15 14:59:35 -03:00
Roberto Ierusalimschy
dd6d8db49a Reordering of instructions in the main loop
The instructions in the main interpreter loop were reordered to
the same order of their enumeration in 'lopcodes.h'.
2019-07-12 16:47:02 -03:00
Roberto Ierusalimschy
1fb4d53925 OP_NEWTABLE keeps exact size of arrays
OP_NEWTABLE is followed by an OP_EXTRAARG, so that it can keep
the exact size of the array part of the table to be created.
(Functions 'luaO_int2fb'/'luaO_fb2int' were removed.)
2019-07-12 16:13:50 -03:00
Roberto Ierusalimschy
be8445d7e4 Details
In the generic for loop, it is simpler for OP_TFORLOOP to use the
same 'ra' as OP_TFORCALL. Moreover, the internal names of the loop
temporaries "(for ...)" don't need to leak internal details (even
because the numerical for loop doesn't have a fixed role for each of
its temporaries).
2019-07-10 14:58:31 -03:00
Roberto Ierusalimschy
20a9853e02 Cleaning macros in 'luaV_execute'
Ensure that operation macros, such as 'luai_numdiv' and 'luai_numidiv',
operate only on variables, or at most at 's2v(ra)'. ('s2v' is a nop, a
cast from pointer to pointer.)
2019-06-21 10:00:50 -03:00
Roberto Ierusalimschy
4a3fd8488d bug in 5.4 alpha rc1: to-be-closed x vararg functions
Closing methods must be run before correcting 'ci->func' when exiting
a vararg function, to get correct debug information (e.g., in case of
errors).
2019-06-03 12:13:13 -03:00
Roberto Ierusalimschy
2c68e66570 Details
Several small changes from feedback on 5.4 alhpa rc1 (warnings,
typos in the manual, and the like)
2019-06-03 11:36:42 -03:00
Roberto Ierusalimschy
8004798b03 Fixed wrong error message in 'return math.seed(0)'
Bug introduced in commit 28d829c8: OP_TAILCALL might raise an
error without saving 'pc'. (This commit also fixes a detail in
'testes/uf8.lua'.)
2019-04-04 16:31:24 -03:00
Roberto Ierusalimschy
7ceb2154ed Fixed small bugs/issues
- In 'readutf8esc' (llex.c), the overflow check must be done before
shifting the accumulator. It was working because tests were using
64-bit longs. Failed with 32-bit longs.

- In OP_FORPREP (lvm.c), avoid negating an unsigned value. Visual
Studio gives a warning for that operation, despite being well
defined in ISO C.

- In 'luaV_execute' (lvm.c), 'cond' can be defined only when needed,
like all other variables.
2019-03-25 10:38:56 -03:00
Roberto Ierusalimschy
23e6bac8a0 Keep correct type for immediate operands in comparisons
When calling metamethods for things like 'a < 3.0', which generates
the opcode OP_LTI, the C register tells that the operand was
converted to an integer, so that it can be corrected to float when
calling a metamethod.

This commit also includes some other stuff:
- file 'onelua.c' added to the project
- opcode OP_PREPVARARG renamed to OP_VARARGPREP
- comparison opcodes rewritten through macros
2019-03-22 13:37:17 -03:00
Roberto Ierusalimschy
682054920d Details in the implementation of the integer 'for' loop
Changed some implementation details; in particular, it is back using
an internal variable to keep the index, with the control variable
being only a copy of that internal variable. (The direct use of
the control variable demands a check of its type for each access,
which offsets the gains from the use of a single variable.)
2019-03-21 16:01:55 -03:00
Roberto Ierusalimschy
9b37a4695e New semantics for the integer 'for' loop
The numerical 'for' loop over integers now uses a precomputed counter
to control its number of iteractions. This change eliminates several
weird cases caused by overflows (wrap-around) in the control variable.
(It also ensures that every integer loop halts.)

Also, the special opcodes for the usual case of step==1 were removed.
(The new code is already somewhat complex for the usual case,
but efficient.)
2019-03-19 10:53:18 -03:00
Roberto Ierusalimschy
264659bd53 Optional 'init' argument to 'string.gmatch'
The function 'string.gmatch' now has an optional 'init' argument,
similar to 'string.find' and 'string.match'. Moreover, there was
some reorganization in the manipulation of indices in the string
library.
This commit also includes small janitorial work in the manual
and in comments in the interpreter loop.
2019-01-08 14:22:32 -02:00
Roberto Ierusalimschy
fdc25a1ebf New functions 'lua_resetthread' and 'coroutine.kill'
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...)
2018-12-13 13:07:53 -02:00
Roberto Ierusalimschy
28d829c867 Calls cannot be tail in the scope of a to-be-closed variable
A to-be-closed variable must be closed when a block ends, so even
a 'return foo()' cannot directly returns the results of 'foo'; the
function must close the scope before returning.
2018-12-04 15:01:42 -02:00
Roberto Ierusalimschy
6d04537ea6 A to-be-closed variable must have a closable value (or be nil)
It is an error for a to-be-closed variable to have a non-closable
non-nil value when it is being closed. This situation does not seem to
be useful and often hints to an error. (Particularly in the C API, it is
easy to change a to-be-closed index by mistake.)
2018-11-29 16:02:44 -02:00
Roberto Ierusalimschy
7e63d3da02 Some bugs with stack reallocation by 'luaF_close'
(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.
2018-11-24 11:59:15 -02:00
Roberto Ierusalimschy
84e32ad2eb Added opcodes for arithmetic with K operands
Added opcodes for all seven arithmetic operators with K operands
(that is, operands that are numbers in the array of constants of
the function). They cover the cases of constant float operands
(e.g., 'x + .0.0', 'x^0.5') and large integer operands (e.g.,
'x % 10000').
2018-11-23 12:23:45 -02:00
Roberto Ierusalimschy
35296e1fde Details
comments and other janitorial work.
2018-11-22 13:56:04 -02:00
Roberto Ierusalimschy
7f6f70853c To-be-closed variable in 'for' loop separated from the state
The variable to be closed in a generic 'for' loop now is the
4th value produced in the loop initialization, instead of being
the loop state (the 2nd value produced). That allows a loop to
use a state with a '__toclose' metamethod but do not close it.
(As an example, 'f:lines()' might use the file 'f' as a state
for the loop, but it should not close the file when the loop ends.)
2018-11-07 14:42:05 -02:00
Roberto Ierusalimschy
5e76a4fd31 New macros for arithmetic/bitwise operations in 'luaV_execute'
The repetitive code of the arithmetic and bitwise operators in
the main iterpreter loop was moved to appropriate macros.
(As a detail, the function 'luaV_div' was renamed 'luaV_idiv',
as it does an "integer division" (floor division).
2018-11-05 16:10:42 -02:00
Roberto Ierusalimschy
e8c779736f Removed internal cache for closures
The mechanism of "caching the last closure created for a prototype to
try to reuse it the next time a closure for that prototype is created"
was removed. There are several reasons:

- It is hard to find a natural example where this cache has a measurable
impact on performance.

- Programmers already perceive closure creation as something slow,
so they tend to avoid it inside hot paths. (Any case where the cache
could reuse a closure can be rewritten predefining the closure in some
variable and using that variable.)

- The implementation was somewhat complex, due to a bad interaction
with the generational collector. (Typically, new closures are new,
while prototypes are old. So, the cache breaks the invariant that
old objects should not point to new ones.)
2018-11-01 13:21:00 -03:00
Roberto Ierusalimschy
947a372f58 State in generic 'for' acts as a to-be-closed variable
The implicit variable 'state' in a generic 'for' is marked as a
to-be-closed variable, so that the state will be closed as soon
as the loop ends, no matter how.

Taking advantage of this new facility, the call 'io.lines(filename)'
now returns the open file as a second result. Therefore,
an iteraction like 'for l in io.lines(name)...' will close the
file even when the loop ends with a break or an error.
2018-10-31 14:54:45 -03:00
Roberto Ierusalimschy
e073cbc2e5 Better error messages for invalid operands in numeric 'for'
"Better" and similar to error messages for invalid function arguments.
  *old message: 'for' limit must be a number
  *new message: bad 'for' limit (number expected, got table)
2018-10-30 15:46:56 -03:00
Roberto Ierusalimschy
6e9b719694 More uniformity in code generation for 'for' loops
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.
2018-10-26 10:38:50 -03:00
Roberto Ierusalimschy
41c800b352 Closing methods should not interfere with returning values
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.
2018-10-25 12:50:20 -03:00
Roberto Ierusalimschy
3c7dc52909 Handling of memory errors when creating to-be-closed upvalues 2018-10-18 16:15:09 -03:00
Roberto Ierusalimschy
bd96330d03 First "complete" implementation of to-be-closed variables
Still missing:
- handling of memory errors when creating upvalue (must run closing
method all the same)
- interaction with coroutines
2018-10-17 10:44:42 -03:00
Roberto Ierusalimschy
4cd1f4aac0 Towards "to closed" local variables
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.
2018-10-08 10:42:07 -03:00
Roberto Ierusalimschy
5382a22e0e Corrections in the implementation of '%' for floats.
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.
2018-08-28 12:36:58 -03:00
Roberto Ierusalimschy
8c8a91f2ef Deprecated the emulation of '__le' using '__lt'
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).
2018-08-24 10:17:54 -03:00
Roberto Ierusalimschy
3dcd04ad61 details
Minor optimizations in 'lvm.c'. (Not exactly optimizations, but more
chances for optimizations.)
2018-08-17 15:53:39 -03:00
Roberto Ierusalimschy
06e08c6d05 Fixed bug in OP_IDIVI
Opocode was using 'luai_numdiv' (float division) instead of
'luai_numidiv' (integer division).
2018-07-09 12:41:24 -03:00
Roberto Ierusalimschy
a314409dba in generational mode, an emergency collection can turn any object black
during any memory allocation +
'luaT_getvarargs' may reallocate the stack, and therefore the top must
be correct.
2018-06-18 14:58:21 -03:00
Roberto Ierusalimschy
6e600695f8 field 'sizearray' in struct 'Table' changed to 'alimit', which can
be used as a hint for '#t'
2018-06-15 11:14:20 -03:00
Roberto Ierusalimschy
fb8fa66136 no more 'luaH_emptyobject' and comparisons of addresses of global variables
(instead, use a different kind of nil to signal the fake entry returned
when a key is not found in a table)
2018-06-01 13:51:34 -03:00
Roberto Ierusalimschy
34aa0c5bd7 new macros 'likely'/'unlikely' with hints for jump predictions
(used only in errors for now)
2018-05-30 11:25:52 -03:00
Roberto Ierusalimschy
02ed0b2c30 in 'luaD_poscall', there is no need to compute 'firstResult' when 'nres==0' 2018-05-22 09:02:36 -03:00
Roberto Ierusalimschy
e64e20ac81 minimizing the code ran by 'vmfetch' + no more 'vra'
(the code is simpler without 'vra' and conversion is a no-op)
2018-05-02 15:17:59 -03:00
Roberto Ierusalimschy
03c6a05ec8 no more nil-in-table 2018-04-04 11:23:41 -03:00
Roberto Ierusalimschy
3d0b5edfe4 using unsigned comparison in 'l_intfitsf' (avoids one comparison) 2018-04-02 14:52:07 -03:00
Roberto Ierusalimschy
7b0b6b3b39 cannot use 'defined' inside a macro +
call to 'luaT_keydef' must be protected
2018-03-16 11:21:20 -03:00
Roberto Ierusalimschy
4a1612ff9b new experimental syntax using reserved word 'undef' 2018-03-07 12:55:38 -03:00
Roberto Ierusalimschy
62a392ff46 using jump tables when available 2018-03-02 15:59:19 -03:00
Roberto Ierusalimschy
ef8263f81f better names for macros for tags and types.
rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag;
tnov -> ttype
2018-02-26 11:16:05 -03:00
Roberto Ierusalimschy
9243c414d9 first version of empty entries in tables
(so that, in the future, tables can contain regular nil entries)
2018-02-23 10:16:18 -03:00
Roberto Ierusalimschy
c72ac048b9 conditional jumps "deunified"
(if a jump table is used, the unification may harm jump prediction.)
2018-02-21 16:43:44 -03:00
Roberto Ierusalimschy
212095a601 new opcodes OP_GTI/OP_GEI 2018-02-21 12:49:32 -03:00
Roberto Ierusalimschy
06865aa01d simpler implementation for 'LTintfloat'/'LEintfloat'
+ 'LTfloatint'/'LEfloatint'
2018-02-21 10:47:03 -03:00
Roberto Ierusalimschy
465b474899 small reorganization of 'luaV_flttointeger'/'luaV_tointeger' 2018-02-21 09:54:26 -03:00
Roberto Ierusalimschy
1afd5a152d more generic way to handle 'gclist' 2018-02-19 17:06:56 -03:00
Roberto Ierusalimschy
49dae52d08 correct way to check stack space for vararg functions 2018-02-17 17:20:00 -02:00
Roberto Ierusalimschy
0682fe8169 some simplifications/optimizations in returns from Lua functions 2018-02-15 13:34:29 -02:00
Roberto Ierusalimschy
b1379936cf vararg back to '...' (but with another implementation)
new implementation should have zero overhead for non-vararg functions
2018-02-09 13:16:06 -02:00
Roberto Ierusalimschy
318a9a5859 new opcode 'PREPVARARG'
(avoids test for vararg function in all function calls)
2018-02-07 13:18:04 -02:00
Roberto Ierusalimschy
51280ef2ad call hooks for Lua functions called by 'luaV_execute' 2018-02-06 17:16:56 -02:00
Roberto Ierusalimschy
dc0ab1e8ca warnings in VS (implicit casts from ptrdiff_t to int) 2018-01-29 14:21:35 -02:00
Roberto Ierusalimschy
5bd8d388de OP_CONCAT does not move its result (to simplify its execution) 2018-01-27 14:56:33 -02:00
Roberto Ierusalimschy
d2fb34ac88 'OP_TAILCALL' calling C functions finishes the call and returns
(instead of waiting for following 'OP_RETURN')
2018-01-14 15:27:50 -02:00
Roberto Ierusalimschy
ab0a851db4 'luaD_tryfuncTM' can ensure it does not change the stack 2018-01-10 17:19:27 -02:00