Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative #32400

Merged
merged 16 commits into from
Apr 11, 2022

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Apr 7, 2022

@iritkatriel
Copy link
Member Author

This branch includes the NONE/NOT_NONE commits, so look at the last commit to see the TRUE/FALSE part.

Python/ceval.c Outdated Show resolved Hide resolved
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

I've suggested some bit hacks to tidy up the compare-and-jump specializations.

Lib/dis.py Outdated Show resolved Hide resolved
Lib/test/test_dis.py Show resolved Hide resolved
Python/ceval.c Outdated Show resolved Hide resolved
Python/ceval.c Outdated Show resolved Hide resolved
Python/ceval.c Outdated Show resolved Hide resolved
@markshannon
Copy link
Member

Looks good to me. Want to run the buildbots on it before merging?

There are more bit hacks we could do to streamline the jump computation and evalbreaker checks, but that's for another PR.
faster-cpython/ideas#352

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 4e29993 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2022
@iritkatriel iritkatriel changed the title bpo-47120: make POP_JUMP_IF_TRUE/FALSE relative bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NON/NOT_NONE relative Apr 8, 2022
@iritkatriel iritkatriel changed the title bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NON/NOT_NONE relative bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative Apr 8, 2022
@iritkatriel
Copy link
Member Author

As we predicted, this change eliminates 90% of the jumps with extended args:

Static stats

Before:

Total: 81 errors
15,128 files
333,926 code objects
5,336,282 lines
44,626,367 opcodes
2,169,508 total size of co_consts
270,630 number of co_consts
378,034 number of absolute jumps
206,404 number of relative jumps
105,676 number of absolute jumps with extended args
8,898 number of relative jumps with extended args
5,121 number of absolute jumps backwards
433 number of absolute jumps backwards with extended args
375,233 number of absolute jumps with delta < 256

After:

Total: 81 errors
15,128 files
333,926 code objects
5,336,282 lines
44,524,476 opcodes
2,169,508 total size of co_consts
270,630 number of co_consts
7,844 number of absolute jumps
576,594 number of relative jumps
1,257 number of absolute jumps with extended args
11,426 number of relative jumps with extended args
7,834 number of absolute jumps with delta < 256

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 09ba3bc 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2022
@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit ec4dcf2 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2022
@iritkatriel
Copy link
Member Author

The buildbots are happy.

@markshannon markshannon merged commit dd207a6 into python:main Apr 11, 2022
@iritkatriel iritkatriel deleted the jump_if_bool branch May 20, 2022 11:18
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.

4 participants