aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2024-01-28 18:48:48 -0800
committerGitHub <noreply@github.com>2024-01-28 18:48:48 -0800
commitf6d9e5926b6138994eaa60d1c36462e36105733d (patch)
tree53362fa9918ab65519ccf9a343cfcdfcfa9c4f6f /Python/pylifecycle.c
parentf7c05d7ad3075a1dbeed86b6b12903032e4afba6 (diff)
downloadcpython-f6d9e5926b6138994eaa60d1c36462e36105733d.tar.gz
cpython-f6d9e5926b6138994eaa60d1c36462e36105733d.zip
GH-113464: Add a JIT backend for tier 2 (GH-113465)
Add an option (--enable-experimental-jit for configure-based builds or --experimental-jit for PCbuild-based ones) to build an *experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf). See Tools/jit/README.md for more information on how to install the required build-time tooling.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index fff64dd63d6..372f6060237 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1240,12 +1240,19 @@ init_interp_main(PyThreadState *tstate)
// Turn on experimental tier 2 (uops-based) optimizer
if (is_main_interp) {
+#ifndef _Py_JIT
+ // No JIT, maybe use the tier two interpreter:
char *envvar = Py_GETENV("PYTHON_UOPS");
int enabled = envvar != NULL && *envvar > '0';
if (_Py_get_xoption(&config->xoptions, L"uops") != NULL) {
enabled = 1;
}
if (enabled) {
+#else
+ // Always enable tier two for JIT builds (ignoring the environment
+ // variable and command-line option above):
+ if (true) {
+#endif
PyObject *opt = PyUnstable_Optimizer_NewUOpOptimizer();
if (opt == NULL) {
return _PyStatus_ERR("can't initialize optimizer");