A new CRuby internal representation (IR) dynamically specialized during execution will be presented. The major specialization includes generation of
- Hybrid stack-RTL instructions
- Type specialized instructions using basic block versioning technique
- Speculatively specialized instructions based on profile-based information
Deoptimization technique of speculatively specialized instructions when the original assumptions become wrong will be also discussed.
Using specialized IR can significantly speed up the interpretation and can permit generation of effective JIT code with static compilers like MIR or GCC. The new IR can be also used to implement Ruby specific optimizations, e.g. inlining.
Performance comparison of CRuby interpreter with the specialized IR, the current CRuby interpreter, YJIT, and MJIT will be given for some benchmarks.