aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-12-03 00:14:40 +0900
committerGitHub <noreply@github.com>2024-12-03 00:14:40 +0900
commit7c2bd9b2266665ff4010b6c6c175bab18e08e4f8 (patch)
tree83fa851c015d5c6ebe95a873fb4134f61ee478e1 /Python/executor_cases.c.h
parent3e812253ab6b2f98fc5d17bfb82947e392b0b2a2 (diff)
downloadcpython-7c2bd9b2266665ff4010b6c6c175bab18e08e4f8.tar.gz
cpython-7c2bd9b2266665ff4010b6c6c175bab18e08e4f8.zip
gh-115999: Use light-weight lock for UNPACK_SEQUENCE_LIST (gh-127514)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index c91257b06ca..58081465760 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1728,18 +1728,12 @@
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
- #ifdef Py_GIL_DISABLED
- PyCriticalSection cs;
- _PyFrame_SetStackPointer(frame, stack_pointer);
- PyCriticalSection_Begin(&cs, seq_o);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- #endif
+ if (!LOCK_OBJECT(seq_o)) {
+ UOP_STAT_INC(uopcode, miss);
+ JUMP_TO_JUMP_TARGET();
+ }
if (PyList_GET_SIZE(seq_o) != oparg) {
- #ifdef Py_GIL_DISABLED
- _PyFrame_SetStackPointer(frame, stack_pointer);
- PyCriticalSection_End(&cs);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- #endif
+ UNLOCK_OBJECT(seq_o);
if (true) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
@@ -1750,11 +1744,7 @@
for (int i = oparg; --i >= 0; ) {
*values++ = PyStackRef_FromPyObjectNew(items[i]);
}
- #ifdef Py_GIL_DISABLED
- _PyFrame_SetStackPointer(frame, stack_pointer);
- PyCriticalSection_End(&cs);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- #endif
+ UNLOCK_OBJECT(seq_o);
PyStackRef_CLOSE(seq);
stack_pointer += -1 + oparg;
assert(WITHIN_STACK_BOUNDS());