aboutsummaryrefslogtreecommitdiff
path: root/lmathlib.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-07-17New kind of expression VKSTRRoberto Ierusalimschy5-18/+54
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).
2019-07-16Micro optimization in OP_RETURN and OP_TAILCALLRoberto Ierusalimschy3-15/+13
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'__close' method may be called again in case of errorRoberto Ierusalimschy3-22/+32
An error in a closing method may be caused by a lack of resources, such as memory or stack space, and the error may free enough resources (by unwinding the stack) to allow the method to work if called again. If the closing method is already running after some error (including its own), it is not called again.
2019-07-16Avoid setting the stack top below upvalues to be closedRoberto Ierusalimschy3-9/+13
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-15Unification of size representation in OP_NEWTABLE and OP_SETLISTRoberto Ierusalimschy6-72/+80
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-12Reordering of instructions in the main loopRoberto Ierusalimschy1-44/+44
The instructions in the main interpreter loop were reordered to the same order of their enumeration in 'lopcodes.h'.
2019-07-12OP_NEWTABLE keeps exact size of arraysRoberto Ierusalimschy10-88/+67
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-12First implementation of constant propagationRoberto Ierusalimschy12-119/+249
Local constant variables initialized with compile-time constants are optimized away from the code.
2019-07-10DetailsRoberto Ierusalimschy3-13/+13
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-10Towards constant propagationRoberto Ierusalimschy3-42/+87
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).
2019-07-09New implementation for constantsRoberto Ierusalimschy8-131/+125
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.
2019-07-05Details (typos in comments)Roberto Ierusalimschy9-19/+19
2019-07-03Local attributes can be used in list of local variablesRoberto Ierusalimschy3-81/+103
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.
2019-07-01First take on constant propagationRoberto Ierusalimschy4-26/+73
2019-07-01Methods separated from metamethods in 'io'Roberto Ierusalimschy1-10/+20
In the 'io' library, changed the use of the metatable also as its own "method table", so that metamethods cannot be accessed as if they were methods. (For instance, 'io.stdin.__gc' does not result in the finalizer metamethod anymore.)
2019-06-26Small changes around C-stack limitRoberto Ierusalimschy4-10/+24
- Better documentation in 'testes/cstack.lua' about using 'debug.setCstacklimit' to find a good limit. - Constant LUAI_MAXCSTACK gets added CSTACKERR (extra stack for error handling), so that it is compatible with the argument to 'debug.setCstacklimit'.
2019-06-25'__call' metamethod can be any callable objectRoberto Ierusalimschy2-14/+31
Removed the restriction that a '__call' metamethod must be an actual function.
2019-06-25A few more tests for table access in the APIRoberto Ierusalimschy2-1/+63
Added tests where the table being accessed is also the index or value in the operation.