◐ Shell
reader mode source ↗
Skip to content

GH-105848: Simplify the arrangement of CALL's stack#107788

Merged
brandtbucher merged 6 commits into
python:mainfrom
brandtbucher:calls
Aug 9, 2023
Merged

GH-105848: Simplify the arrangement of CALL's stack#107788
brandtbucher merged 6 commits into
python:mainfrom
brandtbucher:calls

Conversation

@brandtbucher

@brandtbucher brandtbucher commented Aug 8, 2023

Copy link
Copy Markdown
Member

Instead of supporting both [callable, self, args...] and [NULL, callable, args...], change CALL's stack to be [callable, self_or_null, args...]. This always puts the desired callable at the same location on the stack, simplifying (or removing) the resulting shuffles and adjustments necessary for the shared code paths that follow.

This also changes CALL_FUNCTION_EX, DICT_MERGE, LOAD_ATTR, LOAD_GLOBAL, LOAD_SUPER_ATTR to support the new stack layout. In some cases, I've also changed the names of the stack items for consistency within a family.

As a side-effect of the new layout, LOAD_ATTR_PROPERTY and LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN (which are both implemented as inlined calls) don't support pushing an additional item to the stack for a following CALL (oparg & 1) anymore. I think this is fine, since it seems rare to call a "method" that's looked up in this manner.

@gvanrossum gvanrossum 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.

Hide comment

I think this can go in just like this.

@gvanrossum

Copy link
Copy Markdown
Member

How about some buildbot runs?

@brandtbucher brandtbucher added 🔨 test-with-buildbots Test PR w/ buildbots; report in status section 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section labels Aug 8, 2023
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit fd6607f 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit fd6607f 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section 🔨 test-with-buildbots labels Aug 8, 2023
@brandtbucher

Copy link
Copy Markdown
Member Author

Perf is neutral.

@brandtbucher brandtbucher added 🔨 test-with-buildbots Test PR w/ buildbots; report in status section 🔨 test-with-refleak-buildbots labels Aug 9, 2023
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit a5a2d8f 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit a5a2d8f 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed 🔨 test-with-buildbots Test PR w/ buildbots; report in status section 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section labels Aug 9, 2023
@markshannon

Copy link
Copy Markdown
Member

No new buildbot failures.

@markshannon 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.

Hide comment

A bunch of minor style issues, but nothing blocking.

4 hidden conversations Load more…
@brandtbucher brandtbucher enabled auto-merge (squash) August 9, 2023 17:54
@brandtbucher brandtbucher merged commit a9caf9c into python:main Aug 9, 2023
@bedevere-bot bedevere-bot removed the label Aug 9, 2023
facebook-github-bot pushed a commit to facebookincubator/cinderx that referenced this pull request Aug 22, 2025
Summary:
This reflects the changes in python/cpython#107788.

The changes to the relevant `LOAD_` instructions are mostly covered by updating `LoadMethodResult` to have a non-default constructor in 3.14+ which normalizes the content.

Reviewed By: alexmalyshev

Differential Revision: D80667929

fbshipit-source-id: 2d62f1850056792695faf8d9ceea61a0b4b31253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants