Commit Graph

5661 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
e7af9cdf0b Fixed buffers reuse absolute line information 2023-12-27 17:42:00 -03:00
Roberto Ierusalimschy
12b6f610b0 Several tweaks in the garbage collector
- back with step size in collectgarbage("step")
- adjustments in defaults for some GC parameters
- adjustments in 'luaO_codeparam'
2023-12-27 12:09:11 -03:00
Roberto Ierusalimschy
e81f586001 Removed compatibility option LUA_COMPAT_GCPARAMS
The meaning of different GC parameters changed, so there is point in
supporting old values for them. The new code simply ignores the
parameters when changing the GC mode, so the incompatibility is small.
2023-12-22 14:57:43 -03:00
Roberto Ierusalimschy
e2cc179454 New option "setparms" for 'collectgarbage'
The generational mode also uses the parameters for the incremental
mode in its major collections, so it should be easy to change those
parameters without having to change the GC mode.
2023-12-22 14:48:07 -03:00
Roberto Ierusalimschy
5853c37a83 Bug: Buffer overflow in string concatenation
Even if the string fits in size_t, the whole size of the TString object
can overflow when we add the header.
2023-12-21 13:37:51 -03:00
Roberto Ierusalimschy
ad0ea7813b GC parameters encoded as floating-point bytes
This encoding brings more precision and a larger range for these
parameters.
2023-12-20 16:25:20 -03:00
Roberto Ierusalimschy
666e95a66d Option 0 for step multiplier makes GC non-incremental 2023-12-20 11:06:27 -03:00
Roberto Ierusalimschy
4eda1acafa Cleaner protocol between 'lua_dump' and writer function
'lua_dump' signals to the writer function the end of a dump, so that
is has more freedom when using the stack.
2023-12-14 11:41:57 -03:00
Roberto Ierusalimschy
ad73b33224 Check minor->major made at the end of a minor cycle
It does not make sense to wait for another cycle to decide when much of
the information about creation of old objects is already available.
2023-12-07 15:45:41 -03:00
Roberto Ierusalimschy
925fe8a0f2 First criteria for shifts minor<->major 2023-12-07 15:45:11 -03:00
Roberto Ierusalimschy
789e7acdea Major collections done incrementally
Major collections do not need to "stop the world". Still pending:
criteria for shifts minor-major, shifts generational-incremental.
2023-12-06 10:49:56 -03:00
Roberto Ierusalimschy
74b4013538 Removed macro 'changeage'
It is simpler to use always 'setage'. The saving from 'changeage'
is too irrelevant.
2023-12-01 16:42:01 -03:00
Roberto Ierusalimschy
b719ff9399 Removed parameter in 'collectgarbage("step")'
A call to 'collectgarbage("step")' always performs one GC basic step.
2023-12-01 16:38:28 -03:00
Roberto Ierusalimschy
35a2fed2d1 Removed deprecated options in 'lua_gc'
Options 'setpause' and 'setstepmul' were deprecated in Lua 5.4.
2023-11-30 15:51:02 -03:00
Roberto Ierusalimschy
63d68bd657 Comments detailing the ages for generational GC
Plus other comments and small details.
2023-11-29 16:22:09 -03:00
Roberto Ierusalimschy
842a83f09c Panic functions should not raise errors
The standard panic function was using 'lua_tostring', which may raise
a memory-allocation error if error value is a number.
2023-11-24 16:08:55 -03:00
Roberto Ierusalimschy
011850a8f8 Details in the manual 2023-11-24 14:44:38 -03:00
Roberto Ierusalimschy
52b899d60d Simpler coding for new representation for arrays
With the tags comming first in a cell, we can define the whole cell
as a C type and let C do part of the address computations.
2023-11-24 14:41:07 -03:00
Roberto Ierusalimschy
25cd3d377e Buffer in 'luai_makeseed' measured in bytes
In the (rare) cases when sizeof(void*) or sizeof(time_t) are not
multiples of sizeof(int), we still can use all their bytes in the seed.
2023-11-15 10:28:32 -03:00
Roberto Ierusalimschy
1028f296a8 Default paths stored as external strings 2023-11-13 13:41:59 -03:00
Roberto Ierusalimschy
6d042a178f Auxiliary buffer uses external strings
The buffer system from the auxiliary library reuses its buffer
as external memory when closing long strings.
2023-11-13 13:12:33 -03:00
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.
2023-11-13 13:11:09 -03:00
Roberto Ierusalimschy
3b57e37e48 Fixed buffers save long strings as external. 2023-11-10 12:35:48 -03:00
Roberto Ierusalimschy
024f9064f1 External strings
Strings can use external buffers to store their contents.
2023-11-09 17:05:42 -03:00
Roberto Ierusalimschy
7f4906f565 Towards external strings
Long strings have a pointer to string contents.
2023-11-08 13:24:38 -03:00
Roberto Ierusalimschy
b8a9d14032 Details
Comments and parameter name in header file.
2023-11-08 10:41:24 -03:00
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.
2023-11-08 10:02:06 -03:00
Roberto Ierusalimschy
37c215b43f Merge branch 'newarray' into nextversion 2023-11-07 17:26:15 -03:00
Roberto Ierusalimschy
9e99f3071d Merge branch 'master' into nextversion 2023-11-07 17:25:46 -03:00
Roberto Ierusalimschy
fa075b7953 Merge branch 'master' into newarray 2023-11-03 15:39:14 -03:00
Roberto Ierusalimschy
08a077d673 Full implementation of new representation for arrays 2023-11-03 15:26:13 -03:00
Roberto Ierusalimschy
7923dbbf72 Bug: Recursion in 'getobjname' can stack overflow
'getobjname' now broken in two, a basic version that handles locals,
upvalues, and constants, and a full version, which uses the basic
version to handle table accesses (globals and fields).
2023-11-01 12:00:54 -03:00
Roberto Ierusalimschy
43c8e5bded Full abstraction for representation of array values 2023-10-30 14:25:59 -03:00
Roberto Ierusalimschy
b8b709b6d4 Avoid direct accesses to the array part of a table 2023-10-27 16:32:49 -03:00
Roberto Ierusalimschy
81e4fce530 Simpler test in 'luaH_getint'
The test whether key is inside the array part of a table uses a bit
trick to avoid computing the real size of the array part.
2023-10-26 16:12:25 -03:00
Roberto Ierusalimschy
6baee9ef9d Removed test for "corrupted binary dump"
Test is too non portable. (For instance, it does not work for
different number types.)
2023-09-08 16:19:21 -03:00
Roberto Ierusalimschy
edd8589f47 Avoid casts from unsigned long to floating-point
Old Microsoft compilers do not support those casts.
2023-09-08 11:34:39 -03:00
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.
2023-09-05 15:30:45 -03:00
Roberto Ierusalimschy
f33cda8d6e New macro 'getlstr'
Accesses content and length of a 'TString'.
2023-08-30 11:26:16 -03:00
Roberto Ierusalimschy
96f7714237 Field 'Proto.is_vararg' uses only one bit
So that the other bits can be used for other purposes.
2023-08-30 10:44:28 -03:00
Roberto Ierusalimschy
0554581605 Opcode in dumps is stored properly aligned 2023-08-25 17:40:20 -03:00
Roberto Ierusalimschy
07a9eab23a Cannot use 'getshrstr' before setting 'shrlen' 2023-08-25 15:55:14 -03:00
Roberto Ierusalimschy
c815c2f0eb Merge branch 'master' into nextversion 2023-08-23 15:14:03 -03:00
Roberto Ierusalimschy
9363a8b990 Documentation for "LUA_NOENV"
Registry field "LUA_NOENV" (that signals to libraries that option -E
is on) now part of the "official" API of Lua stand-alone.
2023-08-23 13:50:38 -03:00
Roberto Ierusalimschy
5ab6a5756b Bug: Wrong line number for function calls 2023-08-23 13:49:27 -03:00
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.
2023-08-17 15:59:28 -03:00
Roberto Ierusalimschy
f4211a5ea4 More control over encoding of test files
The few UTF-8 test files are commented as such, and there is only one
non UTF-8 test file (to test non UTF-8 sources).
2023-08-17 10:42:56 -03:00
Roberto Ierusalimschy
1b3f507f62 Bug: Call hook may be called twice when count hook yields
Took the opportunity and moved the code that controls call hooks
in 'luaV_execute' into a function.
2023-07-25 16:50:44 -03:00
Roberto Ierusalimschy
6b51133a98 Thread stacks resized in the atomic phase
Although stack resize can be a little expensive, it seems unusual to
have too many threads needing resize during one GC cycle. On the other
hand, the change allows full collections to skip the propagate phase,
going straight from a pause to the atomic phase.
2023-07-13 14:55:46 -03:00
Roberto Ierusalimschy
cbae016202 Details 2023-07-03 14:12:54 -03:00