| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
@Fidget-Spinner I did a PR to fix the issue. I'm not sure if my expression is correct, so could you take a look? Thanks! |
Sorry, something went wrong.
|
I think there's some misconception happening here, but no worries, I'll explain how to interpret the bytecode. To document a new bytecode, you need to go to this file https://github.com/python/cpython/blob/main/Python/bytecodes.c . Then, find the bytecode definition (for example, inst(BUILD_INTERPOLATION). Everything after the comma and to the left of the -- are the stack inputs, everything to the right are stack outputs. So for example, inst(BUILD_INTERPOLATION, (value, str, format[oparg & 1] -- interpolation)) should be documented as: ``BUILD_INTERPOLATION`` expects as stack inputs: * ``STACK[oparg & 1]`` should be ``format`` * ``STACK[-1 - (oparg & 1)]`` should be ``str`` * ``STACK[-2 - (oparg & 1)]`` should be ``value`` ``BUILD_INTERPOLATION`` outputs the interpolation object to TOS after consuming its inputs Based on this, are you able to infer the behavior of BUILD_TEMPLATE :) ? |
Sorry, something went wrong.
I have seen what you wrote. And I think I am able to express it. But I've been a little busy recently so I might need a couple of days — sorry for the delay. |
Sorry, something went wrong.
|
|
||
| Create a Template object consuming interpolations and a string from the stack, | ||
| and pushes it onto the stack. | ||
| It consumes ``STACK[-1]``(string) and ``STACK[-2]``(interpolations) and |
There was a problem hiding this comment.
Nice, this is pretty close. One small error: it's the other way around, interpolations is STACK[-1], string is STACK[-2]. This is because the bytecode definition file models a stack (LIFO), which means the rightmost element is the top of the stack.
Sorry, something went wrong.
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
| Do nothing code. Used as a hint to the interpreter that a branch was predicted | ||
| as not taken. |
There was a problem hiding this comment.
I forgot what NOT_TAKEN does, but the rest look good. Maybe @iritkatriel knows?
Sorry, something went wrong.
There was a problem hiding this comment.
It indeed does nothing. Not sure it's related to prediction though. It think it's to give tracing applications like code coverage a way to distinguish between the taken/not taken branches.
CC @markshannon
Sorry, something went wrong.
There was a problem hiding this comment.
pure inst(NOP, (--)) {
}
family(RESUME, 0) = {
RESUME_CHECK,
};
macro(NOT_TAKEN) = NOP;Can we consider its behavior to be the same as NOP?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes its a NOP but I forgot if its a hint or not.
Sorry, something went wrong.
|
Sorry, I did some meaningless commits. |
Sorry, something went wrong.
|
I'm off next week. If no one else gets to it, I'll review the new changes the 2 weeks from now. |
Sorry, something went wrong.
|
@Fidget-Spinner do you have any further comments/reviews/objections? Would be good to document the 3.14 bytecodes, either in this PR or a different one. A |
Sorry, something went wrong.
|
I'll merge this, it adds documentation for two missing bytecode instructions for 3.14. Further improvements & other bytecodes can come later. A |
Sorry, something went wrong.
|
Thanks @Yzi-Li for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
…nstructions (pythonGH-135803) (cherry picked from commit 519bc47) Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Ken Jin <kenjin4096@gmail.com>
|
GH-139399 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Document:
📚 Documentation preview 📚: https://cpython-previews--135803.org.readthedocs.build/