GH-135379: Remove types from stack items in code generator. by markshannon · Pull Request #135384 · python/cpython · GitHub
Skip to content

GH-135379: Remove types from stack items in code generator.#135384

Merged
markshannon merged 4 commits into
python:mainfrom
faster-cpython:remove-stackitem-types
Jun 11, 2025
Merged

GH-135379: Remove types from stack items in code generator.#135384
markshannon merged 4 commits into
python:mainfrom
faster-cpython:remove-stackitem-types

Conversation

@markshannon

@markshannon markshannon commented Jun 11, 2025

Copy link
Copy Markdown
Member

This removes the types from stack items in the code generator.
E.g

op(_SEND_GEN_FRAME, (receiver, v -- receiver, gen_frame: _PyInterpreterFrame *)) {

becomes

op(_SEND_GEN_FRAME, (receiver, v -- receiver, gen_frame) {

and the cast from _PyStackRef to _PyInterpreterFrame * is made explicit in the op definition.

This is a net zero change in terms of code size, but removes fiddly code generator code and replaces it with simple casts.
This also means that any future changes to the code generator, specifically for TOS caching, do not have to worry about inserting casts.

@Fidget-Spinner

Copy link
Copy Markdown
Member

@markshannon

Copy link
Copy Markdown
Member Author

I know Cinder uses it, but it isn't part of any public API and we don't want it to be.
I guess a change note is fine, as long as it doesn't go in "what's new".

@Fidget-Spinner

Copy link
Copy Markdown
Member

Yeah I don't think it should be documented or in What's New either.

@markshannon markshannon merged commit c87b5b2 into python:main Jun 11, 2025
74 checks passed
@markshannon markshannon deleted the remove-stackitem-types branch June 11, 2025 14:52
@bedevere-bot

Copy link
Copy Markdown

lkollar pushed a commit to lkollar/cpython that referenced this pull request Jun 19, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants