summaryrefslogtreecommitdiffstats
path: root/Python/ceval_macros.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-06-27 02:02:57 (GMT)
committerGitHub <noreply@github.com>2023-06-27 02:02:57 (GMT)
commit51fc72511733353de15bc633a3d7b6da366842e4 (patch)
tree13c7075d57530adf90f82ba0025649f163b51abb /Python/ceval_macros.h
parentd3af83b9342457d8b24476baeb799f7506ff04f3 (diff)
downloadcpython-51fc72511733353de15bc633a3d7b6da366842e4.zip
cpython-51fc72511733353de15bc633a3d7b6da366842e4.tar.gz
cpython-51fc72511733353de15bc633a3d7b6da366842e4.tar.bz2
gh-104584: Baby steps towards generating and executing traces (#105924)
Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose). All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
Diffstat (limited to 'Python/ceval_macros.h')
-rw-r--r--Python/ceval_macros.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h
index 706a9a2..0d41ef5 100644
--- a/Python/ceval_macros.h
+++ b/Python/ceval_macros.h
@@ -1,4 +1,4 @@
-// Macros needed by ceval.c and bytecodes.c
+// Macros and other things needed by ceval.c and bytecodes.c
/* Computed GOTOs, or
the-optimization-commonly-but-improperly-known-as-"threaded code"
@@ -339,3 +339,11 @@ do { \
goto error; \
} \
} while (0);
+
+typedef PyObject *(*convertion_func_ptr)(PyObject *);
+
+static const convertion_func_ptr CONVERSION_FUNCTIONS[4] = {
+ [FVC_STR] = PyObject_Str,
+ [FVC_REPR] = PyObject_Repr,
+ [FVC_ASCII] = PyObject_ASCII
+};