GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-134584: Specialize POP_TOP by reference and type in JIT by Fidget-Spinner · Pull Request #135761 · python/cpython

Conversation

@Fidget-Spinner

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Eliminate redundant refcounting in the JIT #134584

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Fidget-Spinner
Specialize STORE_FAST by reference and type in JIT
4b415f5
@Fidget-Spinner
Fidget-Spinner requested review from markshannon and tomasr8 as code owners June 20, 2025 14:47
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 20, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jun 20, 2025
Eliminate redundant refcounting in the JIT #134584
Closed
35 tasks done
@blurb-it
📜🤖 Added by blurb_it.
0031dfe
markshannon
markshannon reviewed Jun 20, 2025
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/optimizer_bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/optimizer_bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

markshannon
markshannon reviewed Jun 20, 2025
View reviewed changes
Comment thread Python/bytecodes.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner added 3 commits June 20, 2025 23:15
@Fidget-Spinner
Address review
ca6e42c
@Fidget-Spinner
Fix bugs
4100934
@Fidget-Spinner
Merge branch 'eliminate_store_fast_refcount' of github.com:Fidget-Spi…
c4121f5
…nner/cpython into eliminate_store_fast_refcount
Fidget-Spinner
Fidget-Spinner commented Jun 20, 2025
View reviewed changes
Comment thread Python/optimizer_bytecodes.c
JitOptRef temp = retval;
// We wrap and unwrap the value to mimic PyStackRef_MakeHeapSafe
// in bytecodes.c
JitOptRef temp = PyJitRef_Wrap(PyJitRef_Unwrap(retval));

@Fidget-Spinner Fidget-Spinner Jun 20, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Fidget-Spinner
Fidget-Spinner commented Jun 22, 2025
View reviewed changes
Comment thread Python/optimizer_symbols.c
if (sym->tag == JIT_SYM_KNOWN_CLASS_TAG) {
return sym->cls.type == &PyBool_Type;
}
if (sym->tag == JIT_SYM_TRUTHINESS_TAG) {

@Fidget-Spinner Fidget-Spinner Jun 22, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@corona10 corona10 mentioned this pull request Jun 22, 2025
gh-134584: Eliminate redundant refcounting from _BINARY_OP_ADD_UNICODE #135817
Closed
@tomasr8 tomasr8 mentioned this pull request Jun 22, 2025
gh-134584: Eliminate redundant refcounting from _CALL_TYPE_1 #135818
Merged
brianschubert
brianschubert reviewed Jun 22, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Core_and_Builtins/2025-06-20-14-50-44.gh-issue-134584.3CJdAI.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner
Address review
134ad1f
markshannon
markshannon approved these changes Jun 23, 2025
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jun 23, 2025
Fidget-Spinner added 2 commits June 23, 2025 23:59
@Fidget-Spinner
Remove _SWAP_FAST for now, only specialize POP_TOP
23197eb
@Fidget-Spinner
fix naming
9443007
@Fidget-Spinner 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
remove undeterministic test
a3b82a0
@Fidget-Spinner
Fidget-Spinner merged commit 569fc68 into python:main Jun 23, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 23, 2025
@Fidget-Spinner
Fidget-Spinner deleted the eliminate_store_fast_refcount branch June 23, 2025 16:57
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
@Fidget-Spinner @AndPuQing
pythongh-134584: Specialize POP_TOP by reference and type in JIT (pyt…
a126c1a
…honGH-135761)
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@Fidget-Spinner @Pranjal095
pythongh-134584: Specialize POP_TOP by reference and type in JIT (pyt…
2065428
…honGH-135761)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@Fidget-Spinner @taegyunkim
pythongh-134584: Specialize POP_TOP by reference and type in JIT (pyt…
e635044
…honGH-135761)
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@Fidget-Spinner @Agent-Hellboy
pythongh-134584: Specialize POP_TOP by reference and type in JIT (pyt…
dae1d14
…honGH-135761)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brianschubert brianschubert brianschubert left review comments
@markshannon markshannon markshannon approved these changes
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Fidget-Spinner @markshannon @brianschubert
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.