Roberto Ierusalimschy
eabf425c76
Correct anchoring and GC barriers in 'loadString'
Call to 'luaH_setint' could call the GC with the string unanchored.
Moreover, previously saved strings were being assigned to the prototype
without a barrier.
12 months ago
Roberto Ierusalimschy
3b57e37e48
Fixed buffers save long strings as external.
1 year ago
Roberto Ierusalimschy
19afd91687
Solving merge issue with use of tables in dump/undump
The use of tables in dump/undump to reuse strings did not exist in
the version that changed the representation of arrays, so it was not
corrected for the new API for tables.
1 year ago
Roberto Ierusalimschy
6baee9ef9d
Removed test for "corrupted binary dump"
Test is too non portable. (For instance, it does not work for
different number types.)
1 year ago
Roberto Ierusalimschy
14e416355f
Added suport for Fixed Buffers
A fixed buffer keeps a binary chunk "forever", so that the program
does not need to copy some of its parts when loading it.
1 year ago
Roberto Ierusalimschy
96f7714237
Field 'Proto.is_vararg' uses only one bit
So that the other bits can be used for other purposes.
1 year ago
Roberto Ierusalimschy
0554581605
Opcode in dumps is stored properly aligned
1 year ago
Roberto Ierusalimschy
9b4f39ab14
More disciplined use of 'getstr' and 'tsslen'
We may want to add other string variants in the future; this change
documents better where the code may need to handle those variants.
1 year ago
Roberto Ierusalimschy
ab859fe59b
Bug: Loading a corrupted binary file can segfault
The size of the list of upvalue names are stored separated from the
size of the list of upvalues, but they share the same array.
2 years ago
Roberto Ierusalimschy
7d6a97e42b
Dump doesn't need to reuse 'source'
All strings are being reused now, including 'source'.
2 years ago
Roberto Ierusalimschy
d70a0c91ad
Dump/undump reuse strings
A repeated string in a dump is represented as an index to its first
occurence, instead of another copy of the string.
2 years ago
Roberto Ierusalimschy
413a393e62
Stack indices changed to union's
That will allow to change pointers to offsets while reallocating
the stack.
2 years ago
Roberto Ierusalimschy
6bc0f13505
Fixed bug of long strings in binary chunks
When "undumping" a long string, the function 'loadVector' can call the
reader function, which can run the garbage collector, which can collect
the string being read. So, the string must be anchored during the call
to 'loadVector'.
4 years ago
Roberto Ierusalimschy
422ce50d2e
Fixed detail in 'loadUpvalues'
In 'lundump.c', when loading the upvalues of a function, there can be
a read error if the chunk is truncated. In that case, the creation
of the error message can trigger an emergency collection while the
prototype is still anchored. So, the prototype must be GC consistent
before loading the upvales, which implies that it the 'name' fields
must be filled with NULL before the reading.
4 years ago
Roberto Ierusalimschy
c33b1728ae
Details
Added as incompatibility, in the manual, the extra return of 'io.lines'.
4 years ago
Roberto Ierusalimschy
6d7cd31fee
Fixed missing GC barriers in compiler and undump
While building a new prototype, the GC needs barriers for every object
(strings and nested prototypes) that is attached to the new prototype.
4 years ago
Roberto Ierusalimschy
61a4e64a66
Back to old encoding of versions in binary files
(Undoing part of commit f53eabeed8.) It is better to keep this encoding
stable, so that all Lua versions can read at least the version of a
binary file.
5 years ago
Roberto Ierusalimschy
e8a52281d9
Code style in 'ldump'/'lundump'.
- function names start with lower case;
- state is always the first parameter.
5 years ago
Roberto Ierusalimschy
46c3587a6f
Clearer distinction between types and tags
LUA_T* represents only types; tags (types + Variants) are represented
by LUA_V* constants.
5 years ago
Roberto Ierusalimschy
5ff408d218
Changed internal representation of booleans
Instead of an explicit value (field 'b'), true and false use different
tag variants. This avoids reading an extra field and results in more
direct code. (Most code that uses booleans needs to distinguish between
true and false anyway.)
5 years ago
Roberto Ierusalimschy
f6aab3ec1f
First implementation of constant propagation
Local constant variables initialized with compile-time constants
are optimized away from the code.
5 years ago
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.
5 years ago
Roberto Ierusalimschy
ed2872cd3b
'require' returns where module was found
The function 'require' returns the *loader data* as a second result.
For file searchers, this data is the path where they found the module.
6 years ago
Roberto Ierusalimschy
f53eabeed8
Small changes in the header of binary files
- LUAC_VERSION is equal to LUA_VERSION_NUM, and it is stored
as an int.
- 'sizeof(int)' and 'sizeof(size_t)' removed from the header, as
the binary format does not depend on these sizes. (It uses its
own serialization for unsigned integer values.)
6 years ago
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.
6 years ago
Roberto Ierusalimschy
b397064955
avoid craches when loading tampered code with NULL as a string constant
7 years ago
Roberto Ierusalimschy
7622373033
using explicit tests for allocation overflow whenever possible
7 years ago
Roberto Ierusalimschy
dfd188ba12
detail (identation of switch)
7 years ago
Roberto Ierusalimschy
f96497397a
new type 'StackValue' for stack elements
(we may want to put extra info there in the future)
7 years ago
Roberto Ierusalimschy
124bfd2081
dumping ints and size_ts compacted
7 years ago
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.)
7 years ago
Roberto Ierusalimschy
8c1fb91802
macro 'incr_top' replaced by function 'luaD_inctop'. (It is not used
in critical time pathes, can save a few bytes without the macro)
9 years ago
Roberto Ierusalimschy
ee5edb6b68
macros 'getaddrstr' and 'getstr' unified (they do the same thing)
9 years ago
Roberto Ierusalimschy
41964648ee
long strings are created directly in final position when possible
(instead of using an auxiliar buffer to first create the string
and then allocate the final string and copy result there)
9 years ago
Roberto Ierusalimschy
28fdbcf393
added include for 'lprefix.h', for stuff that must be added before
any other header file
10 years ago
Roberto Ierusalimschy
89b56e7d84
more precision between closure types ('LClosure' x 'CClosure')
11 years ago
Roberto Ierusalimschy
7021cc9bc8
allows different 'source' for each prototype, but inherits it from
parent when they are equal (only possible case for chunks created
by the parser)
11 years ago
Roberto Ierusalimschy
94266dfdbd
source for all prototypes must be equal in a chunk; no need to store
each one separated
11 years ago
Roberto Ierusalimschy
ffa43df3cd
'setnvalue' -> 'setfltvalue' (for consitency with 'fltvalue')
11 years ago
Roberto Ierusalimschy
607be77ec8
some details to avoid warnings
11 years ago
Roberto Ierusalimschy
420cc62fac
missplelling in comments/function names (endianess -> endianness)
11 years ago
Roberto Ierusalimschy
80fe8504f5
make all dumps/loads go trhough Load/DumpVector (so it is easier
to adapt the code to correct endianess, if needed)
11 years ago
Roberto Ierusalimschy
e976384213
keep chunk's headers compatible at least up to LUAC_VERSION (to be
able to detect correctly version mismatches)
11 years ago
Roberto Ierusalimschy
901da539e5
no need to avoid negative ints in 'LoadInt'
11 years ago
Roberto Ierusalimschy
197e249433
"indent -kr -i2 -br -brf -nut" plus a few manual formating
11 years ago
Roberto Ierusalimschy
f69e0ade19
no need to store a full 'size_t' fo the size of (frequent) small strings
11 years ago
Roberto Ierusalimschy
99a1c06ea3
more regularity with vectors + sizeof computed by the macros themselves
11 years ago
Roberto Ierusalimschy
93e28031de
all chars used in binary dumps are unsigned ('lu_byte')
11 years ago
Roberto Ierusalimschy
de84b3fecb
store number of upvalues of main function in front of the dump,
so that undump can create initial closure before reading its prototype
11 years ago
Roberto Ierusalimschy
054179c2ff
more explicit handling of headers for binary chunks
11 years ago