gh-116168: Remove extra _CHECK_STACK_SPACE uops (#117242)

This merges all `_CHECK_STACK_SPACE` uops in a trace into a single `_CHECK_STACK_SPACE_OPERAND` uop that checks whether there is enough stack space for all calls included in the entire trace.
This commit is contained in:
Peter Lazorchak 2024-04-03 10:14:18 -07:00 committed by GitHub
parent 976bcb2379
commit 1c43468886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 493 additions and 125 deletions

View file

@ -3592,6 +3592,14 @@
break;
}
case _CHECK_STACK_SPACE_OPERAND: {
uint32_t framesize = (uint32_t)CURRENT_OPERAND();
assert(framesize <= INT_MAX);
if (!_PyThreadState_HasStackSpace(tstate, framesize)) JUMP_TO_JUMP_TARGET();
if (tstate->py_recursion_remaining <= 1) JUMP_TO_JUMP_TARGET();
break;
}
case _SAVE_RETURN_OFFSET: {
oparg = CURRENT_OPARG();
#if TIER_ONE