aboutsummaryrefslogtreecommitdiff
path: root/lundump.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Array sizes in undump changed from unsigned to intRoberto Ierusalimschy2025-02-201-32/+25
| | | | | Array sizes are always int and are dumped as int, so there is no reason to read them back as unsigned.
* DetailsRoberto Ierusalimschy2025-01-161-1/+1
| | | | New year (2024->2025), typos in comments
* Added gcc option '-Wconversion'Roberto Ierusalimschy2024-07-271-27/+35
| | | | | No warnings for standard numerical types. Still pending alternative numerical types.
* Length of external strings must fit in Lua integerRoberto Ierusalimschy2024-06-241-1/+1
| | | | (As the length of any string in Lua.)
* 'luaH_get' functions return tag of the resultRoberto Ierusalimschy2024-03-211-1/+2
| | | | | | | Undoing previous commit. Returning TValue increases code size without any visible gains. Returning the tag is a little simpler than returning a special code (HOK/HNOTFOUND) and the tag is useful by itself in some cases.
* 'luaH_get' functions return 'TValue'Roberto Ierusalimschy2024-03-181-2/+1
| | | | | | Instead of receiving a parameter telling them where to put the result of the query, these functions return the TValue directly. (That is, they return a structure.)
* Removed type 'varint_t'Roberto Ierusalimschy2024-03-131-11/+10
| | | | | | size_t should be big enough to count the number of strings in a dump. (And, by definition, it is big enough to count the length of each string.)
* Revising code for Varint encoding in dumpsRoberto Ierusalimschy2024-02-121-12/+12
| | | | | | | | - Usign lua_Unsigned to count strings. - Varint uses a type large enough both for size_t and lua_Unsigned. - Most-Significant Bit 0 means last byte, to conform to common usage. - (unrelated) Change in macro 'getaddr' so that multiplication is by constants.
* Fixed buffers reuse absolute line informationRoberto Ierusalimschy2023-12-271-9/+17
|
* Cleaner protocol between 'lua_dump' and writer functionRoberto Ierusalimschy2023-12-141-4/+4
| | | | | 'lua_dump' signals to the writer function the end of a dump, so that is has more freedom when using the stack.
* Correct anchoring and GC barriers in 'loadString'Roberto Ierusalimschy2023-11-131-37/+35
| | | | | | 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.
* Fixed buffers save long strings as external.Roberto Ierusalimschy2023-11-101-8/+15
|
* Solving merge issue with use of tables in dump/undumpRoberto Ierusalimschy2023-11-081-2/+3
| | | | | | 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.
* Merge branch 'master' into nextversionRoberto Ierusalimschy2023-11-071-1/+1
|\
| * Removed test for "corrupted binary dump"Roberto Ierusalimschy2023-09-081-1/+1
| | | | | | | | | | Test is too non portable. (For instance, it does not work for different number types.)
* | Added suport for Fixed BuffersRoberto Ierusalimschy2023-09-051-8/+34
| | | | | | | | | | A fixed buffer keeps a binary chunk "forever", so that the program does not need to copy some of its parts when loading it.
* | Field 'Proto.is_vararg' uses only one bitRoberto Ierusalimschy2023-08-301-1/+1
| | | | | | | | So that the other bits can be used for other purposes.
* | Opcode in dumps is stored properly alignedRoberto Ierusalimschy2023-08-251-1/+16
| |
* | Merge branch 'master' into nextversionRoberto Ierusalimschy2023-08-231-1/+1
|\|
| * More disciplined use of 'getstr' and 'tsslen'Roberto Ierusalimschy2023-08-171-1/+1
| | | | | | | | | | We may want to add other string variants in the future; this change documents better where the code may need to handle those variants.
* | Merge branch 'master' into nextversionRoberto Ierusalimschy2023-06-221-0/+2
|\|
| * Bug: Loading a corrupted binary file can segfaultRoberto Ierusalimschy2023-03-171-0/+2
| | | | | | | | | | 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.
* | Dump doesn't need to reuse 'source'Roberto Ierusalimschy2022-12-201-6/+4
| | | | | | | | All strings are being reused now, including 'source'.
* | Dump/undump reuse stringsRoberto Ierusalimschy2022-12-151-1/+19
|/ | | | | A repeated string in a dump is represented as an index to its first occurence, instead of another copy of the string.
* Stack indices changed to union'sRoberto Ierusalimschy2022-10-291-3/+3
| | | | | That will allow to change pointers to offsets while reallocating the stack.
* Fixed bug of long strings in binary chunksRoberto Ierusalimschy2020-08-181-0/+3
| | | | | | | 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'.
* Fixed detail in 'loadUpvalues'Roberto Ierusalimschy2020-06-301-1/+8
| | | | | | | | | 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.
* Detailsv5.4.0Roberto Ierusalimschy2020-06-181-2/+2
| | | | Added as incompatibility, in the manual, the extra return of 'io.lines'.
* Fixed missing GC barriers in compiler and undumpRoberto Ierusalimschy2020-06-161-14/+19
| | | | | While building a new prototype, the GC needs barriers for every object (strings and nested prototypes) that is attached to the new prototype.
* Back to old encoding of versions in binary filesRoberto Ierusalimschy2020-05-061-1/+1
| | | | | | (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.
* Code style in 'ldump'/'lundump'.Roberto Ierusalimschy2020-02-271-73/+73
| | | | | - function names start with lower case; - state is always the first parameter.
* Clearer distinction between types and tagsRoberto Ierusalimschy2020-01-311-7/+7
| | | | | LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
* Changed internal representation of booleansRoberto Ierusalimschy2020-01-061-2/+5
| | | | | | | 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.)
* First implementation of constant propagationRoberto Ierusalimschy2019-07-121-3/+2
| | | | | Local constant variables initialized with compile-time constants are optimized away from the code.
* New implementation for constantsRoberto Ierusalimschy2019-07-091-0/+1
| | | | | | | | | 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.
* 'require' returns where module was foundRoberto Ierusalimschy2019-04-171-2/+2
| | | | | The function 'require' returns the *loader data* as a second result. For file searchers, this data is the path where they found the module.
* Small changes in the header of binary filesRoberto Ierusalimschy2019-03-191-15/+23
| | | | | | | | | - 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.)
* Removed extra information from RCS keyword stringsRoberto Ierusalimschy2018-08-231-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all source files; only the file name are kept.
* avoid craches when loading tampered code with NULL as a string constantRoberto Ierusalimschy2018-06-011-6/+20
|
* using explicit tests for allocation overflow whenever possibleRoberto Ierusalimschy2017-12-071-8/+8
|
* detail (identation of switch)Roberto Ierusalimschy2017-11-281-19/+18
|
* new type 'StackValue' for stack elementsRoberto Ierusalimschy2017-06-291-2/+2
| | | | (we may want to put extra info there in the future)
* dumping ints and size_ts compactedRoberto Ierusalimschy2017-06-271-9/+17
|
* 'lineinfo' in prototypes saved as differences instead of absoluteRoberto Ierusalimschy2017-06-271-2/+9
| | | | | | 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.)
* macro 'incr_top' replaced by function 'luaD_inctop'. (It is not usedRoberto Ierusalimschy2015-11-021-2/+2
| | | | in critical time pathes, can save a few bytes without the macro)
* macros 'getaddrstr' and 'getstr' unified (they do the same thing)Roberto Ierusalimschy2015-09-171-2/+2
|
* long strings are created directly in final position when possibleRoberto Ierusalimschy2015-09-081-9/+11
| | | | | (instead of using an auxiliar buffer to first create the string and then allocate the final string and copy result there)
* added include for 'lprefix.h', for stuff that must be added beforeRoberto Ierusalimschy2014-11-021-3/+6
| | | | any other header file
* more precision between closure types ('LClosure' x 'CClosure')Roberto Ierusalimschy2014-06-191-8/+8
|
* allows different 'source' for each prototype, but inherits it fromRoberto Ierusalimschy2014-06-181-11/+17
| | | | | parent when they are equal (only possible case for chunks created by the parser)