This commit is contained in:
Roberto Ierusalimschy 2024-03-28 17:11:33 -03:00
parent 9fa63a6268
commit 86a8e74824
2 changed files with 10 additions and 7 deletions

3
lgc.c
View File

@ -1055,7 +1055,6 @@ static void setpause (global_State *g) {
l_obj threshold = applygcparam(g, PAUSE, g->marked); l_obj threshold = applygcparam(g, PAUSE, g->marked);
l_obj debt = threshold - gettotalobjs(g); l_obj debt = threshold - gettotalobjs(g);
if (debt < 0) debt = 0; if (debt < 0) debt = 0;
//printf("pause: %ld %ld\n", debt, g->marked);
luaE_setdebt(g, debt); luaE_setdebt(g, debt);
} }
@ -1261,7 +1260,6 @@ static void minor2inc (lua_State *L, global_State *g, int kind) {
static int checkminormajor (global_State *g, l_obj addedold1) { static int checkminormajor (global_State *g, l_obj addedold1) {
l_obj step = applygcparam(g, MINORMUL, g->GCmajorminor); l_obj step = applygcparam(g, MINORMUL, g->GCmajorminor);
l_obj limit = applygcparam(g, MINORMAJOR, g->GCmajorminor); l_obj limit = applygcparam(g, MINORMAJOR, g->GCmajorminor);
//printf("-> (%ld) major? marked: %ld limit: %ld step: %ld addedold1: %ld)\n", gettotalobjs(g), g->marked, limit, step, addedold1);
return (addedold1 >= (step >> 1) || g->marked >= limit); return (addedold1 >= (step >> 1) || g->marked >= limit);
} }
@ -1410,7 +1408,6 @@ static int checkmajorminor (lua_State *L, global_State *g) {
l_obj addedobjs = numobjs - g->GCmajorminor; l_obj addedobjs = numobjs - g->GCmajorminor;
l_obj limit = applygcparam(g, MAJORMINOR, addedobjs); l_obj limit = applygcparam(g, MAJORMINOR, addedobjs);
l_obj tobecollected = numobjs - g->marked; l_obj tobecollected = numobjs - g->marked;
//printf("(%ld) -> minor? tobecollected: %ld limit: %ld\n", numobjs, tobecollected, limit);
if (tobecollected > limit) { if (tobecollected > limit) {
atomic2gen(L, g); /* return to generational mode */ atomic2gen(L, g); /* return to generational mode */
setminordebt(g); setminordebt(g);

View File

@ -3672,12 +3672,13 @@ will contain the chunk until everything created by the chunk has
been collected; been collected;
therefore, Lua can avoid copying to internal structures therefore, Lua can avoid copying to internal structures
some parts of the chunk. some parts of the chunk.
(In general, a fixed buffer would keep the chunk (In general, a fixed buffer would keep its contents
as its contents until the end of the program, until the end of the program,
for instance with the chunk in ROM.) for instance with the chunk in ROM.)
Moreover, for a fixed buffer, Moreover, for a fixed buffer,
the reader function should return the entire chunk in the first read. the reader function should return the entire chunk in the first read.
(As an example, @Lid{luaL_loadbufferx} does that.) (As an example, @Lid{luaL_loadbufferx} does that,
which means that you can use it to load fixed buffers.)
The function @Lid{lua_load} fully preserves the Lua stack The function @Lid{lua_load} fully preserves the Lua stack
through the calls to the reader function, through the calls to the reader function,
@ -3936,7 +3937,7 @@ This function is equivalent to @Lid{lua_pushcclosure} with no upvalues.
Creates an @emphx{external string}, Creates an @emphx{external string},
that is, a string that uses memory not managed by Lua. that is, a string that uses memory not managed by Lua.
The pointer @id{s} points to the exernal buffer The pointer @id{s} points to the external buffer
holding the string content, holding the string content,
and @id{len} is the length of the string. and @id{len} is the length of the string.
The string should have a zero at its end, The string should have a zero at its end,
@ -9361,6 +9362,11 @@ it is equivalent to @Lid{lua_closethread} with
@id{from} being @id{NULL}. @id{from} being @id{NULL}.
} }
@item{
The function @id{lua_setcstacklimit} is deprecated.
Calls to it can simply be removed.
}
@item{ @item{
The function @Lid{lua_dump} changed the way it keeps the stack The function @Lid{lua_dump} changed the way it keeps the stack
through the calls to the writer function. through the calls to the writer function.