Skip to content

Commit

Permalink
gh-114058: More robust method handling in redundancy eliminator (GH-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner authored Feb 23, 2024
1 parent a494a3d commit a33ffe4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
1 change: 1 addition & 0 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ sym_new_known_notnull(_Py_UOpsAbstractInterpContext *ctx)
if (res == NULL) {
return NULL;
}
sym_set_flag(res, KNOWN);
sym_set_flag(res, NOT_NULL);
return res;
}
Expand Down
21 changes: 21 additions & 0 deletions Python/tier2_redundancy_eliminator_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,27 @@ dummy_func(void) {
(void)owner;
}

op(_LOAD_ATTR_METHOD_WITH_VALUES, (descr/4, owner -- attr, self if (1))) {
OUT_OF_SPACE_IF_NULL(attr = sym_new_known_notnull(ctx));
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
}

op(_LOAD_ATTR_METHOD_NO_DICT, (descr/4, owner -- attr, self if (1))) {
OUT_OF_SPACE_IF_NULL(attr = sym_new_known_notnull(ctx));
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
}

op(_LOAD_ATTR_METHOD_LAZY_DICT, (descr/4, owner -- attr, self if (1))) {
OUT_OF_SPACE_IF_NULL(attr = sym_new_known_notnull(ctx));
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
}

op(_INIT_CALL_BOUND_METHOD_EXACT_ARGS, (callable, unused, unused[oparg] -- func, self, unused[oparg])) {
OUT_OF_SPACE_IF_NULL(func = sym_new_known_notnull(ctx));
OUT_OF_SPACE_IF_NULL(self = sym_new_known_notnull(ctx));
}


op(_CHECK_FUNCTION_EXACT_ARGS, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
sym_set_type(callable, &PyFunction_Type);
(void)self_or_null;
Expand Down
35 changes: 19 additions & 16 deletions Python/tier2_redundancy_eliminator_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a33ffe4

Please sign in to comment.