diff options
author | Guido van Rossum <guido@python.org> | 2023-06-27 02:02:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-27 02:02:57 (GMT) |
commit | 51fc72511733353de15bc633a3d7b6da366842e4 (patch) | |
tree | 13c7075d57530adf90f82ba0025649f163b51abb /Modules | |
parent | d3af83b9342457d8b24476baeb799f7506ff04f3 (diff) | |
download | cpython-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 'Modules')
-rw-r--r-- | Modules/_testinternalcapi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 0a3b0dd..3c0c2ad 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -831,6 +831,12 @@ get_counter_optimizer(PyObject *self, PyObject *arg) } static PyObject * +get_uop_optimizer(PyObject *self, PyObject *arg) +{ + return PyUnstable_Optimizer_NewUOpOptimizer(); +} + +static PyObject * set_optimizer(PyObject *self, PyObject *opt) { if (opt == Py_None) { @@ -994,6 +1000,7 @@ static PyMethodDef module_functions[] = { {"get_optimizer", get_optimizer, METH_NOARGS, NULL}, {"set_optimizer", set_optimizer, METH_O, NULL}, {"get_counter_optimizer", get_counter_optimizer, METH_NOARGS, NULL}, + {"get_uop_optimizer", get_uop_optimizer, METH_NOARGS, NULL}, {"pending_threadfunc", _PyCFunction_CAST(pending_threadfunc), METH_VARARGS | METH_KEYWORDS}, // {"pending_fd_identify", pending_fd_identify, METH_VARARGS, NULL}, |