| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
A close instruction is still inside the scope of the variables it is
closing. The extra close in a repeat-until (to close variables before
repeating the loop) was being coded outside that scope.
|
| |
|
|
|
| |
It makes loop variables read-only, but it does not restore the old
semantics, so it is not helpful for compatibility.
|
| |
|
|
|
| |
In function 'funcargs', some compilers can complain that 'args' can be
used unitialized, due to the default case (syntax error).
|
| |
|
|
|
|
|
| |
'lua_load' does not preserve the stack through the calls to the
reader function, as it should. Immediately after the first call (to
detect whether chunk is binary) it adds stuff, and it also adds a new
table when starting the compilation of each new function.
|
| |
|
|
|
|
| |
Compilation options LUA_COMPAT_GLOBAL, LUA_COMPAT_LOOPVAR, and
LUA_READLINELIB do not affect the API, so they can be changed
through the make file.
|
| |
|
|
| |
When on, this option makes for-loop control variables not read only.
|
| |
|
|
|
| |
- Avoid fixing name "_ENV" in the code
- Small improvements in the manual
|
| |
|
|
|
| |
Vararg functions with vararg tables don't use the arguments hidden in
the stack; therfore, it doesn't need to build/keep them.
|
| |
|
|
|
|
| |
Conceptually, all functions get their vararg arguments in a vararg
table. The storing of vararg arguments in the stack is always treated
as an optimization.
|
| |
|
|
|
| |
Initialization "global a = 10" raises an error if global 'a' is already
defined, that is, it has a non-nil value.
|
| |
|
|
|
|
| |
The syntax 'function foo (a, b, ...arg)' is already used by JavaScript
for this same semantics, so it seems natural to use the same notation in
Lua.
|
| |
|
|
|
|
|
|
| |
When calling 'luaK_storevar', the 'expdesc' for the variable must be
created before the one for the expression, to satisfy the assumptions
for register allocation. So, in a statement like 'global a = exp', where
'a' is actually '_ENV.a', this variable must be handled before the
initializing expression 'exp'.
|
| |
|
|
|
|
| |
The check for limit of local variables is made after generating code to
initialize them. If there are too many local variables not initialized,
the coding of instruction OP_LOADNIL could overflow an argument.
|
| |
|
|
|
|
|
| |
A vararg table can be virtual. If the vararg table is used only as
a base in indexing expressions, the code does not need to create an
actual table for it. Instead, it compiles the indexing expressions
into direct accesses to the internal vararg data.
|
| |
|
|
| |
To allow some optimizations on its use.
|
| |
|
|
| |
Not yet optimized nor documented.
|
| |
|
|
|
| |
The reasoning in commit 519c57d5 is wrong: A sequence of nils generates
several fields with just one OP_LOADNIL.
|
| | |
|
| | |
|
| |
|
|
| |
Only local variables, which use registers, need this low limit.
|
| |
|
|
|
|
|
|
|
| |
In a constructor, each field generates at least one opcode, and the
number of opcodes is limited by INT_MAX. Therefore, the counters for
number of fields cannot exceed this limit. (The current limit for
items in the hash part of a table has a limit smaller than INT_MAX.
However, as long as there are no overflows, the logic for table
resizing will handle that limit.)
|
| |
|
|
|
| |
The check for constructor overflow was considering only fields with
explicit names, ignoring fields with syntax '[exp]=exp'.
|
| |
|
|
|
| |
Validity of the preambular global declaration in controled together
with all declarations, when checking variable names.
|
| |
|
|
|
|
| |
A goto cannot jump into the scope of any variable declaration,
including 'global *'. To report the error, it needs a "name" for
the scope it is entering.
|
| |
|
|
|
| |
In this format, the attribute applies to all names in the list;
e.g. "global<const> print, require, math".
|
| | |
|
| |
|
|
|
|
| |
The parser uses "break" as fake label to compile "break" as "goto
break". To avoid producing this string at each use, it keeps it
available in its state.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
In preparation for 'global *', the structure 'expdesc' does not point
to 'actvar.arr' for information about global variables.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
All calls to 'luaK_semerror' were using 'luaO_pushfstring' to create
the error messages.
|
| |
|
|
|
| |
Plus some other details. (Option '-Wuninitialized' was removed from
the makefile because it is already enabled by -Wall.)
|
| |
|
|
| |
Syntax errors are easier to handle than semantic errors.
|
| |
|
|
|
|
| |
Added comments so that all braces pair correctly. (The parser has
several instances of unmatched braces as characters ('{' or '}'), which
hinders matching regular braces in the code.)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The compilation of a goto or a label just create an entry and generate
boilerplate code for the gotos. As we don't know yet whether it needs a
CLOSE, we code a jump followed by a CLOSE, which is then dead code.
When a block ends (and then we know for sure whether there are variables
that need to be closed), we check the goto's against the labels of that
block. When closing a goto against a label, if it needs a CLOSE, the
compiler swaps the order of the jump and the CLOSE, making the CLOSE
active.
|
| |
|
|
|
|
|
|
|
|
| |
Moreover, each function being parsed has its own table.
The code is cleaner when each table is used for one specific purpose:
The scanner uses its table to anchor and unify strings, mapping strings
to themselves; the parser uses it to reuse constants in the code,
mapping constants to their indices in the constant table. A different
table for each task avoids false collisions.
|
| |
|
|
| |
USHRT_MAX does not fit in an 'int' in 16-bit systems.
|
| | |
|
| |
|
|
|
| |
No warnings for standard numerical types. Still pending alternative
numerical types.
|
| |
|
|
|
|
| |
New instruction format 'ivABC' (a variant of iABC where parameter vC has
10 bits) allows constructors of up to 1024 elements to be coded without
EXTRAARG.
|
| |
|
|
|
|
|
|
| |
Instead of a fixed limit of 50 registers (which, in a bad worst case,
can limit the nesting of constructors to 5 levels), the compiler
computes an individual limit for each constructor based on how many
registers are available when it runs. This limit then controls the
frequency of SETLIST instructions.
|
| |
|
|
|
|
| |
Several definitions that don't need to be "global" (that is, that
concerns only specific parts of the code) moved out of llimits.h,
to more appropriate places.
|
| |
|
|
| |
Accesses content and length of a 'TString'.
|
| |
|
|
| |
So that the other bits can be used for other purposes.
|