Roberto Ierusalimschy
03d672a95c
Details (comments)
2025-07-07 15:02:09 -03:00
Roberto Ierusalimschy
e055905914
New macro 'pushvfstring'
...
Helps to ensure that 'luaO_pushvfstring' is being called correctly,
with an error check after closing the vararg list with 'va_end'.
2025-04-23 11:55:04 -03:00
Roberto Ierusalimschy
c2dc6e8e94
Missing GC barrier in 'luaV_finishset'
2025-03-14 12:37:19 -03:00
Roberto Ierusalimschy
22974326ca
Use after free in 'luaV_finishset'
...
If a metatable is a weak table, its __newindex field could be collected
by an emergency collection while being used in 'luaV_finishset'. (This
bug has similarities with bug 5.3.2-1, fixed in commit a272fa66
.)
2025-03-13 15:30:52 -03:00
Roberto Ierusalimschy
fa1382b5cd
Main thread is a regular field of global_State
...
They were already allocated as a single block, so there is no need
for the global_State to point to its main thread.
2025-01-31 13:51:38 -03:00
Roberto Ierusalimschy
d1e677c52b
New type 'TStatus' for thread status/error codes
2025-01-30 11:41:39 -03:00
Roberto Ierusalimschy
39a14ea7d7
CallInfo bit CIST_CLSRET broken in two
...
Since commit f407b3c4a
, it was being used for two distinct (and
incompatible) meanings:
A: Function has TBC variables (now bit CIST_TBC)
B: Interpreter is closing TBC variables (original bit CIST_CLSRET)
B implies A, but A does not imply B.
2025-01-28 11:45:45 -03:00
Roberto Ierusalimschy
c4e7cdb541
Renaming two new functions
...
'lua_numbertostrbuff' -> 'lua_numbertocstring'
'lua_pushextlstring' -> 'lua_pushexternalstring'
2025-01-27 16:09:55 -03:00
Roberto Ierusalimschy
7d7ae8781e
Parameters for 'lua_createtable' back to int
...
Tables don't accept sizes larger than int.
2025-01-21 13:33:59 -03:00
Roberto Ierusalimschy
724012d3d0
Small change in macro 'isvalid'
...
The "faster way" to check whether a value is not 'nilvalue' is not
faster. (Both forms entail one memory access.)
2025-01-16 16:11:49 -03:00
Roberto Ierusalimschy
915c29f8bd
Improvements in the manual
...
Plus details
2025-01-10 15:11:54 -03:00
Roberto Ierusalimschy
f12ce4029d
More integration of 'nresults' into 'callstatus'
2024-11-15 15:25:11 -03:00
Roberto Ierusalimschy
e3ce88c9e8
New function 'lua_numbertostrbuff'
...
It converts a Lua number to a string in a buffer, without creating
a new Lua string.
2024-10-23 17:16:17 -03:00
Roberto Ierusalimschy
20d42ccaae
No errors in 'luaO_pushvfstring'
...
Any call to 'va_start' must have a corresponding call to 'va_end';
so, functions called between them (luaO_pushvfstring in particular)
cannot raise errors.
2024-09-20 15:56:39 -03:00
Roberto Ierusalimschy
45a8f1b593
Removed 'if' left from commit ddfa1fbccf
2024-09-20 09:43:46 -03:00
Roberto Ierusalimschy
9b72355f99
USHRT_MAX changed to SHRT_MAX
...
USHRT_MAX does not fit in an 'int' in 16-bit systems.
2024-09-19 19:06:16 -03:00
Roberto Ierusalimschy
ddfa1fbccf
GC back to controling pace counting bytes
...
Memory is the resource we want to save. Still to be reviewed again.
2024-09-19 19:02:14 -03:00
Roberto Ierusalimschy
4901853c11
Parameter for lua_gc/LUA_GCSTEP changed to 'size_t'
...
'size_t' is the common type for measuring memory. 'int' can be too
small for steps.
2024-09-10 17:05:39 -03:00
Roberto Ierusalimschy
a04e0ffdb9
Rename of fields in global state that control GC
...
All fields in the global state that control the pace of the garbage
collector prefixed with 'GC'.
2024-09-06 14:38:39 -03:00
Roberto Ierusalimschy
0acd55898d
Added gcc option '-Wconversion'
...
No warnings for standard numerical types. Still pending alternative
numerical types.
2024-07-27 13:32:59 -03:00
Roberto Ierusalimschy
15231d4fb2
'nresults' moved into 'callstatus'
...
That gives us more free bits in 'callstatus', for future use.
2024-07-21 14:56:59 -03:00
Roberto Ierusalimschy
f407b3c4a1
Using CIST_CLSRET instead of trick with 'nresults'
...
The callstatus flag CIST_CLSRET is used in all tests for the
presence of variables to be closed in C functions.
2024-07-19 17:34:22 -03:00
Roberto Ierusalimschy
a546138d15
Explicit limit for number of results in a call
...
The parameter 'nresults' in 'lua_call' and similar functions has a
limit of 250. It already had an undocumented (and unchecked) limit of
SHRT_MAX, but it is seldom larger than 2.
2024-07-18 14:44:40 -03:00
Roberto Ierusalimschy
c1dc08e8e8
Length of external strings must fit in Lua integer
...
(As the length of any string in Lua.)
2024-06-24 12:03:59 -03:00
Roberto Ierusalimschy
0593256707
'luaH_get' functions return tag of the result
...
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.
2024-03-21 11:23:21 -03:00
Roberto Ierusalimschy
ce6f5502c9
'luaH_get' functions return 'TValue'
...
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.)
2024-03-18 15:56:32 -03:00
Roberto Ierusalimschy
65b07dd53d
API asserts for illegal pops of to-be-closed variables
2024-03-11 14:05:06 -03:00
Roberto Ierusalimschy
7237eb3f1c
Fixed warnings from different compilers
2024-02-15 11:18:34 -03:00
Roberto Ierusalimschy
0c9bec0d38
Better handling of size limit when resizing a table
...
Avoid silent conversions from int to unsigned int when calling
'luaH_resize'; avoid silent conversions from lua_Integer to int in
'table.create'; MAXASIZE corrected for the new implementation of arrays;
'luaH_resize' checks explicitly whether new size respects MAXASIZE.
(Even constructors were bypassing that check.)
2024-02-07 13:39:54 -03:00
Roberto Ierusalimschy
c31d6774ac
Details
2024-01-29 14:29:24 -03:00
Roberto Ierusalimschy
4a8e480864
New mechanism to query GC parameters
2024-01-16 17:02:55 -03:00
Roberto Ierusalimschy
d862da6d04
Optimizations for 'lua_rawgeti' and 'lua_rawseti'
...
'lua_rawgeti' now uses "fast track"; 'lua_rawseti' still calls
'luaH_setint', but the latter was recoded to avoid extra overhead
when writing to the array part after 'alimit'.
2024-01-12 15:50:51 -03:00
Roberto Ierusalimschy
7827c40c49
A few more tweaks in the garbage collector
2024-01-10 14:45:58 -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
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
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
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
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
024f9064f1
External strings
...
Strings can use external buffers to store their contents.
2023-11-09 17:05:42 -03:00
Roberto Ierusalimschy
37c215b43f
Merge branch 'newarray' into nextversion
2023-11-07 17:26:15 -03:00
Roberto Ierusalimschy
fa075b7953
Merge branch 'master' into newarray
2023-11-03 15:39:14 -03:00
Roberto Ierusalimschy
43c8e5bded
Full abstraction for representation of array values
2023-10-30 14:25:59 -03:00
Roberto Ierusalimschy
c815c2f0eb
Merge branch 'master' into nextversion
2023-08-23 15:14:03 -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
819bd51d87
Some cleaning in the new table API
2023-05-16 16:53:29 -03:00
Roberto Ierusalimschy
f8d30826dd
New table API for 'set' functions
2023-05-16 14:55:49 -03:00