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-90997: bpo-46841: Disassembly of quickened code by penguin-wwy · Pull Request #32099 · python/cpython

Conversation

@penguin-wwy

@penguin-wwy penguin-wwy commented Mar 24, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue46841

Sorry, something went wrong.

Uh oh!

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

Fidget-Spinner reacted with rocket emoji
All reactions
  • 🚀 1 reaction
penguin-wwy added 3 commits March 24, 2022 02:29
@penguin-wwy
Disassembly of quickened code
34e7e3c
@penguin-wwy
Reset deoptmap and fix test_dis
ceabedb
@penguin-wwy
Clean code
9cef324
@penguin-wwy
penguin-wwy requested a review from markshannon as a code owner March 24, 2022 17:05
@bedevere-bot bedevere-bot added the awaiting review label Mar 24, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 24, 2022
@brandtbucher

brandtbucher commented Mar 24, 2022

Copy link
Copy Markdown
Member

Is this ready for review?

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher
brandtbucher self-requested a review March 24, 2022 17:12
penguin-wwy added 2 commits March 25, 2022 01:18
@penguin-wwy
Fix assert for deopt code
733bdd4
@penguin-wwy
Revert co_code
bd59be2
@brandtbucher brandtbucher mentioned this pull request Mar 24, 2022
Inline caching faster-cpython/ideas#310
Closed
21 of 26 tasks
@penguin-wwy
penguin-wwy marked this pull request as draft March 24, 2022 18:03
penguin-wwy added 3 commits March 25, 2022 02:42
@penguin-wwy
Rename kwarg name and use _co_code_adaptive
f72c1fb
@penguin-wwy
Fix test__opcode
c14ab90
@penguin-wwy
Add News
026715a
@penguin-wwy
penguin-wwy marked this pull request as ready for review March 25, 2022 14:43
@penguin-wwy
Merge branch 'main' of https://github.com/python/cpython into dis_qui…
9ab5fac
…ckened_code
markshannon
markshannon reviewed Apr 1, 2022
View reviewed changes
Comment thread Lib/opcode.py Resolved

Uh oh!

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

@markshannon

markshannon commented Apr 1, 2022

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

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

penguin-wwy added 2 commits April 1, 2022 23:17
@penguin-wwy
Merge branch 'main' of https://github.com/python/cpython into dis_qui…
88ab80c
…ckened_code
@penguin-wwy
Move deoptmap to dis module
2a4bb97
@penguin-wwy

penguin-wwy commented Apr 1, 2022

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
All reactions

Sorry, something went wrong.

Uh oh!

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

@penguin-wwy
Add code quicken in test_dis
794536f
@penguin-wwy

penguin-wwy commented Apr 2, 2022 •
edited
Loading

Uh oh!

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

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.

All reactions

Sorry, something went wrong.

Uh oh!

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

@penguin-wwy
penguin-wwy requested a review from markshannon April 2, 2022 07:48
markshannon
markshannon reviewed Apr 5, 2022
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.

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

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/test/test_dis.py Resolved

Uh oh!

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

penguin-wwy added 2 commits April 6, 2022 14:11
@penguin-wwy
Get quickened in dis
e896538
@penguin-wwy
Merge branch 'main' of https://github.com/python/cpython into dis_qui…
659d570
…ckened_code
@brandtbucher brandtbucher mentioned this pull request Apr 10, 2022
Inline bytecode caches #90997
Closed
@penguin-wwy
Merge branch 'main' of https://github.com/python/cpython into dis_qui…
ca9a734
…ckened_code
@penguin-wwy penguin-wwy changed the title bpo-46841: Disassembly of quickened code gh-90997: bpo-46841: Disassembly of quickened code Apr 14, 2022
@penguin-wwy

penguin-wwy commented Apr 18, 2022

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting review label Apr 18, 2022
@bedevere-bot

bedevere-bot commented Apr 18, 2022

Copy link
Copy Markdown

Thanks for making the requested changes!

: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added the awaiting change review label Apr 18, 2022
markshannon
markshannon reviewed Apr 18, 2022
View reviewed changes
Comment thread Lib/test/test_dis.py Resolved

Uh oh!

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

@markshannon

markshannon commented Apr 18, 2022

Copy link
Copy Markdown
Member

On small typo, otherwise looks good.

All reactions

Sorry, something went wrong.

Uh oh!

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

@penguin-wwy
Fix test_dis
82b053f
@penguin-wwy
penguin-wwy force-pushed the dis_quickened_code branch from a0ed0f7 to 82b053f Compare April 18, 2022 16:41
@penguin-wwy

penguin-wwy commented Apr 19, 2022

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Apr 19, 2022

Copy link
Copy Markdown

Thanks for making the requested changes!

: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented Apr 19, 2022

Copy link
Copy Markdown
Member

Thanks @penguin-wwy for doing this.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon
markshannon merged commit e590379 into python:main Apr 19, 2022
@bedevere-bot bedevere-bot removed the awaiting change review label Apr 19, 2022
@JelleZijlstra JelleZijlstra mentioned this pull request Oct 5, 2022
dis.get_instructions() adaptive argument is not documented #97937
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon left review comments
@brandtbucher brandtbucher Awaiting requested review from brandtbucher

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.

5 participants

@penguin-wwy @brandtbucher @markshannon @bedevere-bot @the-knights-who-say-ni
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.