FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-107457: update dis documentation with changes in 3.12 by MatthieuDartiailh · Pull Request #108900 · python/cpython · GitHub

/ cpython Public

gh-107457: update dis documentation with changes in 3.12 - #108900

Merged
iritkatriel merged 9 commits into
python:mainfrom
MatthieuDartiailh:dis-docs
Oct 17, 2023
Merged

gh-107457: update dis documentation with changes in 3.12#108900
iritkatriel merged 9 commits into
python:mainfrom
MatthieuDartiailh:dis-docs

Conversation

MatthieuDartiailh commented Sep 5, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

This PR addresses the following points of #107457 which should be backported to 3.12

  • document MIN_INSTRUMENTED_OPCODE which is needed to determine what are the "normal" opcodes
  • clarify the LOAD_SUPER_ATTR stack manipulation description
  • fix the description of CALL_INSTRINSIC_2 stack manipulation
  • document END_SEND
  • explain how the presence of CACHE instructions impact the computation of jump instruction argument

I did not address the following points:

  • the description of COMPARE_OP which was corrected in 3.13. However 3.13 does not detail the meaning of the cache: should it be detailed
  • POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE were not described as actual instructions but this appear to have been fixed at least in 3.13 if it is not in 3.12 it should be backported

I plan to address the What's new issues in a follow up PR


📚 Documentation preview 📚: https://cpython-previews--108900.org.readthedocs.build/

carljm previously requested changes Sep 25, 2023

carljm 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

The LOAD_SUPER_ATTR changes look OK to me, modulo suggested edits.

Comment thread Doc/library/dis.rst Outdated
Comment thread Doc/library/dis.rst Outdated
Comment thread Doc/library/dis.rst Outdated
Comment thread Doc/library/dis.rst Outdated
Co-authored-by: Carl Meyer <carl@oddbird.net>

carljm 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

The LOAD_SUPER_ATTR changes look good to me now. The other changes look reasonable, but I'd rather get @markshannon or @iritkatriel to confirm the accuracy of the new paragraph on 3.12 jump changes.

carljm dismissed their stale review September 25, 2023 17:52

requested changes were made

Comment thread Doc/library/dis.rst Outdated
Comment thread Doc/library/dis.rst Outdated
adaptive bytecode can be shown by passing ``adaptive=True``.

.. versionchanged:: 3.12
For instruction leading to a jump, a jump by 0 instruction should always

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

What is an "instruction leading to a jump"?

Copy link
Copy Markdown
Contributor Author

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

I agree it is a bit convoluted. I am happy to use a different phrasing. Initially I went for this because of opcode like FOR_ITER that do not jump often.

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

I don't understand what you mean, so I can't offer how to reword it.

Copy link
Copy Markdown
Contributor Author

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

Would the following re-wording read better ?

When the offset of a jump instruction is 0, the jump should always lead to the instruction directly following the jump instruction. Starting with 3.12, some jump instructions can be followed by a :opcode:CACHE instruction. When the argument of such an instruction is 0, it will jump to the first non-CACHE instruction following the jump instruction.

As a consequence, the presence of the :opcode:CACHE instructions is transparent for forward jumps but need to be taken into account when reasoning about backward jumps.

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

I think I see what you mean now.

Can we just say that "the arg of a jump is the offset from the instruction that appears immediately after the JUMP instruction's CACHE entries" ?

Copy link
Copy Markdown
Contributor Author

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

Can we agree on the following ? I would prefer to insist on the forward backward asymmetry

The argument of a jump is the offset of the target relative to the instruction that appears immediately after the jump instruction's CACHE entries.

As a consequence, the presence of the CACHE instructions is transparent for forward jumps but need to be taken into account when reasoning about backward jumps.

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

Sure. I think "need --> needs" though.

Copy link
Copy Markdown
Contributor Author

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

Sure

Comment thread Doc/library/dis.rst
Comment thread Doc/library/dis.rst Outdated

Copy link
Copy Markdown
Contributor Author

Can I do anything to help merge this work ?

Copy link
Copy Markdown
Member

Comment thread Doc/library/dis.rst Outdated
arguments and sets ``STACK[-1]`` to the result. Used to implement functionality that is
necessary but not performance critical.
Calls an intrinsic function with two arguments. Used to implement functionality
that is necessary but not performance critical::

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
Suggested change
that is necessary but not performance critical::
that is not performance critical::

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

I can see you copied this from the 1-arg opcode. But I think it's redundant in both cases.

Copy link
Copy Markdown
Contributor Author

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

I will update it

iritkatriel changed the title gh-107457: Improve dis documentation gh-107457: update dis documentation with some of the changes in 3.12 Oct 17, 2023
iritkatriel changed the title gh-107457: update dis documentation with some of the changes in 3.12 gh-107457: update dis documentation with changes in 3.12 Oct 17, 2023
iritkatriel enabled auto-merge (squash) October 17, 2023 12:50
iritkatriel merged commit 198aa67 into python:main Oct 17, 2023

Copy link
Copy Markdown

Thanks @MatthieuDartiailh for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 17, 2023
…nGH-108900)

(cherry picked from commit 198aa67)

Co-authored-by: Matthieu Dartiailh <m.dartiailh@gmail.com>

bedevere-app Bot commented Oct 17, 2023

Copy link
Copy Markdown

GH-110985 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Oct 17, 2023
MatthieuDartiailh deleted the dis-docs branch October 17, 2023 15:04
vstinner pushed a commit that referenced this pull request Oct 17, 2023
…08900) (#110985)

gh-107457: update dis documentation with changes in 3.12 (GH-108900)
(cherry picked from commit 198aa67)

Co-authored-by: Matthieu Dartiailh <m.dartiailh@gmail.com>
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

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL