mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-39984: Add PyInterpreterState.ceval (GH-19047)
subinterpreters: Move _PyRuntimeState.ceval.tracing_possible to PyInterpreterState.ceval.tracing_possible: each interpreter now has its own variable. Changes: * Add _ceval_state structure. * Add PyInterpreterState.ceval field. * _PyEval_EvalFrameDefault(): add ceval2 variable (struct _ceval_state*). * Rename _PyEval_Initialize() to _PyEval_InitRuntimeState(). * Add _PyEval_InitState(). * Don't export internal _Py_FinishPendingCalls() and _PyEval_FiniThreads() functions anymore.
This commit is contained in:
parent
514c469719
commit
dab8423d22
5 changed files with 35 additions and 19 deletions
|
@ -15,9 +15,10 @@ struct _frame;
|
|||
|
||||
#include "pycore_pystate.h" /* PyInterpreterState.eval_frame */
|
||||
|
||||
PyAPI_FUNC(void) _Py_FinishPendingCalls(PyThreadState *tstate);
|
||||
PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);
|
||||
PyAPI_FUNC(void) _PyEval_FiniThreads(
|
||||
extern void _Py_FinishPendingCalls(PyThreadState *tstate);
|
||||
extern void _PyEval_InitRuntimeState(struct _ceval_runtime_state *);
|
||||
extern void _PyEval_InitState(struct _ceval_state *);
|
||||
extern void _PyEval_FiniThreads(
|
||||
struct _ceval_runtime_state *ceval);
|
||||
PyAPI_FUNC(void) _PyEval_SignalReceived(
|
||||
struct _ceval_runtime_state *ceval);
|
||||
|
|
|
@ -35,12 +35,6 @@ struct _pending_calls {
|
|||
|
||||
struct _ceval_runtime_state {
|
||||
int recursion_limit;
|
||||
/* Records whether tracing is on for any thread. Counts the number
|
||||
of threads for which tstate->c_tracefunc is non-NULL, so if the
|
||||
value is 0, we know we don't have to check this thread's
|
||||
c_tracefunc. This speeds up the if statement in
|
||||
PyEval_EvalFrameEx() after fast_next_opcode. */
|
||||
int tracing_possible;
|
||||
/* This single variable consolidates all requests to break out of
|
||||
the fast path in the eval loop. */
|
||||
_Py_atomic_int eval_breaker;
|
||||
|
@ -52,6 +46,15 @@ struct _ceval_runtime_state {
|
|||
struct _gil_runtime_state gil;
|
||||
};
|
||||
|
||||
struct _ceval_state {
|
||||
/* Records whether tracing is on for any thread. Counts the number
|
||||
of threads for which tstate->c_tracefunc is non-NULL, so if the
|
||||
value is 0, we know we don't have to check this thread's
|
||||
c_tracefunc. This speeds up the if statement in
|
||||
_PyEval_EvalFrameDefault() after fast_next_opcode. */
|
||||
int tracing_possible;
|
||||
};
|
||||
|
||||
/* interpreter state */
|
||||
|
||||
#define _PY_NSMALLPOSINTS 257
|
||||
|
@ -75,6 +78,7 @@ struct _is {
|
|||
|
||||
int finalizing;
|
||||
|
||||
struct _ceval_state ceval;
|
||||
struct _gc_runtime_state gc;
|
||||
|
||||
PyObject *modules;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue