gh-148874: add flag to CALL to skip periodic check in with#149019
gh-148874: add flag to CALL to skip periodic check in with#149019NekoAsakura wants to merge 7 commits intopython:mainfrom
CALL to skip periodic check in with#149019Conversation
markshannon
left a comment
There was a problem hiding this comment.
This looks good in general, but I've a few comments.
I'd prefer explicit oparg >> 1 and oparg & 1 so the tools can more easily understand offsets.
| Calls with keyword arguments are now handled by :opcode:`CALL_KW`. | ||
|
|
||
| .. versionchanged:: next | ||
| ``argc`` is now the oparg shifted right by one. |
There was a problem hiding this comment.
Also explain what the low bit is for.
| #define RESUME_OPARG_LOCATION_MASK 0x7 | ||
| #define RESUME_OPARG_DEPTH1_MASK 0x8 | ||
|
|
||
| #define CALL_OPARG_SKIP_PENDING_MASK 0x1 |
There was a problem hiding this comment.
Can you avoid using macros (or inline functions) for this?
This is sp that our tools can understand the offsets in calls.
The tools can (with a bit of modification) understand oparg >> 1, but CALL_ARGCOUNT will require special casing CALL_ARGCOUNT making it more complex.
(The reason this matters is that we will want to convert fixes sized arrays to scalars in the code generator in the future)
Also, comments anywhere there is masking or shifting would be clearer, IMO, than opaque macros.
| elif deop in (CALL, INSTRUMENTED_CALL): | ||
| argval = arg >> 1 | ||
| if arg & 1: | ||
| argrepr = f"{argval} + skip_pending" |
There was a problem hiding this comment.
We use the term "no interrupt" for jumps, so could you use that here for consistency?
| ERROR_IF(err != 0); | ||
| } | ||
|
|
||
| replaced op(_CHECK_PERIODIC_AT_END_PENDING, (--)) { |
There was a problem hiding this comment.
| replaced op(_CHECK_PERIODIC_AT_END_PENDING, (--)) { | |
| replaced op(_CHECK_PERIODIC_IF_INTERRUPTIBLE, (--)) { |
The meaning of _CHECK_PERIODIC_AT_END_PENDING isn't clear.
| [_FOR_ITER_VIRTUAL] = _FOR_ITER_VIRTUAL_TIER_TWO, | ||
| [_ITER_NEXT_LIST] = _ITER_NEXT_LIST_TIER_TWO, | ||
| [_CHECK_PERIODIC_AT_END] = _TIER2_RESUME_CHECK, | ||
| [_CHECK_PERIODIC_AT_END_PENDING] = _TIER2_RESUME_CHECK, |
There was a problem hiding this comment.
This should either be replaced by _NOP if oparg & 1 is 0 or _CHECK_PERIODIC_AT_END if oparg & 1 is 1 in the front-end, so I wouldn't expect it to appear here.
We do much the same with _PUSH_NULL_CONDITIONAL, converting it to _NOP or _PUSH_NULL
Documentation build overview
33 files changed ·
|
|
Thanks for the review <3 |
|
A bit of clash with #148831, having a look. |
Probably the magic number. You'll need to merge in main then increase it again. |
|
Yep was fixed in #149121 |
markshannon
left a comment
There was a problem hiding this comment.
Generally looks good.
I don't we need a new uop, changing _CHECK_PERIODIC_AT_END should be sufficient.
| ERROR_IF(err != 0); | ||
| } | ||
|
|
||
| op(_CHECK_PERIODIC_IF_INTERRUPTIBLE, (--)) { |
There was a problem hiding this comment.
I don't think you need a new uop. The if (oparg & 1) { can just be inserted in _CHECK_PERIODIC_AT_END
There was a problem hiding this comment.
Just to make sure, _CHECK_PERIODIC_AT_END is also used by CALL_FUNCTION_EX, CALL_EX_NON_PY_GENERAL, INSTRUMENTED_CALL_FUNCTION_EX, CALL_KW_NON_PY.
| */ | ||
|
|
||
| #define PYC_MAGIC_NUMBER 3665 | ||
| #define PYC_MAGIC_NUMBER 3666 |
There was a problem hiding this comment.
This might need bumping again
There was a problem hiding this comment.
I think I already bumped it. Current upstream HEAD:
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Co-authored-by: Mark Shannon <Mark.Shannon@arm.com>
with lock: can skip__exit__when a signal handler raises right after__enter__#148874📚 Documentation preview 📚: https://cpython-previews--149019.org.readthedocs.build/