2 ms·
I buy that third party native code is critical path. I buy that native code often calls back to Ruby. I get why you would assume that therefore you need to ma
by pizlonator 7y ago
I buy that third party native code is critical path.
I buy that native code often calls back to Ruby.
I get why you would assume that therefore you need to make it fast for third party native code to call into Ruby. But that’s not how you want to think to succeed at VM optimizations.
You can make native code fast. It’s probably already about as fast as it’s going to be. Design a VM that makes it continue to be fast. Truffle won’t give you that since it will have to DBT the native code to make it fast (and that’s the good case).
I would bet you that first party native code that calls into Ruby is by far the most common kind of yield invocation. Like Array#each/map and equivalents for Hash. You want to treat those specially for two reasons:
- their fastest path for baseline code if done the way I describe is faster than any alternative. Baseline isn’t going to have a chance to inline arbitrary functions.
- they are likely to make up a large fraction of cases where native calls back to a Ruby.
For third parties, there’s a future where someone just exposes the JITing API that JSC gives to the DOM.
- brrt 7y agoLuaJIT is an example of what happens if you do this right :-)
- jashmatthews 7y agoI’m building a tracing JIT for CRuby based on some ideas from LuaJIT, including trace stitching. One major issue is the optimization scope is limited by how root traces are formed. This is fine in Lua but a much bigger issue for Ruby.