summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-02-07 12:38:34 (GMT)
committerGitHub <noreply@github.com>2024-02-07 12:38:34 (GMT)
commit8a3c499ffe7e15297dd4c0b446a0b97b4d32108a (patch)
tree33db486003306c8b0bee15012680642391963977 /Modules
parentd0322fdf2c1a7292a43959fe5a572d783b88a1c4 (diff)
downloadcpython-8a3c499ffe7e15297dd4c0b446a0b97b4d32108a.zip
cpython-8a3c499ffe7e15297dd4c0b446a0b97b4d32108a.tar.gz
cpython-8a3c499ffe7e15297dd4c0b446a0b97b4d32108a.tar.bz2
GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" (#115132)
Revert "GH-108362: Incremental GC implementation (GH-108038)" This reverts commit 36518e69d74607e5f094ce55286188e4545a947d.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/gcmodule.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 3a42654..a2b66b9 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -158,12 +158,17 @@ gc_set_threshold_impl(PyObject *module, int threshold0, int group_right_1,
{
GCState *gcstate = get_gc_state();
- gcstate->young.threshold = threshold0;
+ gcstate->generations[0].threshold = threshold0;
if (group_right_1) {
- gcstate->old[0].threshold = threshold1;
+ gcstate->generations[1].threshold = threshold1;
}
if (group_right_2) {
- gcstate->old[1].threshold = threshold2;
+ gcstate->generations[2].threshold = threshold2;
+
+ /* generations higher than 2 get the same threshold */
+ for (int i = 3; i < NUM_GENERATIONS; i++) {
+ gcstate->generations[i].threshold = gcstate->generations[2].threshold;
+ }
}
Py_RETURN_NONE;
}
@@ -180,9 +185,9 @@ gc_get_threshold_impl(PyObject *module)
{
GCState *gcstate = get_gc_state();
return Py_BuildValue("(iii)",
- gcstate->young.threshold,
- gcstate->old[0].threshold,
- 0);
+ gcstate->generations[0].threshold,
+ gcstate->generations[1].threshold,
+ gcstate->generations[2].threshold);
}
/*[clinic input]
@@ -197,9 +202,9 @@ gc_get_count_impl(PyObject *module)
{
GCState *gcstate = get_gc_state();
return Py_BuildValue("(iii)",
- gcstate->young.count,
- gcstate->old[gcstate->visited_space].count,
- gcstate->old[gcstate->visited_space^1].count);
+ gcstate->generations[0].count,
+ gcstate->generations[1].count,
+ gcstate->generations[2].count);
}
/*[clinic input]