Skip to content

Commit bdc8d12

Browse files
committed
Make the mutex private
1 parent a18cb96 commit bdc8d12

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Python/jit_unwind.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,12 @@ struct jit_descriptor {
669669
uint32_t action_flag;
670670
struct jit_code_entry *relevant_entry;
671671
struct jit_code_entry *first_entry;
672+
PyMutex mutex;
672673
};
673674

674675
Py_EXPORTED_SYMBOL volatile struct jit_descriptor __jit_debug_descriptor = {
675676
1, JIT_NOACTION, NULL, NULL
676677
};
677-
static PyMutex gdb_jit_mutex = {0};
678678

679679
Py_EXPORTED_SYMBOL void __attribute__((noinline))
680680
__jit_debug_register_code(void)
@@ -862,7 +862,7 @@ gdb_jit_register_code(
862862
entry->symfile_size = total_size;
863863
entry->code_addr = code_addr;
864864

865-
PyMutex_Lock(&gdb_jit_mutex);
865+
PyMutex_Lock((PyMutex *)&__jit_debug_descriptor.mutex);
866866
entry->prev = NULL;
867867
entry->next = __jit_debug_descriptor.first_entry;
868868
if (entry->next != NULL) {
@@ -874,7 +874,7 @@ gdb_jit_register_code(
874874
__jit_debug_register_code();
875875
__jit_debug_descriptor.action_flag = JIT_NOACTION;
876876
__jit_debug_descriptor.relevant_entry = NULL;
877-
PyMutex_Unlock(&gdb_jit_mutex);
877+
PyMutex_Unlock((PyMutex *)&__jit_debug_descriptor.mutex);
878878
}
879879
#endif // __linux__ && __ELF__
880880

@@ -926,13 +926,13 @@ _PyJitUnwind_GdbUnregisterCode(const void *code_addr)
926926
return;
927927
}
928928

929-
PyMutex_Lock(&gdb_jit_mutex);
929+
PyMutex_Lock((PyMutex *)&__jit_debug_descriptor.mutex);
930930
struct jit_code_entry *entry = __jit_debug_descriptor.first_entry;
931931
while (entry != NULL && entry->code_addr != code_addr) {
932932
entry = entry->next;
933933
}
934934
if (entry == NULL) {
935-
PyMutex_Unlock(&gdb_jit_mutex);
935+
PyMutex_Unlock((PyMutex *)&__jit_debug_descriptor.mutex);
936936
return;
937937
}
938938

@@ -951,7 +951,7 @@ _PyJitUnwind_GdbUnregisterCode(const void *code_addr)
951951
__jit_debug_register_code();
952952
__jit_debug_descriptor.action_flag = JIT_NOACTION;
953953
__jit_debug_descriptor.relevant_entry = NULL;
954-
PyMutex_Unlock(&gdb_jit_mutex);
954+
PyMutex_Unlock((PyMutex *)&__jit_debug_descriptor.mutex);
955955

956956
PyMem_RawFree((void *)entry->symfile_addr);
957957
PyMem_RawFree(entry);

Tools/c-analyzer/cpython/_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ def format_tsv_lines(lines):
324324
_abs('Objects/stringlib/unicode_format.h'): (10_000, 400),
325325
_abs('Objects/typeobject.c'): (380_000, 13_000),
326326
_abs('Python/compile.c'): (20_000, 500),
327+
_abs('Python/jit_unwind.c'): (20_000, 300),
327328
_abs('Python/optimizer.c'): (100_000, 5_000),
328329
_abs('Python/parking_lot.c'): (40_000, 1000),
329330
_abs('Python/perf_jit_trampoline.c'): (40_000, 1000),

0 commit comments

Comments
 (0)