Roberto Ierusalimschy
54f7b46c1e
New implementation for constants
...
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-09 10:43:17 -03:00
Roberto Ierusalimschy
8eca21c2e8
First take on constant propagation
2019-07-01 12:42:31 -03:00
Roberto Ierusalimschy
e4b02ca8e4
Structure 'Vardesc' does not need a 'name' field
...
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'.
2019-06-21 10:16:57 -03:00
Roberto Ierusalimschy
d9f40e3f6f
First implementation for 'const' variables
...
A variable can be declared const, which means it cannot be assigned to,
with the syntax 'local <const> name = exp'.
2019-05-17 11:11:44 -03:00
Roberto Ierusalimschy
35296e1fde
Details
...
comments and other janitorial work.
2018-11-22 13:56:04 -02:00
Roberto Ierusalimschy
a006514ea1
Big revamp in the implmentation of labels/gotos
...
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.
2018-10-29 14:26:48 -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
f99509581e
Removed extra information from RCS keyword strings
...
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
2018-08-23 14:26:12 -03:00
Roberto Ierusalimschy
03c6a05ec8
no more nil-in-table
2018-04-04 11:23:41 -03:00
Roberto Ierusalimschy
4a1612ff9b
new experimental syntax using reserved word 'undef'
2018-03-07 12:55:38 -03:00
Roberto Ierusalimschy
e001d5aea6
'VRELOCABLE' -> 'VRELOC'
2017-12-14 12:24:02 -02:00
Roberto Ierusalimschy
10b8c99bbb
small peephole optimizations
2017-11-30 11:29:18 -02:00
Roberto Ierusalimschy
b42430fd3a
'lineinfo' in prototypes saved as differences instead of absolute
...
values, so that the array can use bytes instead of ints, reducing
its size. (A new array 'abslineinfo' is used when line differences
do not fit in a byte.)
2017-06-27 08:35:31 -03:00
Roberto Ierusalimschy
502a1d1108
new opcodes for table access with constant keys (strings and integers)
2017-04-28 17:57:45 -03:00
Roberto Ierusalimschy
07cf8415e3
more comments + reordeing of union inside 'expdesc' to allow
...
static initialization of a VKINT value
2015-12-30 16:16:13 -02:00
Roberto Ierusalimschy
19770b03a9
comments. (More explanation about kinds of expressions.)
2015-12-17 13:44:50 -02:00
Roberto Ierusalimschy
bdf566a8a3
`name' in comments changed to 'name'
2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
89b56e7d84
more precision between closure types ('LClosure' x 'CClosure')
2014-06-19 15:27:20 -03:00
Roberto Ierusalimschy
8ef9e8460e
bug (GC can collect long identifier during parser) + change (using
...
a single constant table for all functions in a chunk)
2013-08-30 13:01:37 -03:00
Roberto Ierusalimschy
1294b09d8e
first implementation of literal integers (no constant folding yet)
2013-04-16 15:46:28 -03:00
Roberto Ierusalimschy
3cadc37f47
no more 'Proto' objects on the stack. Protos are anchored on outer
...
Protos or on a Closure, which must be created before the Proto.
2012-05-08 10:53:33 -03:00
Roberto Ierusalimschy
59bcd137ae
reducing even more use of C stack by the parser: struct 'FuncState'
...
does not need field 'L' + number of labels/gotos in a chunk may be
limited to SHRT_MAX. (Also removed some non-needed 'unsigned's.)
2011-07-27 15:09:01 -03:00
Roberto Ierusalimschy
7482e8f914
no need of lookahead in Zio
2011-02-23 10:13:10 -03:00
Roberto Ierusalimschy
f079749287
some reorganization of dynamic data structures used by the parser
2011-02-07 15:14:50 -02:00
Roberto Ierusalimschy
7cc0e63d8a
first implementation of 'goto'
2011-02-04 15:34:43 -02:00
Roberto Ierusalimschy
81dd13f4c6
new way to distinguish between indexing tables in registers and
...
tables in upvalues (+ fixed small bug when checking conflicts in
multiple assignments)
2010-07-07 13:27:29 -03:00
Roberto Ierusalimschy
6a02bbe1e2
better organization for fields in struct 'expdesc'
2010-07-02 17:42:40 -03:00
Roberto Ierusalimschy
25c557ec63
first version of _ENV; no more global variables
2010-03-12 16:14:06 -03:00
Roberto Ierusalimschy
0fe2576a39
new instructions to optimize indexing on upvalues
2010-02-26 17:40:29 -03:00
Roberto Ierusalimschy
916587508c
parser keeps list of active local variables in a single dynamic array,
...
therefore saving C stack space
2009-10-11 17:02:19 -03:00
Roberto Ierusalimschy
0ac3d07ea6
first implementation of lexical environments
2009-09-30 12:38:37 -03:00
Roberto Ierusalimschy
5938212748
information about upvalues (where they come from) kept in Proto structure,
...
instead of sequence of pseudo-opcodes after OP_CLOSURE
2009-09-28 13:32:50 -03:00
Roberto Ierusalimschy
198be23f36
added structure for local-variable information to allow extra
...
checkings if needed
2008-05-08 12:44:51 -03:00
Roberto Ierusalimschy
3d61c31e5a
'lparser.h' should not include 'ltable.h'
2006-03-09 15:15:48 -03:00
Roberto Ierusalimschy
6dd0c6ccbc
numeral expressions keep their values in struct 'expdesc'
2005-10-03 11:02:40 -03:00
Roberto Ierusalimschy
8718fda9b2
added LUAI_FUNC to functions not in the API
2005-04-25 16:24:10 -03:00
Roberto Ierusalimschy
370d31a559
luac´ ->
luai' (to avoid confusion with other luac stuff)
2005-03-09 13:28:07 -03:00
Roberto Ierusalimschy
f8df21bd20
`luaconf.h´ exports all its definitions always (so all of them
...
must have a lua/LUA prefix).
2005-03-08 17:10:05 -03:00
Roberto Ierusalimschy
b6a7983b65
USHRT_MAX may not fit in a (16-bit) int
2005-03-07 13:58:27 -03:00
Roberto Ierusalimschy
616438fe9a
new way to use vararg' parameters (with
...')
2004-05-31 15:51:50 -03:00
Roberto Ierusalimschy
9fcc485176
zio does not keep "source" name (nobody uses it)
2003-08-25 16:51:54 -03:00
Roberto Ierusalimschy
265530478b
more changes to reduce stack usage by the parser
2003-07-09 17:11:30 -03:00
Roberto Ierusalimschy
00180bb133
small changes to reduce stack usage by the parser
2003-07-09 12:36:38 -03:00
Roberto Ierusalimschy
7a40cdbda0
different variables for number of upvalues and size of upvalue array
...
(makes code clearer)
2003-02-11 08:46:24 -02:00
Roberto Ierusalimschy
dd8edecae1
new functions to manipulate upvales (get/setupvalue)
2002-12-19 09:11:55 -02:00
Roberto Ierusalimschy
b3d0682fb9
use of different buffers for scanner and concatenation
2002-10-08 15:46:08 -03:00
Roberto Ierusalimschy
1c328a191a
no more `global' declarations
2002-05-14 14:52:22 -03:00
Roberto Ierusalimschy
2dadc81822
cleaner implementation of code generation for jumps
2002-05-10 16:22:11 -03:00
Roberto Ierusalimschy
94e5545806
comment
2002-05-09 15:00:38 -03:00
Roberto Ierusalimschy
801aaf37b1
simpler implementation for line information
2002-03-25 14:47:14 -03:00