mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-107265: Remove all ENTER_EXECUTOR when execute _Py_Instrument (gh-108539)
This commit is contained in:
parent
19eddb515a
commit
3bfa24e29f
4 changed files with 59 additions and 32 deletions
|
@ -1479,6 +1479,23 @@ clear_executors(PyCodeObject *co)
|
|||
co->co_executors = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_PyCode_Clear_Executors(PyCodeObject *code) {
|
||||
int code_len = (int)Py_SIZE(code);
|
||||
for (int i = 0; i < code_len; i += _PyInstruction_GetLength(code, i)) {
|
||||
_Py_CODEUNIT *instr = &_PyCode_CODE(code)[i];
|
||||
uint8_t opcode = instr->op.code;
|
||||
uint8_t oparg = instr->op.arg;
|
||||
if (opcode == ENTER_EXECUTOR) {
|
||||
_PyExecutorObject *exec = code->co_executors->executors[oparg];
|
||||
assert(exec->vm_data.opcode != ENTER_EXECUTOR);
|
||||
instr->op.code = exec->vm_data.opcode;
|
||||
instr->op.arg = exec->vm_data.oparg;
|
||||
}
|
||||
}
|
||||
clear_executors(code);
|
||||
}
|
||||
|
||||
static void
|
||||
deopt_code(PyCodeObject *code, _Py_CODEUNIT *instructions)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue