mirror of
https://github.com/python/cpython.git
synced 2025-10-28 09:10:36 +00:00
gh-123923: Defer refcounting for f_executable in _PyInterpreterFrame (#123924)
Use a `_PyStackRef` and defer the reference to `f_executable` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
This commit is contained in:
parent
4ed7d1d6ac
commit
b2afe2aae4
18 changed files with 177 additions and 99 deletions
|
|
@ -510,7 +510,7 @@ parse_frame_object(
|
|||
return 0;
|
||||
}
|
||||
|
||||
void* address_of_code_object;
|
||||
uintptr_t address_of_code_object;
|
||||
bytes_read = read_memory(
|
||||
pid,
|
||||
(void*)(address + offsets->interpreter_frame.executable),
|
||||
|
|
@ -520,10 +520,11 @@ parse_frame_object(
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (address_of_code_object == NULL) {
|
||||
if (address_of_code_object == 0) {
|
||||
return 0;
|
||||
}
|
||||
return parse_code_object(pid, result, offsets, address_of_code_object, previous_frame);
|
||||
address_of_code_object &= ~Py_TAG_BITS;
|
||||
return parse_code_object(pid, result, offsets, (void *)address_of_code_object, previous_frame);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue