summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-17 17:56:44 (GMT)
committerGitHub <noreply@github.com>2020-03-17 17:56:44 (GMT)
commitdab8423d220243efabbbcafafc12d90145539b50 (patch)
treeea5292be67fbb841bf16c76099a4b51c0871afd3 /Include/internal
parent514c469719f149e1722a91a9d0c63bf89dfefb2a (diff)
downloadcpython-dab8423d220243efabbbcafafc12d90145539b50.zip
cpython-dab8423d220243efabbbcafafc12d90145539b50.tar.gz
cpython-dab8423d220243efabbbcafafc12d90145539b50.tar.bz2
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.
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_ceval.h7
-rw-r--r--Include/internal/pycore_pystate.h16
2 files changed, 14 insertions, 9 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index ae6ef9a..ec00d18 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -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);
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 0a83546..0e3a9e6 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -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;