ZJIT currently tries to lift local variables at environment level 0 into FrameState using the NoEPEscape invariant and the from-memory reloads at strategic places. This setup has had a few bugs in the past and a few outstanding ones.1 2
We would like to know what performance looks like if all local variables went through EP to/from memory. It has the benefit of being close to interpreter semantics so easier to ensure correctness. With ZJIT: Optimize load store forwarding (ruby#16228) and ZJIT: Implement dead store elimination (ruby#16507) we may not be losing much speed by going through memory.
To give an estimate of speed impact, in YJIT, putting some local variables into registers gave about a 2% speedup (ruby#11157).
ZJIT currently tries to lift local variables at environment level 0 into
FrameStateusing theNoEPEscapeinvariant and the from-memory reloads at strategic places. This setup has had a few bugs in the past and a few outstanding ones.1 2We would like to know what performance looks like if all local variables went through EP to/from memory. It has the benefit of being close to interpreter semantics so easier to ensure correctness. With ZJIT: Optimize load store forwarding (ruby#16228) and ZJIT: Implement dead store elimination (ruby#16507) we may not be losing much speed by going through memory.
To give an estimate of speed impact, in YJIT, putting some local variables into registers gave about a 2% speedup (ruby#11157).
Footnotes
https://github.com/Shopify/ruby/issues/970 ↩
https://github.com/Shopify/ruby/issues/976 ↩