MethodHandle buildAliasHandle(DynamicMethod method, IRubyObject self, RubyClass dispatchClass) throws Throwable { MethodHandle mh = null; if (method instanceof PartialDelegatingMethod) { mh = getHandle(self, dispatchClass, ((PartialDelegatingMethod) method).getDelegate()); } else if (method instanceof AliasMethod) { AliasMethod alias = (AliasMethod) method; DynamicMethod innerMethod = alias.getRealMethod(); String name = alias.getName(); // Use a second site to mimic invocation from AliasMethod InvokeSite innerSite = (InvokeSite) SelfInvokeSite.bootstrap(LOOKUP, "callFunctional:" + name, type(), literalClosure ? 1 : 0, file, line); mh = innerSite.getHandle(self, dispatchClass, innerMethod); alias.setHandle(mh); if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info(name() + "\tbound directly through alias to " + Bootstrap.logMethod(method)); } } return mh; }
MethodHandle buildAliasHandle(DynamicMethod method, IRubyObject self, RubyClass dispatchClass) throws Throwable { MethodHandle mh = null; if (method instanceof PartialDelegatingMethod) { mh = getHandle(self, dispatchClass, ((PartialDelegatingMethod) method).getDelegate()); } else if (method instanceof AliasMethod) { AliasMethod alias = (AliasMethod) method; DynamicMethod innerMethod = alias.getRealMethod(); String name = alias.getName(); // Use a second site to mimic invocation from AliasMethod InvokeSite innerSite = (InvokeSite) SelfInvokeSite.bootstrap(LOOKUP, "callFunctional:" + name, type(), literalClosure ? 1 : 0, file, line); mh = innerSite.getHandle(self, dispatchClass, innerMethod); alias.setHandle(mh); if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info(name() + "\tbound directly through alias to " + Bootstrap.logMethod(method)); } } return mh; }