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

@ -4094,6 +4094,12 @@ dummy_func(
frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr;
}
tier2 op(_CHECK_STACK_SPACE_OPERAND, (framesize/2 --)) {
assert(framesize <= INT_MAX);
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, framesize));
DEOPT_IF(tstate->py_recursion_remaining <= 1);
}
op(_SAVE_RETURN_OFFSET, (--)) {
#if TIER_ONE
frame->return_offset = (uint16_t)(next_instr - this_instr);