4 ms·
The fast bytecode VMs do pre-fetch the operands to maximize Instruction Level Parallelism: https://www.reddit.com/r/programming/comments/badl2/luajit_2_beta_3_i
by jashmatthews 6y ago
The fast bytecode VMs do pre-fetch the operands to maximize Instruction Level Parallelism: https://www.reddit.com/r/programming/comments/badl2/luajit_2_beta_3_is_out_support_both_x32_x64/c0lrus0/ https://www.reddit.com/r/programming/comments/badl2/luajit_2...
They also use "inline caching" where the result of method lookup is cached in the bytecode itself. Most of the time there's no need to try to pre-execute it.
The ultimate version of this idea of executing everything you can before running the dynamic bit is probably Partial Evaluation which is how GraalPython works.
- fulafel 6y agoYep, Psyco was also based on partial evaluation and Futamura projections IIRC, lots of potential there. I guess the very ultimate version is a transformation that takes your program AND its inputs, and completely specializes everything to those inputs :) An advantage of the runahead idea is that with luck the change could be small and simple, and might realistically be accepted as an incremental change into the CPython codebase. Iff the runahead could be made truly guaranteed idempotent and obviously correct.