summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2024-05-01 01:26:34 (GMT)
committerGitHub <noreply@github.com>2024-05-01 01:26:34 (GMT)
commit7d83f7bcc484145596bae1ff015fed0762da345d (patch)
treef2f3cbb0cefaa920b319c77da00606fef1db48aa /Objects/codeobject.c
parent9c468e2c5dffb6fa9811fd16e70fa0463bdfce5f (diff)
downloadcpython-7d83f7bcc484145596bae1ff015fed0762da345d.zip
cpython-7d83f7bcc484145596bae1ff015fed0762da345d.tar.gz
cpython-7d83f7bcc484145596bae1ff015fed0762da345d.tar.bz2
gh-118335: Configure Tier 2 interpreter at build time (#118339)
The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 0146329..605167c 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -1496,6 +1496,8 @@ PyCode_GetFreevars(PyCodeObject *code)
return _PyCode_GetFreevars(code);
}
+#ifdef _Py_TIER2
+
static void
clear_executors(PyCodeObject *co)
{
@@ -1515,6 +1517,8 @@ _PyCode_Clear_Executors(PyCodeObject *code)
clear_executors(code);
}
+#endif
+
static void
deopt_code(PyCodeObject *code, _Py_CODEUNIT *instructions)
{
@@ -1739,9 +1743,11 @@ code_dealloc(PyCodeObject *co)
PyMem_Free(co_extra);
}
+#ifdef _Py_TIER2
if (co->co_executors != NULL) {
clear_executors(co);
}
+#endif
Py_XDECREF(co->co_consts);
Py_XDECREF(co->co_names);