How Rubinius do the JIT thing
Making Ruby Fast: The Rubinius JIT
In short, it is profiling while running ruby codes,
and when a method is recognized hot, the JIT will
kick in and build LLVM IR in another native thread.
This also involves walking through callstack to do
some method inlining.
When LLVM IR is built and optimized by LLVM passes,
Rubinius will insert the result function pointer to
the CompiledMethod, then later call to this method,
the JITed one would get called. In addition, if a
method redefinition happens, this JITed method
would be discarded.
I am not sure if V8 would be better for Ruby,
after all ECMAscript is very dynamic too,
but I do think if you're willing to learn some
VM and compiler mechanism, Rubinius is worth reading.
0 retries:
Post a Comment
Note: Only a member of this blog may post a comment.