4 ms·
In this case, we used to abort (i.e. abort(); intentionally crash the entire process) but now we jump into the interpreter to handle the dynamic behavior. If s
by tekknolagi 9mo ago
In this case, we used to abort (i.e. abort(); intentionally crash the entire process) but now we jump into the interpreter to handle the dynamic behavior.
If someone writes dynamic ruby code to add two objects, it should succeed in both integer and string cases. The JIT just wants to optimize whatever the common case is.
- ComputerGuru 9mo agoI guess I’m confused why an actual add instruction is emitted rather than whatever overloaded operation takes place when the + symbol (or overloaded add vtable entry) is called (like it would in other OOP languages).
- tekknolagi 9mo agoIf all you're doing is summing small integers---frequently the case---it's much preferable to optimize that to be fast and then skip the very dynamic method lookup (the slower, less common case)
- zingar 9mo agoPresumably other languages with JIT do exactly the same thing?
- zingar 9mo agoI’m assuming that when you talk about crashing processes as the status quo you’re referring to earlier versions of zjit rather than current Ruby on yjit? Because I’ve never seen a Ruby process crash because + was called with different arguments.
- tekknolagi 9mo agoYes; see the first ZJIT blog post. https://railsatscale.com/2025-05-14-merge-zjit/ https://railsatscale.com/2025-05-14-merge-zjit/