mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-117657: Fix small issues with instrumentation and TSAN (#118064)
Small TSAN fixups for instrumentation
This commit is contained in:
parent
1f16b4ce56
commit
4a1cf66c5c
7 changed files with 25 additions and 13 deletions
|
@ -626,9 +626,10 @@ de_instrument(PyCodeObject *code, int i, int event)
|
|||
return;
|
||||
}
|
||||
CHECK(_PyOpcode_Deopt[deinstrumented] == deinstrumented);
|
||||
*opcode_ptr = deinstrumented;
|
||||
FT_ATOMIC_STORE_UINT8_RELAXED(*opcode_ptr, deinstrumented);
|
||||
if (_PyOpcode_Caches[deinstrumented]) {
|
||||
instr[1].counter = adaptive_counter_warmup();
|
||||
FT_ATOMIC_STORE_UINT16_RELAXED(instr[1].counter.as_counter,
|
||||
adaptive_counter_warmup().as_counter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -703,8 +704,10 @@ instrument(PyCodeObject *code, int i)
|
|||
int deopt = _PyOpcode_Deopt[opcode];
|
||||
int instrumented = INSTRUMENTED_OPCODES[deopt];
|
||||
assert(instrumented);
|
||||
*opcode_ptr = instrumented;
|
||||
FT_ATOMIC_STORE_UINT8_RELAXED(*opcode_ptr, instrumented);
|
||||
if (_PyOpcode_Caches[deopt]) {
|
||||
FT_ATOMIC_STORE_UINT16_RELAXED(instr[1].counter.as_counter,
|
||||
adaptive_counter_warmup().as_counter);
|
||||
instr[1].counter = adaptive_counter_warmup();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue