Disabling the "not taken" branch of an instrumented FOR_ITER does not de-instrument the FOR_ITER, it only de-instruments the NOT_TAKEN which prevents specialization and JIT compilation of the FOR_ITER. It is only when the loop exits, that the FOR_ITER is de-instrumented.
Instead of instrumenting the FOR_ITER we could instrument the POP_TOP at the end of the loop.
This will add an extra instruction dispatch when exiting the loop, as FOR_ITER and its specializations will need to jump to the POP_TOP instead of over it. We already do this in tier2, so the overhead should be negligible, and it might simplify the code a bit.
Linked PRs
Disabling the "not taken" branch of an instrumented
FOR_ITERdoes not de-instrument theFOR_ITER, it only de-instruments theNOT_TAKENwhich prevents specialization and JIT compilation of theFOR_ITER. It is only when the loop exits, that theFOR_ITERis de-instrumented.Instead of instrumenting the
FOR_ITERwe could instrument thePOP_TOPat the end of the loop.This will add an extra instruction dispatch when exiting the loop, as
FOR_ITERand its specializations will need to jump to thePOP_TOPinstead of over it. We already do this in tier2, so the overhead should be negligible, and it might simplify the code a bit.Linked PRs
FOR_ITER#128445