GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121)

This commit is contained in:
Brandt Bucher 2022-07-22 11:04:20 -07:00 committed by GitHub
parent 79d2f549ad
commit e402b26b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 200 deletions

View file

@ -5631,8 +5631,16 @@ handle_eval_breaker:
assert(oparg);
oparg <<= 8;
oparg |= _Py_OPARG(*next_instr);
// We might be tracing. To avoid breaking tracing guarantees in
// quickened instructions, always deoptimize the next opcode:
opcode = _PyOpcode_Deopt[_Py_OPCODE(*next_instr)];
PRE_DISPATCH_GOTO();
// CPython hasn't traced the following instruction historically
// (DO_TRACING would clobber our extended oparg anyways), so just
// skip our usual cframe.use_tracing check before dispatch. Also,
// make sure the next instruction isn't a RESUME, since that needs
// to trace properly (and shouldn't have an extended arg anyways):
assert(opcode != RESUME);
DISPATCH_GOTO();
}