> The C++ function is understood by the JIT so well that it just emits the code for it itself.
But how would that work for Ruby, where C functions on the critical performance path are often third-party code that the compiler author has never seen before?
We'd need to let the JIT understand third-party unseen C functions. There are experiments to do that (Sulong, MIR, Rubinius sort of tried it) but I think it's more of an open problem than you're implying.
If you treat calls to unknown third-party C functions as an opaque native call then you're really going to struggle to build a meaningful compilation unit, in my experience.
But how would that work for Ruby, where C functions on the critical performance path are often third-party code that the compiler author has never seen before?
We'd need to let the JIT understand third-party unseen C functions. There are experiments to do that (Sulong, MIR, Rubinius sort of tried it) but I think it's more of an open problem than you're implying.
If you treat calls to unknown third-party C functions as an opaque native call then you're really going to struggle to build a meaningful compilation unit, in my experience.