Lines Matching defs:gcstate
128 #define GEN_HEAD(gcstate, n) (&(gcstate)->generations[n].head)
140 _PyGC_InitState(GCState *gcstate)
149 assert(gcstate->generations[i].count == 0);
150 INIT_HEAD(gcstate->generations[i]);
152 gcstate->generation0 = GEN_HEAD(gcstate, 0);
153 INIT_HEAD(gcstate->permanent_generation);
162 GCState *gcstate = &interp->gc;
164 gcstate->garbage = PyList_New(0);
165 if (gcstate->garbage == NULL) {
169 gcstate->callbacks = PyList_New(0);
170 if (gcstate->callbacks == NULL) {
929 GCState *gcstate,
933 assert(gcstate->garbage != NULL);
939 if ((gcstate->debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) {
940 if (PyList_Append(gcstate->garbage, op) < 0) {
991 delete_garbage(PyThreadState *tstate, GCState *gcstate,
1003 if (gcstate->debug & DEBUG_SAVEALL) {
1004 assert(gcstate->garbage != NULL);
1005 if (PyList_Append(gcstate->garbage, op) < 0) {
1047 show_stats_each_generations(GCState *gcstate)
1055 gc_list_size(GEN_HEAD(gcstate, i)));
1061 buf, gc_list_size(&gcstate->permanent_generation.head));
1191 GCState *gcstate = &tstate->interp->gc;
1195 assert(gcstate->garbage != NULL);
1198 if (gcstate->debug & DEBUG_STATS) {
1200 show_stats_each_generations(gcstate);
1209 gcstate->generations[generation+1].count += 1;
1211 gcstate->generations[i].count = 0;
1215 gc_list_merge(GEN_HEAD(gcstate, i), GEN_HEAD(gcstate, generation));
1219 young = GEN_HEAD(gcstate, generation);
1221 old = GEN_HEAD(gcstate, generation+1);
1232 gcstate->long_lived_pending += gc_list_size(young);
1240 gcstate->long_lived_pending = 0;
1241 gcstate->long_lived_total = gc_list_size(young);
1261 if (gcstate->debug & DEBUG_COLLECTABLE) {
1287 delete_garbage(tstate, gcstate, &final_unreachable, old);
1293 if (gcstate->debug & DEBUG_UNCOLLECTABLE)
1296 if (gcstate->debug & DEBUG_STATS) {
1307 handle_legacy_finalizers(tstate, gcstate, &finalizers, old);
1333 struct gc_generation_stats *stats = &gcstate->generation_stats[generation];
1357 GCState *gcstate = &tstate->interp->gc;
1358 if (gcstate->callbacks == NULL) {
1363 assert(PyList_CheckExact(gcstate->callbacks));
1365 if (PyList_GET_SIZE(gcstate->callbacks) != 0) {
1375 for (Py_ssize_t i=0; i<PyList_GET_SIZE(gcstate->callbacks); i++) {
1376 PyObject *r, *cb = PyList_GET_ITEM(gcstate->callbacks, i);
1409 GCState *gcstate = &tstate->interp->gc;
1415 if (gcstate->generations[i].count > gcstate->generations[i].threshold) {
1453 && gcstate->long_lived_pending < gcstate->long_lived_total / 4)
1530 GCState *gcstate = &tstate->interp->gc;
1532 if (gcstate->collecting) {
1537 gcstate->collecting = 1;
1539 gcstate->collecting = 0;
1566 GCState *gcstate = get_gc_state();
1567 gcstate->debug = flags;
1581 GCState *gcstate = get_gc_state();
1582 return gcstate->debug;
1594 GCState *gcstate = get_gc_state();
1596 &gcstate->generations[0].threshold,
1597 &gcstate->generations[1].threshold,
1598 &gcstate->generations[2].threshold))
1602 gcstate->generations[i].threshold = gcstate->generations[2].threshold;
1617 GCState *gcstate = get_gc_state();
1619 gcstate->generations[0].threshold,
1620 gcstate->generations[1].threshold,
1621 gcstate->generations[2].threshold);
1634 GCState *gcstate = get_gc_state();
1636 gcstate->generations[0].count,
1637 gcstate->generations[1].count,
1638 gcstate->generations[2].count);
1686 GCState *gcstate = get_gc_state();
1688 if (!(gc_referrers_for(args, GEN_HEAD(gcstate, i), result))) {
1754 GCState *gcstate = &tstate->interp->gc;
1781 if (append_objects(result, GEN_HEAD(gcstate, generation))) {
1790 if (append_objects(result, GEN_HEAD(gcstate, i))) {
1816 GCState *gcstate = get_gc_state();
1818 stats[i] = gcstate->generation_stats[i];
1907 GCState *gcstate = get_gc_state();
1909 gc_list_merge(GEN_HEAD(gcstate, i), &gcstate->permanent_generation.head);
1910 gcstate->generations[i].count = 0;
1927 GCState *gcstate = get_gc_state();
1928 gc_list_merge(&gcstate->permanent_generation.head,
1929 GEN_HEAD(gcstate, NUM_GENERATIONS-1));
1943 GCState *gcstate = get_gc_state();
1944 return gc_list_size(&gcstate->permanent_generation.head);
1997 GCState *gcstate = get_gc_state();
2001 assert(gcstate->garbage != NULL);
2002 if (PyModule_AddObjectRef(module, "garbage", gcstate->garbage) < 0) {
2005 assert(gcstate->callbacks != NULL);
2006 if (PyModule_AddObjectRef(module, "callbacks", gcstate->callbacks) < 0) {
2044 GCState *gcstate = get_gc_state();
2045 int old_state = gcstate->enabled;
2046 gcstate->enabled = 1;
2053 GCState *gcstate = get_gc_state();
2054 int old_state = gcstate->enabled;
2055 gcstate->enabled = 0;
2062 GCState *gcstate = get_gc_state();
2063 return gcstate->enabled;
2071 GCState *gcstate = &tstate->interp->gc;
2073 if (!gcstate->enabled) {
2078 if (gcstate->collecting) {
2084 gcstate->collecting = 1;
2088 gcstate->collecting = 0;
2103 GCState *gcstate = &tstate->interp->gc;
2104 if (gcstate->collecting) {
2109 gcstate->collecting = 1;
2111 gcstate->collecting = 0;
2118 GCState *gcstate = &interp->gc;
2119 if (!(gcstate->debug & DEBUG_SAVEALL)
2120 && gcstate->garbage != NULL && PyList_GET_SIZE(gcstate->garbage) > 0) {
2122 if (gcstate->debug & DEBUG_UNCOLLECTABLE)
2133 PyList_GET_SIZE(gcstate->garbage)))
2135 if (gcstate->debug & DEBUG_UNCOLLECTABLE) {
2137 repr = PyObject_Repr(gcstate->garbage);
2139 PyErr_WriteUnraisable(gcstate->garbage);
2173 GCState *gcstate = &interp->gc;
2174 Py_CLEAR(gcstate->garbage);
2175 Py_CLEAR(gcstate->callbacks);
2184 PyGC_Head *gen = GEN_HEAD(gcstate, i);
2259 GCState *gcstate = &tstate->interp->gc;
2262 gcstate->generations[0].count++; /* number of allocated GC objects */
2263 if (gcstate->generations[0].count > gcstate->generations[0].threshold &&
2264 gcstate->enabled &&
2265 gcstate->generations[0].threshold &&
2266 !gcstate->collecting &&
2269 gcstate->collecting = 1;
2271 gcstate->collecting = 0;
2359 GCState *gcstate = get_gc_state();
2360 if (gcstate->generations[0].count > 0) {
2361 gcstate->generations[0].count--;