[Python-checkins] bpo-44581: Don't execute quickened instructions if tracing is on (GH-27064)

markshannon webhook-mailer at python.org
Thu Jul 8 08:33:26 EDT 2021


https://github.com/python/cpython/commit/514f76bbac386c320a9f3a70797241c612544391
commit: 514f76bbac386c320a9f3a70797241c612544391
branch: main
author: Mark Shannon <mark at hotpy.org>
committer: markshannon <mark at hotpy.org>
date: 2021-07-08T13:33:13+01:00
summary:

bpo-44581: Don't execute quickened instructions if tracing is on (GH-27064)

files:
M Python/ceval.c

diff --git a/Python/ceval.c b/Python/ceval.c
index 194572a925d14..611a39de75d1a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1623,7 +1623,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
             JUMPTO(f->f_lasti);
             stack_pointer = f->f_valuestack+f->f_stackdepth;
             f->f_stackdepth = -1;
-            NEXTOPARG();
+            TRACING_NEXTOPARG();
         }
     }
 
@@ -2853,6 +2853,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_GLOBAL_ADAPTIVE): {
+            assert(cframe.use_tracing == 0);
             SpecializedCacheEntry *cache = GET_CACHE();
             if (cache->adaptive.counter == 0) {
                 PyObject *name = GETITEM(names, cache->adaptive.original_oparg);
@@ -2871,6 +2872,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_GLOBAL_MODULE): {
+            assert(cframe.use_tracing == 0);
             DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL);
             PyDictObject *dict = (PyDictObject *)GLOBALS();
             SpecializedCacheEntry *caches = GET_CACHE();
@@ -2888,6 +2890,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_GLOBAL_BUILTIN): {
+            assert(cframe.use_tracing == 0);
             DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL);
             DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL);
             PyDictObject *mdict = (PyDictObject *)GLOBALS();
@@ -3286,6 +3289,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_ATTR_ADAPTIVE): {
+            assert(cframe.use_tracing == 0);
             SpecializedCacheEntry *cache = GET_CACHE();
             if (cache->adaptive.counter == 0) {
                 PyObject *owner = TOP();
@@ -3305,6 +3309,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_ATTR_SPLIT_KEYS): {
+            assert(cframe.use_tracing == 0);
             PyObject *owner = TOP();
             PyObject *res;
             PyTypeObject *tp = Py_TYPE(owner);
@@ -3329,6 +3334,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_ATTR_MODULE): {
+            assert(cframe.use_tracing == 0);
             PyObject *owner = TOP();
             PyObject *res;
             SpecializedCacheEntry *caches = GET_CACHE();
@@ -3352,6 +3358,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_ATTR_WITH_HINT): {
+            assert(cframe.use_tracing == 0);
             PyObject *owner = TOP();
             PyObject *res;
             PyTypeObject *tp = Py_TYPE(owner);
@@ -3380,6 +3387,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
         }
 
         case TARGET(LOAD_ATTR_SLOT): {
+            assert(cframe.use_tracing == 0);
             PyObject *owner = TOP();
             PyObject *res;
             PyTypeObject *tp = Py_TYPE(owner);



More information about the Python-checkins mailing list