Lines Matching defs:unreachable

55 // Only unreachable objects have this flag.
62 // This flag represents the object is in unreachable list in move_unreachable()
67 // Between them, unreachable list is not normal list and we can not use
218 indirectly) from outside the generation into an "unreachable" set and
223 "unreachable" set.
226 move_legacy_finalizers() will remove this flag from "unreachable" set.
513 // Manually unlink gc from unreachable list because the list functions
545 /* Move the unreachable objects from young to unreachable. After this,
547 * unreachable have the flag.
549 * from outside the original young; and all objects in unreachable are
552 * This function restores _gc_prev pointer. young and unreachable are
554 * But _gc_next in unreachable list has NEXT_MASK_UNREACHABLE flag.
555 * So we can not gc_list_* functions for unreachable until we remove the flag.
558 move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
568 * unreachable now, and have NEXT_MASK_UNREACHABLE. All objects to the
599 /* This *may* be unreachable. To make progress,
606 // Move gc to unreachable.
612 PyGC_Head *last = GC_PREV(unreachable);
613 // NOTE: Since all objects in unreachable set has
615 // But this may pollute the unreachable list head's 'next' pointer
620 gc->_gc_next = (NEXT_MASK_UNREACHABLE | (uintptr_t)unreachable);
621 unreachable->_gc_prev = (uintptr_t)gc;
628 unreachable->_gc_next &= ~NEXT_MASK_UNREACHABLE;
667 /* Move the objects in unreachable with tp_del slots into `finalizers`.
670 * from _gc_next in unreachable.
673 move_legacy_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
676 assert((unreachable->_gc_next & NEXT_MASK_UNREACHABLE) == 0);
678 /* March over unreachable. Move objects with finalizers into
681 for (gc = GC_NEXT(unreachable); gc != unreachable; gc = next) {
696 clear_unreachable_mask(PyGC_Head *unreachable)
698 /* Check that the list head does not have the unreachable bit set */
699 assert(((uintptr_t)unreachable & NEXT_MASK_UNREACHABLE) == 0);
702 assert((unreachable->_gc_next & NEXT_MASK_UNREACHABLE) == 0);
703 for (gc = GC_NEXT(unreachable); gc != unreachable; gc = next) {
708 validate_list(unreachable, collecting_set_unreachable_clear);
725 /* Move objects that are reachable from finalizers, from the unreachable set
742 /* Clear all weakrefs to unreachable objects, and if such a weakref has a
744 * weakrefs to be outside the unreachable set -- indeed, those are precisely
750 * unreachable are left at GC_TENTATIVELY_UNREACHABLE. When this returns,
751 * no object in `unreachable` is weakly referenced anymore.
754 handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
765 /* Clear all weakrefs to the objects in unreachable. If such a weakref
768 * all weakrefs to unreachable objects are cleared, lest the callback
769 * resurrect an unreachable object via a still-active weakref. We
773 for (gc = GC_NEXT(unreachable); gc != unreachable; gc = next) {
780 /* A weakref inside the unreachable set must be cleared. If we
783 * them. Or, it could resurrect unreachable objects. One way
785 * tp_traverse. Then, wr_object can be outside the unreachable
831 * cyclic trash (CT), then although the CT is unreachable from
836 * wr is simply left in the unreachable set. Note that because we
869 * because they can't reference unreachable objects.
1064 /* Deduce which objects among "base" are unreachable from outside the list
1065 and move them to 'unreachable'. The process consist in the following steps:
1073 reference count, while all unreachable objects must have a count of exactly 0.
1074 3. Identify all unreachable objects (the ones with 0 reference count) and move
1075 them to the "unreachable" list. This step also needs to move back to "base" all
1076 objects that were initially marked as unreachable but are referred transitively
1083 * The "unreachable" list must be uninitialized (this function calls
1084 gc_list_init over 'unreachable').
1086 IMPORTANT: This function leaves 'unreachable' with the NEXT_MASK_UNREACHABLE
1089 by a call to 'move_legacy_finalizers'), the 'unreachable' list is not a normal
1092 deduce_unreachable(PyGC_Head *base, PyGC_Head *unreachable) {
1103 * everything else (in base) to unreachable.
1107 * so it's more efficient to move the unreachable things. It "sounds slick"
1108 * to move the unreachable objects, until you think about it - the reason it
1116 * When move_unreachable finds A, A is moved to the unreachable list. The
1132 * after finalizers may resurrect objects. In _that_ case most unreachable
1133 * objects will remain unreachable, so it would be more efficient to move
1137 gc_list_init(unreachable);
1138 move_unreachable(base, unreachable); // gc_prev is pointer again
1140 validate_list(unreachable, collecting_set_unreachable_set);
1147 * After this function 'unreachable' must not be used anymore and 'still_unreachable'
1157 handle_resurrected_objects(PyGC_Head *unreachable, PyGC_Head* still_unreachable,
1160 // Remove the PREV_MASK_COLLECTING from unreachable
1162 gc_list_clear_collecting(unreachable);
1167 PyGC_Head* resurrected = unreachable;
1184 Py_ssize_t n = 0; /* # unreachable objects that couldn't be collected */
1187 PyGC_Head unreachable; /* non-problematic unreachable trash */
1226 deduce_unreachable(young, &unreachable);
1244 /* All objects in unreachable are trash, but objects reachable from
1249 // After move_legacy_finalizers(), unreachable is normal list.
1250 move_legacy_finalizers(&unreachable, &finalizers);
1251 /* finalizers contains the unreachable objects with a legacy finalizer;
1252 * unreachable objects reachable *from* those are also uncollectable,
1258 validate_list(&unreachable, collecting_set_unreachable_clear);
1262 for (gc = GC_NEXT(&unreachable); gc != &unreachable; gc = GC_NEXT(gc)) {
1268 m += handle_weakrefs(&unreachable, old);
1271 validate_list(&unreachable, collecting_set_unreachable_clear);
1274 finalize_garbage(tstate, &unreachable);
1278 * objects that are still unreachable */
1280 handle_resurrected_objects(&unreachable, &final_unreachable, old);
1299 "gc: done, %zd unreachable, %zd uncollectable, %.4fs elapsed\n",
1516 The number of unreachable objects is returned.
1551 DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects