@Override public MethodHandle generate(JRubyCallSite site, RubyClass cls, DynamicMethod method, String realName) { MethodHandle handle = ((HandleMethod)method).getHandle(site.arity()); if (handle == null) { throw new IndirectBindingException("MH dynamic method does not have needed arity"); } if (RubyInstanceConfig.LOG_INDY_BINDINGS) LOG.info(site.name() + "\tbound from MHDynMethod " + logMethod(method) + ":" + handle); Signature fullSig = site.fullSignature(); MethodHandle nativeTarget = Binder .from(fullSig.type()) .permute(fullSig.to("context", "self", "arg*", "block")) .invoke(handle); nativeTarget = addOrRemoveBlock(site, nativeTarget); return nativeTarget; } }
@Override public MethodHandle generate(JRubyCallSite site, RubyClass cls, DynamicMethod method, String realName) { MethodHandle handle = ((HandleMethod)method).getHandle(site.arity()); if (handle == null) { throw new IndirectBindingException("MH dynamic method does not have needed arity"); } if (RubyInstanceConfig.LOG_INDY_BINDINGS) LOG.info(site.name() + "\tbound from MHDynMethod " + logMethod(method) + ":" + handle); Signature fullSig = site.fullSignature(); MethodHandle nativeTarget = Binder .from(fullSig.type()) .permute(fullSig.to("context", "self", "arg*", "block")) .invoke(handle); nativeTarget = addOrRemoveBlock(site, nativeTarget); return nativeTarget; } }
mh = handleMethod.getHandle(site.arity); if (mh != null) { if (!blockGiven) mh = insertArguments(mh, mh.type().parameterCount() - 1, Block.NULL_BLOCK); mh = dropArguments(mh, 1, IRubyObject.class); } else { mh = handleMethod.getHandle(-1); mh = dropArguments(mh, 1, IRubyObject.class); if (site.arity == 0) { mh = handleMethod.getHandle(-1); if (mh != null) { mh = dropArguments(mh, 1, IRubyObject.class);
mh = handleMethod.getHandle(site.arity); if (mh != null) { if (!blockGiven) mh = insertArguments(mh, mh.type().parameterCount() - 1, Block.NULL_BLOCK); mh = dropArguments(mh, 1, IRubyObject.class); } else { mh = handleMethod.getHandle(-1); mh = dropArguments(mh, 1, IRubyObject.class); if (site.arity == 0) { mh = handleMethod.getHandle(-1); if (mh != null) { mh = dropArguments(mh, 1, IRubyObject.class);