Skip to content

Commit c7582bb

Browse files
asvetlovclaude
andcommitted
Mark awaited calls with CALL_AWAITED (0x80) and don't specialize them
Store the number of arguments of CALL and CALL_KW in the oparg as before and mark awaited calls with bit 0x80 instead of shifting the count. The compiler never emits these calls with that many arguments. Only the generic forms mask the bit out; awaited call sites are not specialized, so the specialized forms use the oparg as is and no longer check for an awaited call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c74970a commit c7582bb

17 files changed

Lines changed: 955 additions & 1245 deletions

‎Include/internal/pycore_opcode_metadata.h‎

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Include/internal/pycore_opcode_utils.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ extern "C" {
9494
#define RESUME_OPARG_LOCATION_MASK 0x7
9595
#define RESUME_OPARG_DEPTH1_MASK 0x8
9696

97+
/* Set in the oparg of CALL and CALL_KW when the result is awaited right away.
98+
* The compiler never emits these calls with that many arguments (see
99+
* _PY_STACK_USE_GUIDELINE), and awaited calls are never specialized, so only
100+
* the generic forms need to mask it out. */
101+
#define CALL_AWAITED 0x80
102+
97103
#define GET_ITER_YIELD_FROM 1
98104
#define GET_ITER_YIELD_FROM_NO_CHECK 2
99105
#define GET_ITER_YIELD_FROM_CORO_CHECK 3

‎Include/internal/pycore_uop_ids.h‎

Lines changed: 2 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)