diff options
author | Mark Shannon <mark@hotpy.org> | 2022-09-08 16:16:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-08 16:16:48 (GMT) |
commit | aa3b4cf779b3dddb84e094879b91703354910d8c (patch) | |
tree | 3f0ddce65f690bdad6987db96e2f1353cb22d32f /Python/ceval.c | |
parent | b9634ac776c24bc4d4a57859d884a94cdfe16043 (diff) | |
download | cpython-aa3b4cf779b3dddb84e094879b91703354910d8c.zip cpython-aa3b4cf779b3dddb84e094879b91703354910d8c.tar.gz cpython-aa3b4cf779b3dddb84e094879b91703354910d8c.tar.bz2 |
GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 121 |
1 files changed, 59 insertions, 62 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 41320e9..8fca585 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -699,12 +699,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) #define PRE_DISPATCH_GOTO() ((void)0) #endif -#define NOTRACE_DISPATCH() \ - { \ - NEXTOPARG(); \ - PRE_DISPATCH_GOTO(); \ - DISPATCH_GOTO(); \ - } /* Do interpreter dispatch accounting for tracing and instrumentation */ #define DISPATCH() \ @@ -716,10 +710,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) DISPATCH_GOTO(); \ } -#define NOTRACE_DISPATCH_SAME_OPARG() \ +#define DISPATCH_SAME_OPARG() \ { \ opcode = _Py_OPCODE(*next_instr); \ PRE_DISPATCH_GOTO(); \ + opcode |= cframe.use_tracing OR_DTRACE_LINE; \ DISPATCH_GOTO(); \ } @@ -1212,7 +1207,7 @@ handle_eval_breaker: assert(value != NULL); Py_INCREF(value); PUSH(value); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_FAST__LOAD_CONST) { @@ -1225,7 +1220,7 @@ handle_eval_breaker: value = GETITEM(consts, oparg); Py_INCREF(value); PUSH(value); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(STORE_FAST__LOAD_FAST) { @@ -1237,7 +1232,7 @@ handle_eval_breaker: assert(value != NULL); Py_INCREF(value); PUSH(value); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(STORE_FAST__STORE_FAST) { @@ -1247,7 +1242,7 @@ handle_eval_breaker: next_instr++; value = POP(); SETLOCAL(oparg, value); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_CONST__LOAD_FAST) { @@ -1260,7 +1255,7 @@ handle_eval_breaker: assert(value != NULL); Py_INCREF(value); PUSH(value); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(POP_TOP) { @@ -1339,7 +1334,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_MULTIPLY_FLOAT) { @@ -1360,7 +1355,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_SUBTRACT_INT) { @@ -1379,7 +1374,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_SUBTRACT_FLOAT) { @@ -1399,7 +1394,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_ADD_UNICODE) { @@ -1418,7 +1413,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_INPLACE_ADD_UNICODE) { @@ -1454,7 +1449,7 @@ handle_eval_breaker: } // The STORE_FAST is already done. JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_ADD_FLOAT) { @@ -1475,7 +1470,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_OP_ADD_INT) { @@ -1494,7 +1489,7 @@ handle_eval_breaker: goto error; } JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_SUBSCR) { @@ -1560,7 +1555,7 @@ handle_eval_breaker: if (_Py_Specialize_BinarySubscr(container, sub, next_instr) < 0) { goto error; } - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(BINARY_SUBSCR, deferred); @@ -1591,7 +1586,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(list); JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_SUBSCR_TUPLE_INT) { @@ -1616,7 +1611,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(tuple); JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BINARY_SUBSCR_DICT) { @@ -1723,7 +1718,7 @@ handle_eval_breaker: if (_Py_Specialize_StoreSubscr(container, sub, next_instr) < 0) { goto error; } - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(STORE_SUBSCR, deferred); @@ -1755,7 +1750,7 @@ handle_eval_breaker: _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); JUMPBY(INLINE_CACHE_ENTRIES_STORE_SUBSCR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(STORE_SUBSCR_DICT) { @@ -2237,7 +2232,7 @@ handle_eval_breaker: PyObject *seq = TOP(); next_instr--; _Py_Specialize_UnpackSequence(seq, next_instr, oparg); - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(UNPACK_SEQUENCE, deferred); @@ -2255,7 +2250,7 @@ handle_eval_breaker: PUSH(Py_NewRef(PyTuple_GET_ITEM(seq, 0))); Py_DECREF(seq); JUMPBY(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(UNPACK_SEQUENCE_TUPLE) { @@ -2270,7 +2265,7 @@ handle_eval_breaker: } Py_DECREF(seq); JUMPBY(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(UNPACK_SEQUENCE_LIST) { @@ -2285,7 +2280,7 @@ handle_eval_breaker: } Py_DECREF(seq); JUMPBY(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(UNPACK_EX) { @@ -2480,7 +2475,7 @@ handle_eval_breaker: if (_Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name) < 0) { goto error; } - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(LOAD_GLOBAL, deferred); @@ -2507,7 +2502,7 @@ handle_eval_breaker: STACK_GROW(push_null+1); Py_INCREF(res); SET_TOP(res); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_GLOBAL_BUILTIN) { @@ -2532,7 +2527,7 @@ handle_eval_breaker: STACK_GROW(push_null+1); Py_INCREF(res); SET_TOP(res); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(DELETE_FAST) { @@ -2941,7 +2936,7 @@ handle_eval_breaker: if (_Py_Specialize_LoadAttr(owner, next_instr, name) < 0) { goto error; } - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(LOAD_ATTR, deferred); @@ -2972,7 +2967,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_MODULE) { @@ -2997,7 +2992,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_WITH_HINT) { @@ -3036,7 +3031,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_SLOT) { @@ -3058,7 +3053,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_CLASS) { @@ -3081,7 +3076,7 @@ handle_eval_breaker: SET_TOP(res); Py_DECREF(cls); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_PROPERTY) { @@ -3170,7 +3165,7 @@ handle_eval_breaker: if (_Py_Specialize_StoreAttr(owner, next_instr, name) < 0) { goto error; } - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(STORE_ATTR, deferred); @@ -3205,7 +3200,7 @@ handle_eval_breaker: } Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(STORE_ATTR_WITH_HINT) { @@ -3254,7 +3249,7 @@ handle_eval_breaker: dict->ma_version_tag = DICT_NEXT_VERSION(); Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(STORE_ATTR_SLOT) { @@ -3274,7 +3269,7 @@ handle_eval_breaker: Py_XDECREF(old_value); Py_DECREF(owner); JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(COMPARE_OP) { @@ -3301,7 +3296,7 @@ handle_eval_breaker: PyObject *left = SECOND(); next_instr--; _Py_Specialize_CompareOp(left, right, next_instr, oparg); - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(COMPARE_OP, deferred); @@ -3338,7 +3333,7 @@ handle_eval_breaker: else { JUMPBY(1 + oparg); } - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(COMPARE_OP_INT_JUMP) { @@ -3370,7 +3365,7 @@ handle_eval_breaker: else { JUMPBY(1 + oparg); } - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(COMPARE_OP_STR_JUMP) { @@ -3403,7 +3398,7 @@ handle_eval_breaker: else { JUMPBY(1 + oparg); } - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(IS_OP) { @@ -3828,7 +3823,7 @@ handle_eval_breaker: if (ADAPTIVE_COUNTER_IS_ZERO(cache)) { next_instr--; _Py_Specialize_ForIter(TOP(), next_instr); - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(FOR_ITER, deferred); @@ -3849,7 +3844,7 @@ handle_eval_breaker: Py_INCREF(next); PUSH(next); JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER); - NOTRACE_DISPATCH(); + DISPATCH(); } it->it_seq = NULL; Py_DECREF(seq); @@ -3857,7 +3852,7 @@ handle_eval_breaker: STACK_SHRINK(1); Py_DECREF(it); JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(FOR_ITER_RANGE) { @@ -3871,7 +3866,7 @@ handle_eval_breaker: STACK_SHRINK(1); Py_DECREF(r); JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); - NOTRACE_DISPATCH(); + DISPATCH(); } long value = (long)(r->start + (unsigned long)(r->index++) * r->step); @@ -3880,7 +3875,7 @@ handle_eval_breaker: } // The STORE_FAST is already done. JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + 1); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(BEFORE_ASYNC_WITH) { @@ -4027,7 +4022,7 @@ handle_eval_breaker: SET_TOP(res); PUSH(self); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_METHOD_WITH_DICT) { @@ -4055,7 +4050,7 @@ handle_eval_breaker: SET_TOP(res); PUSH(self); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_METHOD_NO_DICT) { @@ -4074,7 +4069,7 @@ handle_eval_breaker: SET_TOP(res); PUSH(self); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(LOAD_ATTR_METHOD_LAZY_DICT) { @@ -4097,7 +4092,7 @@ handle_eval_breaker: SET_TOP(res); PUSH(self); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { @@ -4207,7 +4202,7 @@ handle_eval_breaker: if (err < 0) { goto error; } - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(CALL, deferred); @@ -4304,7 +4299,7 @@ handle_eval_breaker: Py_DECREF(obj); STACK_SHRINK(2); SET_TOP(res); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(CALL_NO_KW_STR_1) { @@ -4574,7 +4569,7 @@ handle_eval_breaker: STACK_SHRINK(2); Py_DECREF(list); Py_DECREF(callable); - NOTRACE_DISPATCH(); + DISPATCH(); } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { @@ -4946,7 +4941,7 @@ handle_eval_breaker: PyObject *rhs = TOP(); next_instr--; _Py_Specialize_BinaryOp(lhs, rhs, next_instr, oparg, &GETLOCAL(0)); - NOTRACE_DISPATCH_SAME_OPARG(); + DISPATCH_SAME_OPARG(); } else { STAT_INC(BINARY_OP, deferred); @@ -4981,10 +4976,12 @@ handle_eval_breaker: } TARGET(EXTENDED_ARG_QUICK) { + assert(cframe.use_tracing == 0); assert(oparg); - oparg <<= 8; - oparg |= _Py_OPARG(*next_instr); - NOTRACE_DISPATCH_SAME_OPARG(); + int oldoparg = oparg; + NEXTOPARG(); + oparg |= oldoparg << 8; + DISPATCH_GOTO(); } TARGET(CACHE) { |