GH-104584: Assorted fixes for the optimizer API. (GH-105683)

* Add test for long loops

* Clear ENTER_EXECUTOR when deopting code objects.
This commit is contained in:
Mark Shannon 2023-06-19 10:32:20 +01:00 committed by GitHub
parent 4426279a43
commit 581619941e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 298 additions and 204 deletions

View file

@ -2157,6 +2157,7 @@ dummy_func(
frame = cframe.current_frame;
goto error;
}
assert(frame == cframe.current_frame);
here[1].cache &= ((1 << OPTIMIZER_BITS_IN_COUNTER) -1);
goto resume_frame;
}
@ -2176,7 +2177,7 @@ dummy_func(
inst(ENTER_EXECUTOR, (--)) {
PyCodeObject *code = _PyFrame_GetCode(frame);
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg];
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
Py_INCREF(executor);
frame = executor->execute(executor, frame, stack_pointer);
if (frame == NULL) {