gh-135953: Simplify GC markers in the tachyon profiler (#141666)

This commit is contained in:
Pablo Galindo Salgado 2025-11-17 16:32:08 +00:00 committed by GitHub
parent cc6b62ac56
commit 274a26cca8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 23 deletions

View file

@ -186,7 +186,6 @@ static PyStructSequence_Field ThreadInfo_fields[] = {
{"thread_id", "Thread ID"},
{"status", "Thread status (flags: HAS_GIL, ON_CPU, UNKNOWN or legacy enum)"},
{"frame_info", "Frame information"},
{"gc_collecting", "Whether GC is collecting (interpreter-level)"},
{NULL}
};
@ -2726,8 +2725,6 @@ unwind_stack_for_thread(
goto error;
}
int gc_collecting = GET_MEMBER(int, gc_state, unwinder->debug_offsets.gc.collecting);
// Calculate thread status using flags (always)
int status_flags = 0;
@ -2827,18 +2824,10 @@ unwind_stack_for_thread(
goto error;
}
PyObject *py_gc_collecting = PyBool_FromLong(gc_collecting);
if (py_gc_collecting == NULL) {
set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to create gc_collecting");
Py_DECREF(py_status);
goto error;
}
// py_status contains status flags (bitfield)
PyStructSequence_SetItem(result, 0, thread_id);
PyStructSequence_SetItem(result, 1, py_status); // Steals reference
PyStructSequence_SetItem(result, 2, frame_info); // Steals reference
PyStructSequence_SetItem(result, 3, py_gc_collecting); // Steals reference
cleanup_stack_chunks(&chunks);
return result;