Skip to content

Commit a33ffe4

Browse files
gh-114058: More robust method handling in redundancy eliminator (GH-115779)
1 parent a494a3d commit a33ffe4

3 files changed

+41
-16
lines changed

Python/optimizer_analysis.c

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ sym_new_known_notnull(_Py_UOpsAbstractInterpContext *ctx)
315315
if (res == NULL) {
316316
return NULL;
317317
}
318+
sym_set_flag(res, KNOWN);
318319
sym_set_flag(res, NOT_NULL);
319320
return res;
320321
}

Python/tier2_redundancy_eliminator_bytecodes.c

+21
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,27 @@ dummy_func(void) {
295295
(void)owner;
296296
}
297297

298+
op(_LOAD_ATTR_METHOD_WITH_VALUES, (descr/4, owner -- attr, self if (1))) {
299+
OUT_OF_SPACE_IF_NULL(attr = sym_new_known_notnull(ctx));
300+
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
301+
}
302+
303+
op(_LOAD_ATTR_METHOD_NO_DICT, (descr/4, owner -- attr, self if (1))) {
304+
OUT_OF_SPACE_IF_NULL(attr = sym_new_known_notnull(ctx));
305+
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
306+
}
307+
308+
op(_LOAD_ATTR_METHOD_LAZY_DICT, (descr/4, owner -- attr, self if (1))) {
309+
OUT_OF_SPACE_IF_NULL(attr = sym_new_known_notnull(ctx));
310+
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
311+
}
312+
313+
op(_INIT_CALL_BOUND_METHOD_EXACT_ARGS, (callable, unused, unused[oparg] -- func, self, unused[oparg])) {
314+
OUT_OF_SPACE_IF_NULL(func = sym_new_known_notnull(ctx));
315+
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
316+
}
317+
318+
298319
op(_CHECK_FUNCTION_EXACT_ARGS, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
299320
sym_set_type(callable, &PyFunction_Type);
300321
(void)self_or_null;

Python/tier2_redundancy_eliminator_cases.c.h

+19-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)