-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
port comprehension inlining to Python/compile.c also
Summary: Original comprehension inlining diff from 3.8: D28940584 (03040db) In D39216342 we ported comprehension inlining only to the py-compiler. Since then we've discovered that py-compiler is in practice still used only for strict and static modules, so we should port valuable optimizations to `compile.c` also. This ports comprehension inlining to `compile.c` as well. Ensure that we run the comprehension-inliner tests against both py-compiler and compile.c. Also requires moving the implementation in py-compiler from `CinderCodeGenerator` up to the base class `CinderBaseCodeGenerator`, since side-by-side comparison testing betweeen py-compiler and compile.c uses `CinderBaseCodeGenerator`. In 3.8 there was a difference in behavior between py-compiler and compile.c on the two `nested_diff_scopes` inlining tests. This difference was not caught in 3.8 because the inlining tests only ran against `compile.c`, and the tested case did not occur in the corpus for side-by-side testing. In porting inlining to py-compiler in 3.10, we switched the inlining tests to run against py-compiler, and adjusted the two `nested_diff_scopes` tests accordingly; this resulted in adding `DELETE_DEREF` opcodes in those two tests that weren't present in those tests in 3.8. In this diff I remove those opcodes again and adjust the py-compiler implementation so that they aren't emitted. In actual fact neither the presence nor absence of those `DELETE_DEREF` opcodes is correct. It's not safe to inline a comprehension with cell vars at all, so in the two `nested_diff_scopes` tests we should not be inlining the comprehension with the lambda at all. I will make this change as a separate bugfix in 3.8 and port it separately to 3.10. Reviewed By: tekknolagi Differential Revision: D40656285 fbshipit-source-id: 405d3fe
- Loading branch information
1 parent
1d0bd34
commit ba2d0ac
Showing
14 changed files
with
3,111 additions
and
2,788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.