Normalize jumps in compiler. All forward jumps to use JUMP_FORWARD. (GH-28755)

This commit is contained in:
Mark Shannon 2021-10-06 13:05:45 +01:00 committed by GitHub
parent c379bc5ec9
commit f6eafe18c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 14 deletions

View file

@ -4051,19 +4051,18 @@ check_eval_breaker:
TARGET(JUMP_ABSOLUTE) {
PREDICTED(JUMP_ABSOLUTE);
if (oparg < INSTR_OFFSET()) {
/* Increment the warmup counter and quicken if warm enough
* _Py_Quicken is idempotent so we don't worry about overflow */
if (!PyCodeObject_IsWarmedUp(co)) {
PyCodeObject_IncrementWarmup(co);
if (PyCodeObject_IsWarmedUp(co)) {
if (_Py_Quicken(co)) {
goto error;
}
int nexti = INSTR_OFFSET();
first_instr = co->co_firstinstr;
next_instr = first_instr + nexti;
assert(oparg < INSTR_OFFSET());
/* Increment the warmup counter and quicken if warm enough
* _Py_Quicken is idempotent so we don't worry about overflow */
if (!PyCodeObject_IsWarmedUp(co)) {
PyCodeObject_IncrementWarmup(co);
if (PyCodeObject_IsWarmedUp(co)) {
if (_Py_Quicken(co)) {
goto error;
}
int nexti = INSTR_OFFSET();
first_instr = co->co_firstinstr;
next_instr = first_instr + nexti;
}
}
JUMPTO(oparg);
@ -4072,6 +4071,7 @@ check_eval_breaker:
}
TARGET(JUMP_ABSOLUTE_QUICK) {
assert(oparg < INSTR_OFFSET());
JUMPTO(oparg);
CHECK_EVAL_BREAKER();
DISPATCH();