Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Description
We currently remove_CHECK_VALIDITY
ops as part of a final linear pass over JIT code, with the heuristic being:
- If any op escaped since the last validity check, leave it in.
- Otherwise, remove it.
However, this is too strict. A looser, still correct heuristic would be:
- If any op escaped since the last validity check,and we have an optimization that relies on that validity before the next validity check, leave it in.
- Otherwise, remove it.
As a simple example:_POP_TOP
escapes. If we have twoPOP_TOP
instructions in a row, the JIT will check validity between them, which isn't necessary.
Since it's our optimizations that create a reliance on validity checks, the removal of validity checks and the tracking of validity should be done as part of the abstract interpretation. If could be as simple as callingrequire_validity(ctx);
whenever we perform a validity-requiring optimization. This helper would just re-insert the last seen_CHECK_VALIDITY
instruction.