summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorPeter Lazorchak <lazorchakp@gmail.com>2024-04-03 17:14:18 (GMT)
committerGitHub <noreply@github.com>2024-04-03 17:14:18 (GMT)
commit1c434688866db79082def4f9ef572b85d85908c8 (patch)
treec253bfd0b3a7db1fda7e98c0ee2321ef100ceb2e /Python/executor_cases.c.h
parent976bcb2379709da57073a9e07b518ff51daa617a (diff)
downloadcpython-1c434688866db79082def4f9ef572b85d85908c8.zip
cpython-1c434688866db79082def4f9ef572b85d85908c8.tar.gz
cpython-1c434688866db79082def4f9ef572b85d85908c8.tar.bz2
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.
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 82f2171..9847679 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -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