Title: GH-98831: Support cache effects in super- and macro instructions by gvanrossum · Pull Request #99601 · python/cpython · GitHub
Open Graph Title: GH-98831: Support cache effects in super- and macro instructions by gvanrossum · Pull Request #99601 · python/cpython
X Title: GH-98831: Support cache effects in super- and macro instructions by gvanrossum · Pull Request #99601 · python/cpython
Description: Note: this doesn't yet support cache effects in the macro definition itself (e.g. macro(X) = counter/1 + FOO + BAR + unused/2). That seems something for a follow-up (we don't even have a use case for the current thing yet). Details (From two original commits that were since merged.) Super-instructions can now have cache effects. To do this I mostly just had to move the cache effects code into Instr*.write_body(), reducing the responsibilities of Instr*.write(). (I also had to fiddle a bit with indents.) For macros the same approach would almost work, except that next_instr might point in the middle of the cache when we encounter DEOPT_IF() or ERROR_IF() in a second or further component. I have to think more about that. NOTES: There is no test example yet (I manually tested it with a fake new super-instruction). The cache-related generated code is in different place. This shouldn't matter. Macro instructions can now also have cache effects. We pass the initial cache offset into write_body(). This is a little fiddly because everything is different for super-instructions vs macros: For super, cache_adjust is always zero because we bump next_instr after each op. For macro, cache_adjust accumulates previous cache offsets, and we bump next_instr at the end. Also, I had to move the bump of next_instr back into Instr*.write(). It is better placed there anyway because that function avoids the bump if the C code already ends in a goto, return or DISPATCH*() call. (The previous commit emitted one unreachable bump, which is now fixed.) Tested manually. NOTES There's more refactoring coming. Also included: Fix dedent of comments in to_text() Flatten InstDef Improve CLI help output Other refactoring (quite a bit, sorry) Issue: gh-98831
Open Graph Description: Note: this doesn't yet support cache effects in the macro definition itself (e.g. macro(X) = counter/1 + FOO + BAR + unused/2). That seems something for a follow-up (we don't even have a us...
X Description: Note: this doesn't yet support cache effects in the macro definition itself (e.g. macro(X) = counter/1 + FOO + BAR + unused/2). That seems something for a follow-up (we don't even h...
Opengraph URL: https://github.com/python/cpython/pull/99601
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:829166bc-5823-a783-5cac-f8c77f247017 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | C232:BB9B6:B22847:F0682A:6969E6BE |
| html-safe-nonce | 0935f582a59bd8ba4c2ec062d2d8dca91123f05b669a06276cd7a738ff406ac8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjMyOkJCOUI2OkIyMjg0NzpGMDY4MkE6Njk2OUU2QkUiLCJ2aXNpdG9yX2lkIjoiNDQ0NTg3NTQyMzI5OTYyNjY4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8e1219745ec70db0f91f64252166b2a60d8482393f3e77d335286fa1da52e741 |
| hovercard-subject-tag | pull_request:1128907643 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/99601/checks |
| twitter:image | https://avatars.githubusercontent.com/u/2894642?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/2894642?s=400&v=4 |
| og:image:alt | Note: this doesn't yet support cache effects in the macro definition itself (e.g. macro(X) = counter/1 + FOO + BAR + unused/2). That seems something for a follow-up (we don't even have a us... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width