diff options
author | Guido van Rossum <guido@python.org> | 2024-05-01 01:26:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 01:26:34 (GMT) |
commit | 7d83f7bcc484145596bae1ff015fed0762da345d (patch) | |
tree | f2f3cbb0cefaa920b319c77da00606fef1db48aa /Python/instrumentation.c | |
parent | 9c468e2c5dffb6fa9811fd16e70fa0463bdfce5f (diff) | |
download | cpython-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 'Python/instrumentation.c')
-rw-r--r-- | Python/instrumentation.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/instrumentation.c b/Python/instrumentation.c index ce97c3a..5614f48 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -1705,10 +1705,12 @@ instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp) ); return 0; } +#ifdef _Py_TIER2 if (code->co_executors != NULL) { _PyCode_Clear_Executors(code); } _Py_Executors_InvalidateDependency(interp, code, 1); +#endif int code_len = (int)Py_SIZE(code); /* Exit early to avoid creating instrumentation * data for potential statically allocated code @@ -1946,7 +1948,9 @@ _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events) goto done; } set_global_version(tstate, new_version); +#ifdef _Py_TIER2 _Py_Executors_InvalidateAll(interp, 1); +#endif res = instrument_all_executing_code_objects(interp); done: _PyEval_StartTheWorld(interp); @@ -1986,7 +1990,9 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent code->_co_instrumentation_version -= MONITORING_VERSION_INCREMENT; } +#ifdef _Py_TIER2 _Py_Executors_InvalidateDependency(interp, code, 1); +#endif res = instrument_lock_held(code, interp); |