diff options
author | Mark Shannon <mark@hotpy.org> | 2025-04-29 18:00:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-29 18:00:35 +0100 |
commit | ccf1b0b1c18e6d00fb919bce107f2793bab0a471 (patch) | |
tree | 94c1bd2fd030defe28291ae62acbfcb1c2cb4b2b /Python/gc_free_threading.c | |
parent | caee16f05229de5bc5ed2743c531f1696641888a (diff) | |
download | cpython-ccf1b0b1c18e6d00fb919bce107f2793bab0a471.tar.gz cpython-ccf1b0b1c18e6d00fb919bce107f2793bab0a471.zip |
GH-132508: Use tagged integers on the evaluation stack for the last instruction offset (GH-132545)
Diffstat (limited to 'Python/gc_free_threading.c')
-rw-r--r-- | Python/gc_free_threading.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index fa4cb56f01e..d22307ae4ff 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -265,7 +265,7 @@ frame_disable_deferred_refcounting(_PyInterpreterFrame *frame) frame->f_funcobj = PyStackRef_AsStrongReference(frame->f_funcobj); for (_PyStackRef *ref = frame->localsplus; ref < frame->stackpointer; ref++) { - if (!PyStackRef_IsNull(*ref) && PyStackRef_IsDeferred(*ref)) { + if (!PyStackRef_IsNullOrInt(*ref) && PyStackRef_IsDeferred(*ref)) { *ref = PyStackRef_AsStrongReference(*ref); } } @@ -420,7 +420,7 @@ gc_visit_heaps(PyInterpreterState *interp, mi_block_visit_fun *visitor, static inline void gc_visit_stackref(_PyStackRef stackref) { - if (PyStackRef_IsDeferred(stackref) && !PyStackRef_IsNull(stackref)) { + if (PyStackRef_IsDeferred(stackref) && !PyStackRef_IsNullOrInt(stackref)) { PyObject *obj = PyStackRef_AsPyObjectBorrow(stackref); if (_PyObject_GC_IS_TRACKED(obj) && !gc_is_frozen(obj)) { gc_add_refs(obj, 1); @@ -817,7 +817,7 @@ gc_abort_mark_alive(PyInterpreterState *interp, static int gc_visit_stackref_mark_alive(gc_mark_args_t *args, _PyStackRef stackref) { - if (!PyStackRef_IsNull(stackref)) { + if (!PyStackRef_IsNullOrInt(stackref)) { PyObject *op = PyStackRef_AsPyObjectBorrow(stackref); if (gc_mark_enqueue(op, args) < 0) { return -1; @@ -1706,6 +1706,7 @@ _PyGC_VisitStackRef(_PyStackRef *ref, visitproc visit, void *arg) // This is a bit tricky! We want to ignore deferred references when // computing the incoming references, but otherwise treat them like // regular references. + assert(!PyStackRef_IsTaggedInt(*ref)); if (!PyStackRef_IsDeferred(*ref) || (visit != visit_decref && visit != visit_decref_unreachable)) { |