diff options
author | Mark Shannon <mark@hotpy.org> | 2024-02-05 18:28:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-05 18:28:51 (GMT) |
commit | 36518e69d74607e5f094ce55286188e4545a947d (patch) | |
tree | b031b3cb351b68e5bee0ad4bf346fd958b2b9307 /Modules | |
parent | b4ba0f73d6eef3da321bb96aafd09dfbc572e95d (diff) | |
download | cpython-36518e69d74607e5f094ce55286188e4545a947d.zip cpython-36518e69d74607e5f094ce55286188e4545a947d.tar.gz cpython-36518e69d74607e5f094ce55286188e4545a947d.tar.bz2 |
GH-108362: Incremental GC implementation (GH-108038)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/gcmodule.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index ffddef3..3b63dd7 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -158,17 +158,12 @@ gc_set_threshold_impl(PyObject *module, int threshold0, int group_right_1, { GCState *gcstate = get_gc_state(); - gcstate->generations[0].threshold = threshold0; + gcstate->young.threshold = threshold0; if (group_right_1) { - gcstate->generations[1].threshold = threshold1; + gcstate->old[0].threshold = threshold1; } if (group_right_2) { - 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; - } + gcstate->old[1].threshold = threshold2; } Py_RETURN_NONE; } @@ -185,9 +180,9 @@ gc_get_threshold_impl(PyObject *module) { GCState *gcstate = get_gc_state(); return Py_BuildValue("(iii)", - gcstate->generations[0].threshold, - gcstate->generations[1].threshold, - gcstate->generations[2].threshold); + gcstate->young.threshold, + gcstate->old[0].threshold, + 0); } /*[clinic input] @@ -202,9 +197,9 @@ gc_get_count_impl(PyObject *module) { GCState *gcstate = get_gc_state(); return Py_BuildValue("(iii)", - gcstate->generations[0].count, - gcstate->generations[1].count, - gcstate->generations[2].count); + gcstate->young.count, + gcstate->old[gcstate->visited_space].count, + gcstate->old[gcstate->visited_space^1].count); } /*[clinic input] |