add upstream fix for Bug 7
This commit is contained in:
parent
519e6ee319
commit
66ec5d1d64
118
a1f77a234a053da46b06d5d4be00ffb30d3eb45b.patch
Normal file
118
a1f77a234a053da46b06d5d4be00ffb30d3eb45b.patch
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
From a1f77a234a053da46b06d5d4be00ffb30d3eb45b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
|
||||||
|
Date: Tue, 23 Aug 2022 16:06:23 -0300
|
||||||
|
Subject: [PATCH] Bug: set correct pause when (re)entering gen. collection.
|
||||||
|
|
||||||
|
---
|
||||||
|
lgc.c | 63 +++++++++++++++++++++++++++++------------------------------
|
||||||
|
1 file changed, 31 insertions(+), 32 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lgc.c b/src/lgc.c
|
||||||
|
index 42a73d813..317ea4508 100644
|
||||||
|
--- a/src/lgc.c
|
||||||
|
+++ b/src/lgc.c
|
||||||
|
@@ -1041,7 +1041,25 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
|
||||||
|
** =======================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static void setpause (global_State *g);
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+** Set the "time" to wait before starting a new GC cycle; cycle will
|
||||||
|
+** start when memory use hits the threshold of ('estimate' * pause /
|
||||||
|
+** PAUSEADJ). (Division by 'estimate' should be OK: it cannot be zero,
|
||||||
|
+** because Lua cannot even start with less than PAUSEADJ bytes).
|
||||||
|
+*/
|
||||||
|
+static void setpause (global_State *g) {
|
||||||
|
+ l_mem threshold, debt;
|
||||||
|
+ int pause = getgcparam(g->gcpause);
|
||||||
|
+ l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */
|
||||||
|
+ lua_assert(estimate > 0);
|
||||||
|
+ threshold = (pause < MAX_LMEM / estimate) /* overflow? */
|
||||||
|
+ ? estimate * pause /* no overflow */
|
||||||
|
+ : MAX_LMEM; /* overflow; truncate to maximum */
|
||||||
|
+ debt = gettotalbytes(g) - threshold;
|
||||||
|
+ if (debt > 0) debt = 0;
|
||||||
|
+ luaE_setdebt(g, debt);
|
||||||
|
+}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -1285,6 +1303,15 @@ static void atomic2gen (lua_State *L, global_State *g) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+** Set debt for the next minor collection, which will happen when
|
||||||
|
+** memory grows 'genminormul'%.
|
||||||
|
+*/
|
||||||
|
+static void setminordebt (global_State *g) {
|
||||||
|
+ luaE_setdebt(g, -(cast(l_mem, (gettotalbytes(g) / 100)) * g->genminormul));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
** Enter generational mode. Must go until the end of an atomic cycle
|
||||||
|
** to ensure that all objects are correctly marked and weak tables
|
||||||
|
@@ -1297,6 +1324,7 @@ static lu_mem entergen (lua_State *L, global_State *g) {
|
||||||
|
luaC_runtilstate(L, bitmask(GCSpropagate)); /* start new cycle */
|
||||||
|
numobjs = atomic(L); /* propagates all and then do the atomic stuff */
|
||||||
|
atomic2gen(L, g);
|
||||||
|
+ setminordebt(g); /* set debt assuming next cycle will be minor */
|
||||||
|
return numobjs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1342,15 +1370,6 @@ static lu_mem fullgen (lua_State *L, global_State *g) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-/*
|
||||||
|
-** Set debt for the next minor collection, which will happen when
|
||||||
|
-** memory grows 'genminormul'%.
|
||||||
|
-*/
|
||||||
|
-static void setminordebt (global_State *g) {
|
||||||
|
- luaE_setdebt(g, -(cast(l_mem, (gettotalbytes(g) / 100)) * g->genminormul));
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
/*
|
||||||
|
** Does a major collection after last collection was a "bad collection".
|
||||||
|
**
|
||||||
|
@@ -1422,8 +1441,8 @@ static void genstep (lua_State *L, global_State *g) {
|
||||||
|
lu_mem numobjs = fullgen(L, g); /* do a major collection */
|
||||||
|
if (gettotalbytes(g) < majorbase + (majorinc / 2)) {
|
||||||
|
/* collected at least half of memory growth since last major
|
||||||
|
- collection; keep doing minor collections */
|
||||||
|
- setminordebt(g);
|
||||||
|
+ collection; keep doing minor collections. */
|
||||||
|
+ lua_assert(g->lastatomic == 0);
|
||||||
|
}
|
||||||
|
else { /* bad collection */
|
||||||
|
g->lastatomic = numobjs; /* signal that last collection was bad */
|
||||||
|
@@ -1449,26 +1468,6 @@ static void genstep (lua_State *L, global_State *g) {
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
-/*
|
||||||
|
-** Set the "time" to wait before starting a new GC cycle; cycle will
|
||||||
|
-** start when memory use hits the threshold of ('estimate' * pause /
|
||||||
|
-** PAUSEADJ). (Division by 'estimate' should be OK: it cannot be zero,
|
||||||
|
-** because Lua cannot even start with less than PAUSEADJ bytes).
|
||||||
|
-*/
|
||||||
|
-static void setpause (global_State *g) {
|
||||||
|
- l_mem threshold, debt;
|
||||||
|
- int pause = getgcparam(g->gcpause);
|
||||||
|
- l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */
|
||||||
|
- lua_assert(estimate > 0);
|
||||||
|
- threshold = (pause < MAX_LMEM / estimate) /* overflow? */
|
||||||
|
- ? estimate * pause /* no overflow */
|
||||||
|
- : MAX_LMEM; /* overflow; truncate to maximum */
|
||||||
|
- debt = gettotalbytes(g) - threshold;
|
||||||
|
- if (debt > 0) debt = 0;
|
||||||
|
- luaE_setdebt(g, debt);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
/*
|
||||||
|
** Enter first sweep phase.
|
||||||
|
** The call to 'sweeptolive' makes the pointer point to an object
|
9
lua.spec
9
lua.spec
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
Name: lua
|
Name: lua
|
||||||
Version: %{major_version}.4
|
Version: %{major_version}.4
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
Summary: Powerful light-weight programming language
|
Summary: Powerful light-weight programming language
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://www.lua.org/
|
URL: https://www.lua.org/
|
||||||
@ -47,6 +47,9 @@ Patch9: https://github.com/lua/lua/commit/c764ca71a639f5585b5f466bea25dc42b855a
|
|||||||
Patch10: https://github.com/lua/lua/commit/42d40581dd919fb134c07027ca1ce0844c670daf.patch
|
Patch10: https://github.com/lua/lua/commit/42d40581dd919fb134c07027ca1ce0844c670daf.patch
|
||||||
# 5.4.4 Bug 5
|
# 5.4.4 Bug 5
|
||||||
Patch11: https://github.com/lua/lua/commit/196bb94d66e727e0aec053a0276c3ad701500762.patch
|
Patch11: https://github.com/lua/lua/commit/196bb94d66e727e0aec053a0276c3ad701500762.patch
|
||||||
|
# 5.4.4 Bug 7
|
||||||
|
Patch12: https://github.com/lua/lua/commit/a1f77a234a053da46b06d5d4be00ffb30d3eb45b.patch
|
||||||
|
|
||||||
|
|
||||||
BuildRequires: automake autoconf libtool readline-devel ncurses-devel
|
BuildRequires: automake autoconf libtool readline-devel ncurses-devel
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
@ -106,6 +109,7 @@ mv src/luaconf.h src/luaconf.h.template.in
|
|||||||
%patch9 -p1 -b .5.4.4-bug3
|
%patch9 -p1 -b .5.4.4-bug3
|
||||||
%patch10 -p1 -b .5.4.4-bug4
|
%patch10 -p1 -b .5.4.4-bug4
|
||||||
%patch11 -p1 -b .5.4.4-bug5
|
%patch11 -p1 -b .5.4.4-bug5
|
||||||
|
%patch12 -p1 -b .5.4.4-bug7
|
||||||
# Put proper version in configure.ac, patch0 hardcodes 5.3.0
|
# Put proper version in configure.ac, patch0 hardcodes 5.3.0
|
||||||
sed -i 's|5.3.0|%{version}|g' configure.ac
|
sed -i 's|5.3.0|%{version}|g' configure.ac
|
||||||
autoreconf -ifv
|
autoreconf -ifv
|
||||||
@ -222,6 +226,9 @@ popd
|
|||||||
%{_libdir}/*.a
|
%{_libdir}/*.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 17 2022 Tom Callaway <spot@fedoraproject.org> - 5.4.4-6
|
||||||
|
- add upstream fix for Bug 7
|
||||||
|
|
||||||
* Mon Oct 17 2022 Panu Matilainen <pmatilai@redhat.com> - 5.4.4-5
|
* Mon Oct 17 2022 Panu Matilainen <pmatilai@redhat.com> - 5.4.4-5
|
||||||
- Disable bootstrap mode forgotten on 5.4 rebase
|
- Disable bootstrap mode forgotten on 5.4 rebase
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user