private static MethodHandle getTarget(JRubyCallSite site, RubyClass cls, CacheEntry entry, int arity) { IndirectBindingException ibe; try { return tryDispatchDirect(site, cls, entry.method); } catch (IndirectBindingException _ibe) { ibe = _ibe; // proceed with indirect, if enabled } // if indirect indy-bound methods (via DynamicMethod.call) are disabled, bail out if (!RubyInstanceConfig.INVOKEDYNAMIC_INDIRECT) { if (RubyInstanceConfig.LOG_INDY_BINDINGS) LOG.info(site.name() + "\tfailed to bind to " + logMethod(entry.method) + ": " + ibe.getMessage()); return null; } // no direct native path, use DynamicMethod.call if (RubyInstanceConfig.LOG_INDY_BINDINGS) LOG.info(site.name() + "\tbound indirectly to " + logMethod(entry.method) + ": " + ibe.getMessage()); MethodHandle dynMethodTarget = getDynamicMethodTarget(site.type(), arity, entry.method); dynMethodTarget = insertArguments(dynMethodTarget, 4, site.name()); dynMethodTarget = insertArguments(dynMethodTarget, 0, entry.method); return dynMethodTarget; }
private static MethodHandle getTarget(JRubyCallSite site, RubyClass cls, CacheEntry entry, int arity) { IndirectBindingException ibe; try { return tryDispatchDirect(site, cls, entry.method); } catch (IndirectBindingException _ibe) { ibe = _ibe; // proceed with indirect, if enabled } // if indirect indy-bound methods (via DynamicMethod.call) are disabled, bail out if (!RubyInstanceConfig.INVOKEDYNAMIC_INDIRECT) { if (RubyInstanceConfig.LOG_INDY_BINDINGS) LOG.info(site.name() + "\tfailed to bind to " + logMethod(entry.method) + ": " + ibe.getMessage()); return null; } // no direct native path, use DynamicMethod.call if (RubyInstanceConfig.LOG_INDY_BINDINGS) LOG.info(site.name() + "\tbound indirectly to " + logMethod(entry.method) + ": " + ibe.getMessage()); MethodHandle dynMethodTarget = getDynamicMethodTarget(site.type(), arity, entry.method); dynMethodTarget = insertArguments(dynMethodTarget, 4, site.name()); dynMethodTarget = insertArguments(dynMethodTarget, 0, entry.method); return dynMethodTarget; }