gh-144888: Replace bloom filter linked lists with continuous arrays to optimize executor invalidating performance (GH-145873)

This commit is contained in:
Hai Zhu
2026-03-16 23:58:18 +08:00
committed by GitHub
parent e18abc6a1f
commit 81ef1b7317
9 changed files with 102 additions and 70 deletions
+18 -1
View File
@@ -62,6 +62,23 @@ jit_error(const char *message)
static size_t _Py_jit_shim_size = 0;
static int
address_in_executor_array(_PyExecutorObject **ptrs, size_t count, uintptr_t addr)
{
for (size_t i = 0; i < count; i++) {
_PyExecutorObject *exec = ptrs[i];
if (exec->jit_code == NULL || exec->jit_size == 0) {
continue;
}
uintptr_t start = (uintptr_t)exec->jit_code;
uintptr_t end = start + exec->jit_size;
if (addr >= start && addr < end) {
return 1;
}
}
return 0;
}
static int
address_in_executor_list(_PyExecutorObject *head, uintptr_t addr)
{
@@ -94,7 +111,7 @@ _PyJIT_AddressInJitCode(PyInterpreterState *interp, uintptr_t addr)
return 1;
}
}
if (address_in_executor_list(interp->executor_list_head, addr)) {
if (address_in_executor_array(interp->executor_ptrs, interp->executor_count, addr)) {
return 1;
}
if (address_in_executor_list(interp->executor_deletion_list_head, addr)) {