Roberto Ierusalimschy
9b01da97e3
Small bug in 'luaE_luaE_statesize'
...
Plus, function was renamed to 'luaE_threadsize'.
2024-10-21 15:30:35 -03:00
Roberto Ierusalimschy
3d54b42d59
'objsize' broke in smaller pieces
2024-09-30 14:01:42 -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
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
55ac40f859
Cleaning of llimits.h
...
Several definitions that don't need to be "global" (that is, that
concerns only specific parts of the code) moved out of llimits.h,
to more appropriate places.
2024-06-20 13:43:33 -03:00
Roberto Ierusalimschy
9fa63a6268
Some 'unsigned int' changed to 'unsigned'
...
'unsigned int' is too long sometimes. (We already write 'long' instead
of 'long int'...)
2024-03-22 14:06:11 -03:00
Roberto Ierusalimschy
7360f8d0fd
Removed deprecated function 'setcstacklimit'
2024-02-07 14:20:43 -03:00
Roberto Ierusalimschy
17e0c29d9b
Clear interface between references and predefines
...
The reference system has a defined way to add initial values to the
table where it operates.
2024-01-15 11:31:49 -03:00
Roberto Ierusalimschy
8eb0abc9db
Removed uses of LUA_NUMTAGS
...
That constant was already deprecated (see commit 6aabf4b15e7).
2024-01-13 18:10:50 -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
925fe8a0f2
First criteria for shifts minor<->major
2023-12-07 15:45:11 -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
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
ab6a949522
Merge branch 'master' into nextversion
2023-06-22 11:41:48 -03:00
Roberto Ierusalimschy
9be74ccc21
Several functions turned 'static'
...
Several functions that were already being used only inside their
own file have been declared as 'static'.
2023-05-22 14:47:54 -03:00
Roberto Ierusalimschy
6443185167
"Emergency" new version 5.4.6
...
'lua_resetthread' is back to its original signature, to avoid
incompatibilities in the ABI between releases of the same version.
New function 'lua_closethread' added with the "correct" signature.
2023-05-02 16:41:43 -03:00
Roberto Ierusalimschy
5a04f1851e
New function 'luaL_makeseed'
...
This function unifies code from 'lua_newstate', 'math.randomseed',
and 'table.sort' that tries to create a value with a minimum level
of randomness.
2023-03-20 16:13:17 -03:00
Roberto Ierusalimschy
5d8b5b9290
Changed signal of GC debt
...
Positive debts seems more natural then negative ones.
2022-12-13 15:45:57 -03:00
Roberto Ierusalimschy
40565b4a08
Revamp of GC parameters
...
More uniformity when handling GC parameters + avoid divisions by 100
when applying them.
2022-12-13 11:55:14 -03:00
Roberto Ierusalimschy
d324a0ccf9
Simpler control for major collections
2022-11-29 10:37:08 -03:00
Roberto Ierusalimschy
ec61be9a7e
'l_mem' renamed to 'l_obj' to count objects
2022-11-23 17:29:03 -03:00
Roberto Ierusalimschy
f356d5acdd
First version of GC counting objects for control
...
Still needs to review generational mode.
2022-11-23 17:17:20 -03:00
Roberto Ierusalimschy
76953316d1
Added a counter of the total number of existing objects
...
It may simplify the control of the garbage collector.
2022-11-03 16:37:13 -03:00
Roberto Ierusalimschy
9ede317c70
Threads are created like other objects
...
Using a version of 'luaC_newobj' that allows offsets (extra space
before the object itself).
2022-11-01 17:14:01 -03:00
Roberto Ierusalimschy
413a393e62
Stack indices changed to union's
...
That will allow to change pointers to offsets while reallocating
the stack.
2022-10-29 12:06:37 -03:00
Roberto Ierusalimschy
1e64c1391f
Bug: stack overflow with nesting of coroutine.close
2022-10-25 16:44:06 -03:00
Roberto Ierusalimschy
0bfc572e51
Bug: GC is not reentrant
...
As the GC is not reentrant, finalizers should not be able to invoke it.
2021-12-13 10:41:17 -03:00
Roberto Ierusalimschy
1de95e97ef
Bug: Lua stack still active when closing a state
2021-12-10 10:53:54 -03:00
Roberto Ierusalimschy
bfbff3703e
Bug: Wrong status in coroutine during reset
...
When closing variables during 'coroutine.close' or 'lua_resetthread',
the status of a coroutine must be set to LUA_OK; a coroutine should
not run with any other status. (See assertion in 'lua_callk'.)
After the reset, the status should be kept as normal, as any error
was already reported.
2021-11-08 11:55:25 -03:00
Roberto Ierusalimschy
bef250eb8d
Details
...
Comments and small improvements in the manual.
2021-03-29 11:47:12 -03:00
Roberto Ierusalimschy
1537d6680b
New control for reentrancy of emergency collections
...
Instead of assuming that shrinking a block may be an emergency
collection, use an explicit field ('gcstopem') to stop emergency
collections while GC is working.
2021-02-26 11:41:02 -03:00
Roberto Ierusalimschy
59c88f846d
Broadening the use of branch hints
...
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
2021-02-24 11:14:44 -03:00
Roberto Ierusalimschy
4e47f81188
New implementation for to-be-closed variables
...
To-be-closed variables are linked in their own list, embedded into the
stack elements. (Due to alignment, this information does not change
the size of the stack elements in most architectures.) This new list
does not produce garbage and avoids memory errors when creating tbc
variables.
2021-02-09 14:00:05 -03:00
Roberto Ierusalimschy
c63e5d212b
New macro 'completestate'
2021-02-05 17:51:25 -03:00
Roberto Ierusalimschy
6ccd24eff5
Simpler handling of errors when creating tbc variables
...
New field 'lua_State.ptbc' keeps to-be-closed variable until its
upvalue is created, so that it can be closed in case of a
memory-allocation error.
2021-01-19 10:03:13 -03:00
Roberto Ierusalimschy
b07fc10e91
Allow yields inside '__close' metamethods
...
Initial implementation to allow yields inside '__close' metamethods.
This current version still does not allow a '__close' metamethod
to yield when called due to an error. '__close' metamethods from
C functions also are not allowed to yield.
2021-01-13 13:54:10 -03:00
Roberto Ierusalimschy
6188f3a654
Reset thread before panicking
...
Before panicking, it is simpler to reset the thread instead of closing
its variables and adjust the top manually.
2020-12-28 16:34:07 -03:00
Roberto Ierusalimschy
7af27ef59d
Cleaner handling of errors in '__close' metamethods
...
Instead of protecting each individual metamethod call, protect the
entire call to 'luaF_close'.
2020-12-28 11:40:30 -03:00
Roberto Ierusalimschy
409256b784
'coroutine.close'/'lua_resetthread' report original errors
...
Besides errors in closing methods, 'coroutine.close' and
'lua_resetthread' also consider the original error that stopped the
thread, if any.
2020-12-18 11:22:42 -03:00
Roberto Ierusalimschy
65d2294454
Changed access to global table in the registry
...
The global table is always in the array part of the registry; we can
use this fact to make its access slightly more efficient.
2020-11-26 18:23:40 -03:00
Roberto Ierusalimschy
d282652561
Bug when growing a stack
...
When a stack grows, its extra area can be in use, and it becomes part
of the common area. So, the extra area must be kept correct all the
times. (Bug introduced by commit 5aa36e894f5.)
2020-11-08 11:52:26 -03:00
Roberto Ierusalimschy
9a89fb1c9d
Hash always use all characters in a long string
...
Hashes for long strings are computed only when they are used as keys
in a table, not a too common case. And, in that case, it is to easy to
force collisions changing only the characters which are not part of the
hash.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
5aa36e894f
No more field 'lua_State.stacksize'
...
The stack size is derived from 'stack_last', when needed. Moreover,
the handling of stack sizes is more consistent, always excluding the
extra space except when allocating/deallocating the array.
2020-10-12 12:29:09 -03:00