summaryrefslogtreecommitdiffstats
path: root/Python/optimizer_analysis.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2024-02-28 22:38:01 (GMT)
committerGitHub <noreply@github.com>2024-02-28 22:38:01 (GMT)
commit3409bc29c9f06051c28ae0791155e3aebd76ff2d (patch)
tree4b627c970a2d5a4b92fc48e320dbe24e579d4eab /Python/optimizer_analysis.c
parent75c6c05fea212330f4b0259602ffae1b2cb91be3 (diff)
downloadcpython-3409bc29c9f06051c28ae0791155e3aebd76ff2d.zip
cpython-3409bc29c9f06051c28ae0791155e3aebd76ff2d.tar.gz
cpython-3409bc29c9f06051c28ae0791155e3aebd76ff2d.tar.bz2
gh-115859: Re-enable T2 optimizer pass by default (#116062)
This undoes the *temporary* default disabling of the T2 optimizer pass in gh-115860. - Add a new test that reproduces Brandt's example from gh-115859; it indeed crashes before gh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
Diffstat (limited to 'Python/optimizer_analysis.c')
-rw-r--r--Python/optimizer_analysis.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c
index 8e408ff..2a7ef4e 100644
--- a/Python/optimizer_analysis.c
+++ b/Python/optimizer_analysis.c
@@ -297,6 +297,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
#define sym_set_non_null _Py_uop_sym_set_non_null
#define sym_set_type _Py_uop_sym_set_type
#define sym_set_const _Py_uop_sym_set_const
+#define sym_is_bottom _Py_uop_sym_is_bottom
#define frame_new _Py_uop_frame_new
#define frame_pop _Py_uop_frame_pop
@@ -510,12 +511,9 @@ _Py_uop_analyze_and_optimize(
peephole_opt(frame, buffer, buffer_size);
- char *uop_optimize = Py_GETENV("PYTHONUOPSOPTIMIZE");
- if (uop_optimize != NULL && *uop_optimize > '0') {
- err = optimize_uops(
- (PyCodeObject *)frame->f_executable, buffer,
- buffer_size, curr_stacklen, dependencies);
- }
+ err = optimize_uops(
+ (PyCodeObject *)frame->f_executable, buffer,
+ buffer_size, curr_stacklen, dependencies);
if (err == 0) {
goto not_ready;