mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-131238: Move _Py_VISIT_STACKREF() to pycore_stackref.h (#131560)
* Move _Py_VISIT_STACKREF() from pycore_gc.h to pycore_stackref.h. * Remove pycore_interpframe.h include from pycore_genobject.h. * Remove now useless includes from C files. * Add pycore_interpframe_structs.h to Makefile.pre.in and pythoncore.vcxproj.
This commit is contained in:
parent
cf9d1a4b6b
commit
7101cba6bf
11 changed files with 40 additions and 35 deletions
|
@ -352,16 +352,6 @@ union _PyStackRef;
|
||||||
extern int _PyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, void *arg);
|
extern int _PyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, void *arg);
|
||||||
extern int _PyGC_VisitStackRef(union _PyStackRef *ref, visitproc visit, void *arg);
|
extern int _PyGC_VisitStackRef(union _PyStackRef *ref, visitproc visit, void *arg);
|
||||||
|
|
||||||
// Like Py_VISIT but for _PyStackRef fields
|
|
||||||
#define _Py_VISIT_STACKREF(ref) \
|
|
||||||
do { \
|
|
||||||
if (!PyStackRef_IsNull(ref)) { \
|
|
||||||
int vret = _PyGC_VisitStackRef(&(ref), visit, arg); \
|
|
||||||
if (vret) \
|
|
||||||
return vret; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
extern void _PyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
|
extern void _PyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
|
||||||
gcvisitobjects_t callback, void *arg);
|
gcvisitobjects_t callback, void *arg);
|
||||||
|
|
|
@ -8,9 +8,10 @@ extern "C" {
|
||||||
# error "this header requires Py_BUILD_CORE define"
|
# error "this header requires Py_BUILD_CORE define"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "pycore_interpframe.h" // _PyInterpreterFrame
|
|
||||||
#include "pycore_interpframe_structs.h" // _PyGenObject
|
#include "pycore_interpframe_structs.h" // _PyGenObject
|
||||||
|
|
||||||
|
#include <stddef.h> // offsetof()
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
PyGenObject *_PyGen_GetGeneratorFromFrame(_PyInterpreterFrame *frame)
|
PyGenObject *_PyGen_GetGeneratorFromFrame(_PyInterpreterFrame *frame)
|
||||||
|
|
|
@ -658,6 +658,16 @@ _Py_TryIncrefCompareStackRef(PyObject **src, PyObject *op, _PyStackRef *out)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Like Py_VISIT but for _PyStackRef fields
|
||||||
|
#define _Py_VISIT_STACKREF(ref) \
|
||||||
|
do { \
|
||||||
|
if (!PyStackRef_IsNull(ref)) { \
|
||||||
|
int vret = _PyGC_VisitStackRef(&(ref), visit, arg); \
|
||||||
|
if (vret) \
|
||||||
|
return vret; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1257,6 +1257,7 @@ PYTHON_HEADERS= \
|
||||||
$(srcdir)/Include/internal/pycore_interp.h \
|
$(srcdir)/Include/internal/pycore_interp.h \
|
||||||
$(srcdir)/Include/internal/pycore_interp_structs.h \
|
$(srcdir)/Include/internal/pycore_interp_structs.h \
|
||||||
$(srcdir)/Include/internal/pycore_interpframe.h \
|
$(srcdir)/Include/internal/pycore_interpframe.h \
|
||||||
|
$(srcdir)/Include/internal/pycore_interpframe_structs.h \
|
||||||
$(srcdir)/Include/internal/pycore_intrinsics.h \
|
$(srcdir)/Include/internal/pycore_intrinsics.h \
|
||||||
$(srcdir)/Include/internal/pycore_jit.h \
|
$(srcdir)/Include/internal/pycore_jit.h \
|
||||||
$(srcdir)/Include/internal/pycore_list.h \
|
$(srcdir)/Include/internal/pycore_list.h \
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/* Frame object implementation */
|
/* Frame object implementation */
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_cell.h" // PyCell_GetRef()
|
||||||
#include "pycore_ceval.h" // _PyEval_SetOpcodeTrace()
|
#include "pycore_ceval.h" // _PyEval_SetOpcodeTrace()
|
||||||
#include "pycore_code.h" // CO_FAST_LOCAL, etc.
|
#include "pycore_code.h" // CO_FAST_LOCAL
|
||||||
#include "pycore_dict.h" // _PyDict_LoadBuiltinsFromGlobals()
|
#include "pycore_dict.h" // _PyDict_LoadBuiltinsFromGlobals()
|
||||||
|
#include "pycore_frame.h" // PyFrameObject
|
||||||
#include "pycore_function.h" // _PyFunction_FromConstructor()
|
#include "pycore_function.h" // _PyFunction_FromConstructor()
|
||||||
#include "pycore_genobject.h" // _PyGen_GetGeneratorFromFrame()
|
#include "pycore_genobject.h" // _PyGen_GetGeneratorFromFrame()
|
||||||
#include "pycore_moduleobject.h" // _PyModule_GetDict()
|
#include "pycore_interpframe.h" // _PyFrame_GetLocalsArray()
|
||||||
#include "pycore_cell.h" // PyCell_GetRef() PyCell_SetTakeRef()
|
|
||||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||||
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
||||||
#include "pycore_opcode_metadata.h" // _PyOpcode_Deopt, _PyOpcode_Caches
|
#include "pycore_opcode_metadata.h" // _PyOpcode_Caches
|
||||||
#include "pycore_optimizer.h" // _Py_Executors_InvalidateDependency()
|
#include "pycore_optimizer.h" // _Py_Executors_InvalidateDependency()
|
||||||
#include "pycore_unicodeobject.h" // _PyUnicode_Equal()
|
#include "pycore_unicodeobject.h" // _PyUnicode_Equal()
|
||||||
|
|
||||||
|
#include "frameobject.h" // PyFrameLocalsProxyObject
|
||||||
#include "frameobject.h" // PyFrameObject
|
|
||||||
#include "pycore_frame.h"
|
|
||||||
#include "opcode.h" // EXTENDED_ARG
|
#include "opcode.h" // EXTENDED_ARG
|
||||||
|
|
||||||
#include "clinic/frameobject.c.h"
|
#include "clinic/frameobject.c.h"
|
||||||
|
|
||||||
|
|
||||||
#define PyFrameObject_CAST(op) \
|
#define PyFrameObject_CAST(op) \
|
||||||
(assert(PyObject_TypeCheck((op), &PyFrame_Type)), (PyFrameObject *)(op))
|
(assert(PyObject_TypeCheck((op), &PyFrame_Type)), (PyFrameObject *)(op))
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,19 @@
|
||||||
#include "pycore_call.h" // _PyObject_CallNoArgs()
|
#include "pycore_call.h" // _PyObject_CallNoArgs()
|
||||||
#include "pycore_ceval.h" // _PyEval_EvalFrame()
|
#include "pycore_ceval.h" // _PyEval_EvalFrame()
|
||||||
#include "pycore_frame.h" // _PyInterpreterFrame
|
#include "pycore_frame.h" // _PyInterpreterFrame
|
||||||
#include "pycore_freelist.h" // _Py_FREELIST_FREE(), _Py_FREELIST_POP()
|
#include "pycore_freelist.h" // _Py_FREELIST_FREE()
|
||||||
#include "pycore_gc.h" // _PyGC_CLEAR_FINALIZED()
|
#include "pycore_gc.h" // _PyGC_CLEAR_FINALIZED()
|
||||||
#include "pycore_genobject.h"
|
#include "pycore_genobject.h" // _PyGen_SetStopIterationValue()
|
||||||
|
#include "pycore_interpframe.h" // _PyFrame_GetCode()
|
||||||
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
||||||
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
||||||
#include "pycore_opcode_utils.h" // RESUME_AFTER_YIELD_FROM
|
#include "pycore_opcode_utils.h" // RESUME_AFTER_YIELD_FROM
|
||||||
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_*
|
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_LOAD_UINT8_RELAXED()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_ClearExcState()
|
#include "pycore_pyerrors.h" // _PyErr_ClearExcState()
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
#include "pycore_warnings.h" // _PyErr_WarnUnawaitedCoroutine()
|
#include "pycore_warnings.h" // _PyErr_WarnUnawaitedCoroutine()
|
||||||
|
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
static PyObject* gen_close(PyObject *, PyObject *);
|
static PyObject* gen_close(PyObject *, PyObject *);
|
||||||
static PyObject* async_gen_asend_new(PyAsyncGenObject *, PyObject *);
|
static PyObject* async_gen_asend_new(PyAsyncGenObject *, PyObject *);
|
||||||
|
|
|
@ -262,6 +262,7 @@
|
||||||
<ClInclude Include="..\Include\internal\pycore_interp.h" />
|
<ClInclude Include="..\Include\internal\pycore_interp.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_interp_structs.h" />
|
<ClInclude Include="..\Include\internal\pycore_interp_structs.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_interpframe.h" />
|
<ClInclude Include="..\Include\internal\pycore_interpframe.h" />
|
||||||
|
<ClInclude Include="..\Include\internal\pycore_interpframe_structs.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_intrinsics.h" />
|
<ClInclude Include="..\Include\internal\pycore_intrinsics.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_jit.h" />
|
<ClInclude Include="..\Include\internal\pycore_jit.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_list.h" />
|
<ClInclude Include="..\Include\internal\pycore_list.h" />
|
||||||
|
|
|
@ -705,6 +705,9 @@
|
||||||
<ClInclude Include="..\Include\internal\pycore_interpframe.h">
|
<ClInclude Include="..\Include\internal\pycore_interpframe.h">
|
||||||
<Filter>Include\internal</Filter>
|
<Filter>Include\internal</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\internal\pycore_interpframe_structs.h">
|
||||||
|
<Filter>Include\internal</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\Include\internal\pycore_intrinsics.h">
|
<ClInclude Include="..\Include\internal\pycore_intrinsics.h">
|
||||||
<Filter>Include\cpython</Filter>
|
<Filter>Include\cpython</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_frame.h" // PyFrameObject members
|
#include "pycore_frame.h" // PyFrameObject
|
||||||
#include "pycore_genobject.h" // PyAsyncGenObject
|
#include "pycore_genobject.h" // PyAsyncGenObject
|
||||||
#include "pycore_import.h" // _PyImport_GetModules()
|
#include "pycore_import.h" // _PyImport_GetModules()
|
||||||
#include "pycore_interp.h" // PyInterpreterState.warnings
|
#include "pycore_interpframe.h" // _PyFrame_GetCode()
|
||||||
#include "pycore_long.h" // _PyLong_GetZero()
|
#include "pycore_long.h" // _PyLong_GetZero()
|
||||||
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
|
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
|
|
||||||
#define _PY_INTERPRETER
|
#define _PY_INTERPRETER
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "frameobject.h"
|
#include "pycore_frame.h" // _PyFrame_New_NoTrack()
|
||||||
#include "pycore_code.h" // stats
|
#include "pycore_interpframe.h" // _PyFrame_GetCode()
|
||||||
#include "pycore_frame.h"
|
#include "pycore_genobject.h" // _PyGen_GetGeneratorFromFrame()
|
||||||
#include "pycore_genobject.h"
|
#include "pycore_stackref.h" // _Py_VISIT_STACKREF()
|
||||||
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
|
||||||
#include "opcode.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg)
|
_PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg)
|
||||||
|
|
|
@ -2,18 +2,17 @@
|
||||||
#define _PY_INTERPRETER
|
#define _PY_INTERPRETER
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_frame.h"
|
#include "pycore_compile.h" // _PyCompile_GetUnaryIntrinsicName
|
||||||
#include "pycore_function.h"
|
#include "pycore_function.h" // _Py_set_function_type_params()
|
||||||
#include "pycore_global_objects.h"
|
|
||||||
#include "pycore_genobject.h" // _PyAsyncGenValueWrapperNew
|
#include "pycore_genobject.h" // _PyAsyncGenValueWrapperNew
|
||||||
#include "pycore_compile.h" // _PyCompile_GetUnaryIntrinsicName, etc
|
#include "pycore_interpframe.h" // _PyFrame_GetLocals()
|
||||||
#include "pycore_intrinsics.h" // INTRINSIC_PRINT
|
#include "pycore_intrinsics.h" // INTRINSIC_PRINT
|
||||||
#include "pycore_pyerrors.h" // _PyErr_SetString()
|
#include "pycore_pyerrors.h" // _PyErr_SetString()
|
||||||
#include "pycore_runtime.h" // _Py_ID()
|
#include "pycore_runtime.h" // _Py_ID()
|
||||||
#include "pycore_sysmodule.h" // _PySys_GetRequiredAttr()
|
#include "pycore_sysmodule.h" // _PySys_GetRequiredAttr()
|
||||||
#include "pycore_tuple.h" // _PyTuple_FromArray()
|
#include "pycore_tuple.h" // _PyTuple_FromArray()
|
||||||
#include "pycore_typevarobject.h" // _Py_make_typevar()
|
#include "pycore_typevarobject.h" // _Py_make_typevar()
|
||||||
#include "pycore_unicodeobject.h" // _PyUnicode_FromASCII
|
#include "pycore_unicodeobject.h" // _PyUnicode_FromASCII()
|
||||||
|
|
||||||
|
|
||||||
/******** Unary functions ********/
|
/******** Unary functions ********/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue