Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
As written, PEP 659 says that individual specializations are restricted to a single instruction.
PEP 669 relies on this, as it also wants to replace instructions at runtime, and it would break if specialization occurs across multiple instructions.
Currently there are a two places where we break this design by specializing pairs of instructions together:
COMPARE_OP
POP_JUMP_IF_
pairs are specialized togetherFOR_ITER
STORE_FAST
are specialized together
The second will go away with the register VM, and doesn't seem to be an issue in practice.
It is theCOMPARE_OP
POP_JUMP_IF_
specialization that is problematic, as PEP 669 wants to instrument branches.
Instrumenting thePOP_JUMP_IF_
doesn't work if theCOMPARE_OP
specialization jumps over it.
The solution is to replace theCOMPARE_OP
POP_JUMP_IF_
pair with a singleCOMPARE_AND_BRANCH
instruction that can be specialized or instrumented atomically.