Title: Remove `eval_breaker` and `kwnames` local variables from interpreter definition. · Issue #104580 · python/cpython · GitHub
Open Graph Title: Remove `eval_breaker` and `kwnames` local variables from interpreter definition. · Issue #104580 · python/cpython
X Title: Remove `eval_breaker` and `kwnames` local variables from interpreter definition. · Issue #104580 · python/cpython
Description: Currently there are quite a few local variables in PyEval_EvalDefault(). Each of these is: A candidate for register allocation, confusing the compiler. Potentially adds extra state to the interpreter Adds complexity to automatically gene...
Open Graph Description: Currently there are quite a few local variables in PyEval_EvalDefault(). Each of these is: A candidate for register allocation, confusing the compiler. Potentially adds extra state to the interpret...
X Description: Currently there are quite a few local variables in PyEval_EvalDefault(). Each of these is: A candidate for register allocation, confusing the compiler. Potentially adds extra state to the interpret...
Opengraph URL: https://github.com/python/cpython/issues/104580
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remove `eval_breaker` and `kwnames` local variables from interpreter definition.","articleBody":"Currently there are quite a few local variables in `PyEval_EvalDefault()`.\r\nEach of these is:\r\n* A candidate for register allocation, confusing the compiler.\r\n* Potentially adds extra state to the interpreter\r\n* Adds complexity to automatically generated interpreters and compilers\r\n\r\nThe local variables break down into three classes:\r\n* The state of the interpreter\r\n* Transient values\r\n* Values for gathering stats, debugging, etc.\r\n\r\nThe last category are not present in release builds, so we can ignore those.\r\nThe transient values, like `opcode` and `oparg` are an artifact of the dispatching mechanism and will be absent for compiled code, or different for a different interpreter.\r\n\r\nIt is the remaining values that matter.\r\nEach of these will consume a register in compiled code, and need to kept in sync where there is redundancy.\r\nThe current values are:\r\n* `next_instr` -- The VM instruction pointer\r\n* `frame` -- Pointer to the current frame\r\n* `stackpointer` -- Pointer to the top of stack\r\n* `tstate` -- Pointer to the current thread\r\n* `eval_break` -- Pointer to the eval-breaker\r\n* `kwnames` -- Pointer to the keyword names, if any for the next call\r\n\r\n`next_instr` and `frame` are fundamental to VM operation.\r\n\r\nHypothetically `stackpointer` can be eliminated by a compiler, and `tstate` can be eliminated by some clever stack arrangement, or using thread-local storage. However, these approaches are complex and may not be worthwhile.\r\n\r\n`eval_breaker` can easily be eliminated, as it is redundant. `eval_breaker == tstate-\u003einterp-\u003eeval_breaker`\r\n\r\n`kwnames` is logically transient, in that it is only valid between the `KW_NAMES` instruction and a `CALL`. However from the very local view of a single instruction it is effectively an interpreter-wide value.\r\nIt can removed by pushing the kwnames to the stack, but that is likely to cause a slowdown. We need to experiment.\r\n\r\n \r\n\r\n\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104581\n* gh-107383\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/markshannon","@type":"Person","name":"markshannon"},"datePublished":"2023-05-17T13:35:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/104580/cpython/issues/104580"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8d6941ae-29e8-25dd-d727-5cd72cd62390 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE32:23762:3E50E0:53A6CA:69697D71 |
| html-safe-nonce | f6d632f7b4313e32ad2edad7860d521d8507850f48182c561d07e03cf3fe2adf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTMyOjIzNzYyOjNFNTBFMDo1M0E2Q0E6Njk2OTdENzEiLCJ2aXNpdG9yX2lkIjoiOTE0MTU0MjkwMDA2NTcyOTkwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 35087709c2c5f46388464e4b5627ca012d494986590d0966dd67ee31dc9f7737 |
| hovercard-subject-tag | issue:1713938228 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/104580/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a881cac72d387fc01501181e71203bc0b368a8b36d70ec53e3a69e4d333d9c5e/python/cpython/issues/104580 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a881cac72d387fc01501181e71203bc0b368a8b36d70ec53e3a69e4d333d9c5e/python/cpython/issues/104580 |
| og:image:alt | Currently there are quite a few local variables in PyEval_EvalDefault(). Each of these is: A candidate for register allocation, confusing the compiler. Potentially adds extra state to the interpret... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markshannon |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width