← 返回首页
gh-90997: bpo-46841: Disassembly of quickened code by penguin-wwy · Pull Request #32099 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-90997: bpo-46841: Disassembly of quickened code#32099

Merged
markshannon merged 16 commits into
python:mainfrom
penguin-wwy:dis_quickened_code
Apr 19, 2022
Merged

gh-90997: bpo-46841: Disassembly of quickened code#32099
markshannon merged 16 commits into
python:mainfrom
penguin-wwy:dis_quickened_code

Conversation

penguin-wwy commented Mar 24, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

Is this ready for review?

If not, perhaps mark it as a "draft" for now.

brandtbucher self-requested a review March 24, 2022 17:12
penguin-wwy marked this pull request as draft March 24, 2022 18:03
penguin-wwy marked this pull request as ready for review March 25, 2022 14:43
Comment thread Lib/opcode.py Outdated Show resolved Hide resolved

Copy link
Copy Markdown
Member

Looks promising. Will need some tests for the new output format.

Copy link
Copy Markdown
Contributor Author

One problem is that some instructions are too long(like PRECALL_BUILTIN_FAST_WITH_KEYWORDS), do I need to increase _OPNAME_WIDTH

def adaptive_test(a, b): c = a + b print(c.__class__)

Exec dis(adaptive_test):

30 0 RESUME 0 31 2 LOAD_FAST 0 (a) 4 LOAD_FAST 1 (b) 6 BINARY_OP 0 (+) 10 STORE_FAST 2 (c) 32 12 LOAD_GLOBAL 1 (NULL + print) 24 LOAD_FAST 2 (c) 26 LOAD_ATTR 1 (__class__) 36 PRECALL 1 40 CALL 1 50 POP_TOP 52 LOAD_CONST 0 (None) 54 RETURN_VALUE

Exec dis(adaptive_test, adaptive=True):

30 0 RESUME_QUICK 0 31 2 LOAD_FAST__LOAD_FAST 0 (a) 4 LOAD_FAST 1 (b) 6 BINARY_OP_ADD_INT 0 (+) 10 STORE_FAST 2 (c) 32 12 LOAD_GLOBAL_BUILTIN 1 (NULL + print) 24 LOAD_FAST 2 (c) 26 LOAD_ATTR_SLOT 1 (__class__) 36 PRECALL_BUILTIN_FAST_WITH_KEYWORDS 1 40 CALL_ADAPTIVE 1 50 POP_TOP 52 LOAD_CONST 0 (None) 54 RETURN_VALUE

penguin-wwy commented Apr 2, 2022
edited
Loading

Copy link
Copy Markdown
Contributor Author

Looks promising. Will need some tests for the new output format.

Already add some test cases for quicken code in the dis.

penguin-wwy requested a review from markshannon April 2, 2022 07:48

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 Hide comment

Could you remove the changes to _testinternalcapi, so we don't need to export the _PyCode_Quicken function.

Comment thread Lib/test/test_dis.py Outdated Show resolved Hide resolved
penguin-wwy changed the title bpo-46841: Disassembly of quickened code gh-90997: bpo-46841: Disassembly of quickened code Apr 14, 2022

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again :) @markshannon @brandtbucher

Copy link
Copy Markdown

Thanks for making the requested changes!

: please review the changes made to this pull request.

Comment thread Lib/test/test_dis.py Outdated Show resolved Hide resolved

Copy link
Copy Markdown
Member

On small typo, otherwise looks good.

Copy link
Copy Markdown
Contributor Author

Thanks. :)
I have made the requested changes; please review again

Copy link
Copy Markdown

Thanks for making the requested changes!

: please review the changes made to this pull request.

Copy link
Copy Markdown
Member

Thanks @penguin-wwy for doing this.

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.

5 participants

Footer

© 2026 GitHub, Inc.