Skip to content

Commit 021efd0

Browse files
generatedunixname1395027625275998meta-codesync[bot]
authored andcommitted
Inline GC track/untrack macros in JIT generator dealloc hot path
Reviewed By: alexmalyshev Differential Revision: D109906431 fbshipit-source-id: 5ba8f2886cd698feae5731375029ff493ae625ef
1 parent c860108 commit 021efd0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cinderx/Jit/generators_rt.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "internal/pycore_frame.h"
66
#include "internal/pycore_genobject.h"
7+
#include "internal/pycore_object.h" // _PyObject_GC_TRACK()/_PyObject_GC_UNTRACK()
78
#include "internal/pycore_pyerrors.h" // _PyErr_ClearExcState()
89

910
#include "cinderx/Common/log.h"
@@ -44,18 +45,18 @@ void gen_dealloc_with_custom_free(PyObject* self) {
4445

4546
auto* gen = reinterpret_cast<PyGenObject*>(self);
4647

47-
PyObject_GC_UnTrack(gen);
48+
_PyObject_GC_UNTRACK(gen);
4849

4950
if (gen->gi_weakreflist != nullptr) {
5051
PyObject_ClearWeakRefs(self);
5152
}
5253

5354
// Re-track so the finalizer can run; it may resurrect the object.
54-
PyObject_GC_Track(self);
55+
_PyObject_GC_TRACK(self);
5556
if (PyObject_CallFinalizerFromDealloc(self)) {
5657
return;
5758
}
58-
PyObject_GC_UnTrack(self);
59+
_PyObject_GC_UNTRACK(self);
5960

6061
JIT_DCHECK(
6162
!PyAsyncGen_CheckExact(gen),

0 commit comments

Comments
 (0)