Oh, btw, ...
In HotRuby I do the same. The codegen for X + B is X.fast_plus(B,
SEL_PLUS). (SEL_PLUS is statically allocated "Selector" object which
is akin to a CallSite object) And then fast_plus is implemented as a
normal dispatch in RubyObject:
public IRubyObject fast_plus(IRubyObject arg, Selector selector) {
return this.do_select(selector).call(this, arg);
}
See:
http://github.com/krestenkrab/hotruby/blob/master/modules/vm-loaded/src/com/trifork/hotruby/objects/RubyObject.java#L153
In RubyFixnum, it knows you're in an arithmetic plus:
http://github.com/krestenkrab/hotruby/blob/master/modules/vm-loaded/src/com/trifork/hotruby/objects/RubyFixnum.java#L107
So the technique should be adaptable to JRuby as well.
Kresten
--
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en.