| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
- The preprocessor must work with at least 'long', and therefore must
do shifts of up to 31 bits correctly.
- Whenever possible, use unsigned types in shifts.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
|
|
|
|
|
| |
Several small improvements (code style, warnings, comments, more tests),
in particular:
- 'lua_topointer' extended to handle strings
- raises an error in 'string.format("%10q")' ('%q' with modifiers)
- in the manual for 'string.format', the term "option" replaced by
"conversion specifier" (the term used by the C standard)
|
|
|
|
|
|
|
|
| |
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').
|
|
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
|
|
|
| |
Added restriction that, when a label is created, there cannot be
another label with the same name visible. That allows backward goto's
to be resolved when they are read. Backward goto's get a close if
they jump out of the scope of some variable; labels get a close only
if previous goto to it jumps out of the scope of some upvalue.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
|
|
|
|
|
|
|
| |
The array with the names of the opcodes was moved to a header file
('lopnames.h'), as it is not used by the Lua kernel. Files that need
that array ('luac.c' and 'ltests.c') include the header file to get
a private (static) copy.
|
|
|
|
| |
+ change in 'LUAMOD_API' as opening functions do not need to be global
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
new implementation should have zero overhead for non-vararg functions
|
|
|
|
| |
(avoids test for vararg function in all function calls)
|
|
|
|
| |
(order of 'OT' and 'IT' bits corresponds with macro 'opmode')
|
| |
|
| |
|
| |
|
|
|
|
|
| |
(plus exchanged parameters of OP_VARARG to make it similar to other
'isOT' instructions)
|
|
|
|
| |
with increment of 1)
|
| |
|
| |
|
|
|
|
|
| |
because, too often, masks in bitwise operations are integers larger
than one byte.)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
('R(A)' is already created by default for all instructions.)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
for op mode) + better control of op modes
|
|
|
|
|
| |
faster + nobody uses RK(B), so B can be smaller (freeing one bit
for more opcodes, soon)
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
explicit instruction to close upvalues; command 'break' not
handled like a 'goto' (to optimize removal of uneeded 'close'
instructions)
|
| |
|
| |
|