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-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCTION_VERSION_INLINE by Zheaoli · Pull Request #135022 · python/cpython

Conversation

@Zheaoli

@Zheaoli Zheaoli commented Jun 2, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
  • Issue: Better uop coverage in the JIT optimizer #131798

Sorry, something went wrong.

Uh oh!

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

All reactions
Zheaoli added 3 commits June 2, 2025 20:13
@Zheaoli
pythongh-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCT…
7bc5cf6
…ION_VERSION_INLINE

Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Update news
baaff8e
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Merge branch 'main' of https://github.com/python/cpython into manjusa…
4e13d21
…ka/method-version
@Zheaoli
Zheaoli requested a review from Fidget-Spinner as a code owner June 2, 2025 12:14
@bedevere-app bedevere-app Bot added the awaiting review label Jun 2, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jun 2, 2025
Better uop coverage in the JIT optimizer #131798
Open
Zheaoli added 2 commits June 2, 2025 20:15
@Zheaoli
fix code style
68f93b5
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
fix code style
cc8ecf1
Signed-off-by: Manjusaka <[email protected]>
@ZeroIntensity ZeroIntensity added the topic-JIT label Jun 2, 2025
brandtbucher
brandtbucher reviewed Jun 6, 2025
View reviewed changes

@brandtbucher brandtbucher 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 cool, thanks! A few suggestions:

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Misc/NEWS.d/next/Core_and_Builtins/2025-06-02-20-13-37.gh-issue-131798.JQRFvR.rst 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.

Comment thread Lib/test/test_capi/test_opt.py
Comment on lines +2239 to +2245
class TestObject:
def test(self, *args, **kwargs):
return args[0]

test_object = TestObject()
test_bound_method = TestObject.test.__get__(test_object)

@brandtbucher brandtbucher Jun 6, 2025

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.

Can you move this into test_method_guards_removed_or_reduced? global_identity needs to be at module scope for other reasons that don't apply here.

Also, I think it can be simplified to something like:

class TestObject:
    def test(self, arg):
        return arg

test_bound_method = TestObject().test

Sorry, something went wrong.

Uh oh!

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

All reactions

@Zheaoli Zheaoli Jun 7, 2025

Copy link
Copy Markdown
Contributor 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.

If I'm correct, TestObject().test will just generate _CHECK_FUNCTION_VERSION code, It's a normal function.

Reference the test code here

Sorry, something went wrong.

Uh oh!

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

All reactions

@Zheaoli Zheaoli Jun 7, 2025

Copy link
Copy Markdown
Contributor 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.

Can you move this into test_method_guards_removed_or_reduced? global_identity needs to be at module scope for other reasons that don't apply here.

BTW, if I push the test object into the test_method_guards_removed_or_reduced. I think the method will not be treated by a const. So we the _CHECK_FUNCTION_VERSION_INLINE is not exist in final opcode.

Sorry, something went wrong.

Uh oh!

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

All reactions

@Fidget-Spinner Fidget-Spinner Jun 15, 2025

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.

@Zheaoli is right here. Can you please move this back to global scope? It seems tests are failing as the global method is not being promoted to a constant.

Sorry, something went wrong.

Uh oh!

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

Zheaoli reacted with heart emoji
All reactions
  • ❤️ 1 reaction

@Zheaoli Zheaoli Jun 15, 2025

Copy link
Copy Markdown
Contributor 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.

Can you please move this back to global scope? It seems tests are failing as the global method is not being promoted to a constant.

Sure

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/test/test_capi/test_opt.py Resolved

Uh oh!

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

Zheaoli and others added 4 commits June 7, 2025 08:16
@Zheaoli @brandtbucher
Update Misc/NEWS.d/next/Core_and_Builtins/2025-06-02-20-13-37.gh-issu…
2841780
…e-131798.JQRFvR.rst

Co-authored-by: Brandt Bucher <[email protected]>
@Zheaoli
fix review idea
41838e9
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Merge main
cc87439
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
lint code
37bac81
Signed-off-by: Manjusaka <[email protected]>
Fidget-Spinner
Fidget-Spinner approved these changes Jun 9, 2025
View reviewed changes

@Fidget-Spinner Fidget-Spinner 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.

Sorry for forgetting to review this. This looks like a good optimization --- _CHECK_FUNCTION_VERSION_INLINE has one fewer memory indirection than _CHECK_METHOD_VERSION

Sorry, something went wrong.

Uh oh!

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

Zheaoli reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jun 9, 2025
@Zheaoli

Zheaoli commented Jun 15, 2025

Copy link
Copy Markdown
Contributor Author

@brandtbucher I update some idea about the test, PTAL when you got time.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Zheaoli
fix code
9ce01b0
Signed-off-by: Manjusaka <[email protected]>
Fidget-Spinner
Fidget-Spinner approved these changes Jun 16, 2025
View reviewed changes
@Fidget-Spinner
Fidget-Spinner merged commit 667a86e into python:main Jun 16, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 16, 2025
@Zheaoli
Zheaoli deleted the manjusaka/method-version branch June 16, 2025 05:58
lkollar pushed a commit to lkollar/cpython that referenced this pull request Jun 19, 2025
@Zheaoli @brandtbucher @lkollar
pythongh-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCT…
ac2e02c
…ION_VERSION_INLINE (pythonGH-135022)

Signed-off-by: Manjusaka <[email protected]>
Co-authored-by: Brandt Bucher <[email protected]>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@Zheaoli @brandtbucher @Pranjal095
pythongh-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCT…
25a9cf9
…ION_VERSION_INLINE (pythonGH-135022)

Signed-off-by: Manjusaka <[email protected]>
Co-authored-by: Brandt Bucher <[email protected]>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@Zheaoli @brandtbucher @taegyunkim
pythongh-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCT…
fe4021d
…ION_VERSION_INLINE (pythonGH-135022)

Signed-off-by: Manjusaka <[email protected]>
Co-authored-by: Brandt Bucher <[email protected]>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@Zheaoli @brandtbucher @Agent-Hellboy
pythongh-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCT…
f7d1e41
…ION_VERSION_INLINE (pythonGH-135022)

Signed-off-by: Manjusaka <[email protected]>
Co-authored-by: Brandt Bucher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brandtbucher brandtbucher brandtbucher left review comments
@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

topic-JIT

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.

4 participants

@Zheaoli @Fidget-Spinner @brandtbucher @ZeroIntensity
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.