aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2024-04-30 18:26:34 -0700
committerGitHub <noreply@github.com>2024-04-30 18:26:34 -0700
commit7d83f7bcc484145596bae1ff015fed0762da345d (patch)
treef2f3cbb0cefaa920b319c77da00606fef1db48aa /Python/bytecodes.c
parent9c468e2c5dffb6fa9811fd16e70fa0463bdfce5f (diff)
downloadcpython-7d83f7bcc484145596bae1ff015fed0762da345d.tar.gz
cpython-7d83f7bcc484145596bae1ff015fed0762da345d.zip
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/bytecodes.c')
-rw-r--r--Python/bytecodes.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 18837aef74d..28766d6d97c 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2363,6 +2363,7 @@ dummy_func(
CHECK_EVAL_BREAKER();
assert(oparg <= INSTR_OFFSET());
JUMPBY(-oparg);
+ #ifdef _Py_TIER2
#if ENABLE_SPECIALIZATION
_Py_BackoffCounter counter = this_instr[1].counter;
if (backoff_counter_triggers(counter) && this_instr->op.code == JUMP_BACKWARD) {
@@ -2388,6 +2389,7 @@ dummy_func(
ADVANCE_ADAPTIVE_COUNTER(this_instr[1].counter);
}
#endif /* ENABLE_SPECIALIZATION */
+ #endif /* _Py_TIER2 */
}
pseudo(JUMP) = {
@@ -2401,6 +2403,7 @@ dummy_func(
};
tier1 inst(ENTER_EXECUTOR, (--)) {
+ #ifdef _Py_TIER2
int prevoparg = oparg;
CHECK_EVAL_BREAKER();
if (this_instr->op.code != ENTER_EXECUTOR ||
@@ -2418,6 +2421,9 @@ dummy_func(
tstate->previous_executor = Py_None;
Py_INCREF(executor);
GOTO_TIER_TWO(executor);
+ #else
+ Py_FatalError("ENTER_EXECUTOR is not supported in this build");
+ #endif /* _Py_TIER2 */
}
replaced op(_POP_JUMP_IF_FALSE, (cond -- )) {