-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Harden CALL specialization guards and cache callables #7360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3347161
vm: align CALL/CALL_KW specialization core guards with CPython
youknowone be1fe71
vm: keep specialization hot on misses and add heaptype getitem parity
youknowone 29f4284
vm: align call-alloc/getitem cache guards and call fastpath ordering
youknowone 17f1fa4
vm: align BINARY_OP, STORE_SUBSCR, UNPACK_SEQUENCE specialization guards
youknowone f6872fa
vm: finalize unicode/subscr specialization parity and regressions
youknowone e65cbc0
vm: finalize specialization GC safety, tests, and cleanup
youknowone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
vm: finalize specialization GC safety, tests, and cleanup
- Loading branch information
commit e65cbc0d58146156651440658cf5b1205ac361c3
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
32 changes: 0 additions & 32 deletions
32
extra_tests/snippets/specialization_binary_op_inplace_add_unicode.py
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
extra_tests/snippets/specialization_binary_op_subscr_str_int_ascii_cache.py
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
extra_tests/snippets/specialization_binary_op_subscr_str_int_latin1_singleton.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| ## BinaryOp inplace-add unicode: deopt falls back to __add__/__iadd__ | ||
|
|
||
| class S(str): | ||
| def __add__(self, other): | ||
| return "ADD" | ||
|
|
||
| def __iadd__(self, other): | ||
| return "IADD" | ||
|
|
||
|
|
||
| def add_path_fallback_uses_add(): | ||
| x = "a" | ||
| y = "b" | ||
| for i in range(1200): | ||
| if i == 600: | ||
| x = S("s") | ||
| y = "t" | ||
| x = x + y | ||
| return x | ||
|
|
||
|
|
||
| def iadd_path_fallback_uses_iadd(): | ||
| x = "a" | ||
| y = "b" | ||
| for i in range(1200): | ||
| if i == 600: | ||
| x = S("s") | ||
| y = "t" | ||
| x += y | ||
| return x | ||
|
|
||
|
|
||
| assert add_path_fallback_uses_add().startswith("ADD") | ||
| assert iadd_path_fallback_uses_iadd().startswith("IADD") | ||
|
|
||
|
|
||
| ## BINARY_SUBSCR_STR_INT: ASCII singleton identity | ||
|
|
||
| def check_ascii_subscr_singleton_after_warmup(): | ||
| s = "abc" | ||
| first = None | ||
| for i in range(4000): | ||
| c = s[0] | ||
| if i >= 3500: | ||
| if first is None: | ||
| first = c | ||
| else: | ||
| assert c is first | ||
|
|
||
|
|
||
| check_ascii_subscr_singleton_after_warmup() | ||
|
|
||
|
|
||
| ## BINARY_SUBSCR_STR_INT: Latin-1 singleton identity | ||
|
|
||
| def check_latin1_subscr_singleton_after_warmup(): | ||
| for s in ("abc", "éx"): | ||
| first = None | ||
| for i in range(5000): | ||
| c = s[0] | ||
| if i >= 4500: | ||
| if first is None: | ||
| first = c | ||
| else: | ||
| assert c is first | ||
|
|
||
|
|
||
| check_latin1_subscr_singleton_after_warmup() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.