FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-134584: Specialize POP_TOP by reference and type in JIT by Fidget-Spinner · Pull Request #135761 · python/cpython · GitHub

Repository navigation

gh-134584: Specialize POP_TOP by reference and type in JIT - #135761

Merged
Fidget-Spinner merged 9 commits into
python:mainfrom
Fidget-Spinner:eliminate_store_fast_refcount
Jun 23, 2025
Merged

Fidget-Spinner merged 9 commits into
python:mainfrom
Fidget-Spinner:eliminate_store_fast_refcount

Conversation

Fidget-Spinner commented Jun 20, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Very nice.

You can streamline the optimization a bit using sym_is_immortal and you might want to add a test for optimizing the POP_TOP after a call that returns None.

Comment thread Python/optimizer_bytecodes.c Outdated
Comment thread Python/bytecodes.c Outdated
JitOptRef temp = retval;
// We wrap and unwrap the value to mimic PyStackRef_MakeHeapSafe
// in bytecodes.c
JitOptRef temp = PyJitRef_Wrap(PyJitRef_Unwrap(retval));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This was a bug in the previous implementation. This was only exposed in this PR.

if (sym->tag == JIT_SYM_KNOWN_CLASS_TAG) {
return sym->cls.type == &PyBool_Type;
}
if (sym->tag == JIT_SYM_TRUTHINESS_TAG) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A truthiness is not immortal. This is a false asumption.

markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good.

This should wait for TOS caching, otherwise it is adding overhead to STORE_FAST. But once that is in, this makes a nice improvement.

Fidget-Spinner changed the title gh-134584: Specialize STORE_FAST by reference and type in JIT gh-134584: Specialize POP_TOP by reference and type in JIT Jun 23, 2025
Fidget-Spinner merged commit 569fc68 into python:main Jun 23, 2025
Fidget-Spinner deleted the eliminate_store_fast_refcount branch June 23, 2025 16:57
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
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


Back | FazBrowse Home | New Git URL