| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
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.
|
|\ |
|
| | |
|
|\| |
|
| |
| |
| |
| | |
Typos in comments and details in the manual.
|
| |
| |
| |
| |
| | |
Again, as the control variable is read only, the code doesn't need
to keep an internal copy of it.
|
| |
| |
| |
| |
| | |
As the control variable is read only, the code doesn't need to keep
an internal copy of it.
|
|/ |
|
|
|
|
|
| |
That will allow to change pointers to offsets while reallocating
the stack.
|
|
|
|
|
|
|
| |
Function 'leaveblock' was generating "break" label before removing
variables from the closing block. If 'createlabel' created a 'close'
instruction (which it did when matching a goto/break that exited
the scope of an upvalue), that instruction would use the wrong level.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
Names in the parser and other details that do not change actual code.
|
|
|
|
|
| |
That optimization was too complex and caused some weird traces when
debugging. The more common case «if ... then break» was kept.
|
| |
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
| |
While building a new prototype, the GC needs barriers for every object
(strings and nested prototypes) that is attached to the new prototype.
|
|
|
|
|
|
|
|
|
|
| |
The parser were mixing compiler indices of variables with stack indices,
so that when a to-be-closed variable was used inside the scope of
compile-time constants (which may be optimized away), it might be closed
in the wrong place. (See new tests for examples.)
Besides fixing the bugs, this commit also changed comments and variable
names to avoid that kind of confusion and added tests.
|
|
|
|
|
|
|
| |
The code should not compute an instruction address before checking that
it exists. (Virtually no machine complains of computing an invalid
address, as long as the address is not used, but for ISO C that is
undefined behavior.)
|
|
|
|
|
|
|
|
| |
This function was computing invalid instruction addresses when the
expression was not a multi-return instruction. (Virtually all machines
don't raise errors when computing an invalid address, as long as the
address is not accessed, but this computation is undefined behavior in
ISO C.)
|
|
|
|
| |
Fixed some minor issues from the feedback for 5.4-beta rc1.
|
|
|
|
|
|
|
| |
Attributes changed to posfixed ('x <const>', instead of '<const> x'),
and "toclose" renamed to "close". Posfixed attributes seem to make it
clearer that it applies to only one variable when there are multiple
variables.
|
|
|
|
|
| |
A reference to a 'Vardesc*' (as done by 'localstat') can be
invalidated by the creation of any new variable.
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
|
| |
String literal expressions have their own kind VKSTR, instead of the
generic VK. This allows strings to "cross" functions without entering
their constant tables (e.g., if they are used only by some nested
function).
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
| |
Local constant variables initialized with compile-time constants
are optimized away from the code.
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
| |
This commit detaches the number of active variables from the
number of variables in the stack, during compilation. Soon,
compile-time constants will be propagated and therefore will
not exist during run time (in the stack).
|
|
|
|
|
|
|
|
|
| |
VLOCAL expressions keep a reference to their corresponding 'Vardesc',
and 'Upvaldesc' (for upvalues) has a field 'ro' (read-only). So, it is
easier to check whether a variable is read-only. The decoupling in
VLOCAL between 'vidx' ('Vardesc' index) and 'sidx' (stack index)
should also help the forthcoming implementation of compile-time
constant propagation.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The syntax for local attributes ('const'/'toclose') was unified with
the regular syntax for local variables, so that we can have variables
with attributes in local definitions with multiple names; for instance:
local <toclose> f, <const> err = io.open(fname)
This new syntax does not implement constant propagation, yet.
This commit also has some small improvements to the manual.
|
| |
|
|
|
|
|
|
| |
Removed the field 'name' from the structure 'Vardesc', as the name
of the local variable is already available in the prototype of the
function, through the index 'idx'.
|
|
|
|
|
|
|
| |
- new error message for "attempt to assign to const variable"
- note in the manual about compatibility options
- comments
- small changes in 'read_line' and 'pushstr'
|