Open
Description
Feature or enhancement
Proposal:
@brandtbucher pointed out that we could automatically evaluate pure ops in the JIT.
Back when I originally envisioned this in the JIT optimizer, it was way simpler. Right now we have stackrefs which complicate things a little.
The main idea is that fully pure bytecodes can just run their body in the JIT optimizer, allowing for automatic constant prop/evaluation. This also cuts down code duplication and also the amount of human error from manually writing constant propagation code.
We'd have to replace all the stackref functions with the appropriate sym accessing functions, either through macros or the cases generator.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-132732: Automatically constant evaluate pure operations #132733
- gh-132732: Treat
bytes
as constants in_Py_uop_sym_is_safe_const
#136033 - gh-132732: JIT: Only allow compact ints in pure evaluation #136040
- gh-132732: Clear errors in JIT optimizer on error #136048
- gh-132732: Fix up pure types in JIT #136050