summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Chernikov <tchernikoff.denis2013@yandex.ru>2020-02-21 09:17:50 (GMT)
committerGitHub <noreply@github.com>2020-02-21 09:17:50 (GMT)
commitbaf29b221682be0f4fde53a05ea3f57c3c79f431 (patch)
treed98ffbf68f4d566e0a0468dd29b17eb06ec653b8
parentd4331c56b4f6fe6f18caf19fc1ecf9fec14f7066 (diff)
downloadcpython-baf29b221682be0f4fde53a05ea3f57c3c79f431.zip
cpython-baf29b221682be0f4fde53a05ea3f57c3c79f431.tar.gz
cpython-baf29b221682be0f4fde53a05ea3f57c3c79f431.tar.bz2
Reuse identifier of PREDICT macros as PREDICT_ID (GH-17155)
In function `_PyEval_EvalFrameDefault`, macros PREDICT and PREDICTED use the same identifier creation scheme, which may be shared between them, reducing code repetition, and do ensure that the same identifier is generated.
-rw-r--r--Python/ceval.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 426d0bb..3f65820 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -921,21 +921,23 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
*/
+#define PREDICT_ID(op) PRED_##op
+
#if defined(DYNAMIC_EXECUTION_PROFILE) || USE_COMPUTED_GOTOS
-#define PREDICT(op) if (0) goto PRED_##op
+#define PREDICT(op) if (0) goto PREDICT_ID(op)
#else
#define PREDICT(op) \
- do{ \
+ do { \
_Py_CODEUNIT word = *next_instr; \
opcode = _Py_OPCODE(word); \
- if (opcode == op){ \
+ if (opcode == op) { \
oparg = _Py_OPARG(word); \
next_instr++; \
- goto PRED_##op; \
+ goto PREDICT_ID(op); \
} \
} while(0)
#endif
-#define PREDICTED(op) PRED_##op:
+#define PREDICTED(op) PREDICT_ID(op):
/* Stack manipulation macros */