3 ms·
There are actually two problems here: How to handle things being re-defined and how to handle an unexpected type after speculation. In real high performance VM
by jashmatthews 7y ago
There are actually two problems here: How to handle things being re-defined and how to handle an unexpected type after speculation.
In real high performance VMs the guard for redefinition is effectively a single instruction which is a CPU can easily branch predict and handle with out of order execution: https://chrisseaton.com/truffleruby/low-overhead-polling/ https://chrisseaton.com/truffleruby/low-overhead-polling/
With unexpected types we can use LuaJIT as an example: The type speculation guard will be turned into a conditional branch to a side trace. The slow path quickly becomes another fast path.