(Natively compiled) Erlang might want to have a word with you.
The overhead of that context switch is a bit high but it allows the code loading facilities of the BEAM to reload HiPE compiled modules. This works because all processes yield to the scheduler, which acts as a kind of code-swap safe-point. The usual module-local vs module-remote call rules apply here when old versions are purged.
It's in active dev. ctrl+f "hipe-3.19"
> I may be wrong but it seems to fail to compile all of OTP's Erlang code now
See OTP-15596.
erlc +native
You will get beam file containing both the byte-code and native code.