public DynamicMethod dup() { return new AliasMethod(implementationClass, oldMethod, name); }
@JRubyMethod public IRubyObject original_name(ThreadContext context) { if (method instanceof AliasMethod) { return context.runtime.newSymbol(((AliasMethod)method).getOldName()); } return name(context); }
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; }
@JRubyMethod public IRubyObject original_name(ThreadContext context) { if (method instanceof AliasMethod) { return context.runtime.newSymbol(((AliasMethod)method).getOldName()); } return name(context); }
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; }
public DynamicMethod dup() { return new AliasMethod(implementationClass, oldMethod, name); }
@JRubyMethod public IRubyObject original_name(ThreadContext context) { if (method instanceof AliasMethod) { return context.runtime.newSymbol(((AliasMethod) method).getOldName()); } return context.runtime.newSymbol(method.getName()); } }
public DynamicMethod dup() { return new AliasMethod(implementationClass, oldMethod, oldName); }
@JRubyMethod public IRubyObject original_name(ThreadContext context) { if (method instanceof AliasMethod) { return context.runtime.newSymbol(((AliasMethod) method).getOldName()); } return context.runtime.newSymbol(method.getName()); } }
public DynamicMethod dup() { return new AliasMethod(implementationClass, oldMethod, oldName); }
public static DynamicMethod unwrapMethod(DynamicMethod method, String[] realName) throws IndirectBindingException { // get the "real" method in a few ways while (method instanceof AliasMethod) { realName[0] = ((AliasMethod)method).getOldName(); // need to use original name, not aliased name method = method.getRealMethod(); } while (method instanceof WrapperMethod) method = method.getRealMethod(); // ProfilingDynamicMethod wraps any number of other types of methods but // we do not handle it in indy binding right now. Disable direct binding // and bind through DynamicMethod. if (method instanceof ProfilingDynamicMethod) { throw new IndirectBindingException("profiling active"); } if (method instanceof DefaultMethod) { DefaultMethod defaultMethod = (DefaultMethod) method; if (defaultMethod.getMethodForCaching() instanceof JittedMethod) { method = defaultMethod.getMethodForCaching(); } } return method; }
/** * @note Internal API - only public as its used by generated code! * @param id * @param method * @param oldName */ // NOTE: used by AnnotationBinder public void putAlias(String id, DynamicMethod method, String oldName) { if (id.equals(oldName)) return; putMethod(getRuntime(), id, new AliasMethod(this, method, oldName)); }
public static DynamicMethod unwrapMethod(DynamicMethod method, String[] realName) throws IndirectBindingException { // get the "real" method in a few ways while (method instanceof AliasMethod) { realName[0] = ((AliasMethod)method).getOldName(); // need to use original name, not aliased name method = method.getRealMethod(); } while (method instanceof WrapperMethod) method = method.getRealMethod(); // ProfilingDynamicMethod wraps any number of other types of methods but // we do not handle it in indy binding right now. Disable direct binding // and bind through DynamicMethod. if (method instanceof ProfilingDynamicMethod) { throw new IndirectBindingException("profiling active"); } if (method instanceof DefaultMethod) { DefaultMethod defaultMethod = (DefaultMethod) method; if (defaultMethod.getMethodForCaching() instanceof JittedMethod) { method = defaultMethod.getMethodForCaching(); } } return method; }
/** * @note Internal API - only public as its used by generated code! * @param id * @param method * @param oldName */ // NOTE: used by AnnotationBinder public void putAlias(String id, DynamicMethod method, String oldName) { if (id.equals(oldName)) return; putMethod(getRuntime(), id, new AliasMethod(this, method, oldName)); }
public synchronized void defineAliases(List<String> aliases, String oldName) { testFrozen("module"); DynamicMethod method = searchForAliasMethod(getRuntime(), oldName); for (String name: aliases) { if (oldName.equals(name)) continue; putMethod(name, new AliasMethod(this, method, oldName)); } invalidateCoreClasses(); invalidateCacheDescendants(); }
/** rb_alias * */ public synchronized void defineAlias(String name, String oldName) { testFrozen("module"); if (oldName.equals(name)) return; DynamicMethod method = searchForAliasMethod(getRuntime(), oldName); putMethod(name, new AliasMethod(this, method, oldName)); invalidateCoreClasses(); invalidateCacheDescendants(); }
/** rb_alias * */ public synchronized void defineAlias(String name, String oldName) { testFrozen("module"); if (oldName.equals(name)) return; DynamicMethod method = searchForAliasMethod(getRuntime(), oldName); putMethod(name, new AliasMethod(this, method, oldName)); invalidateCoreClasses(); invalidateCacheDescendants(); }
public synchronized void defineAliases(List<String> aliases, String oldName) { testFrozen("module"); DynamicMethod method = searchForAliasMethod(getRuntime(), oldName); for (String name: aliases) { if (oldName.equals(name)) continue; putMethod(name, new AliasMethod(this, method, oldName)); } invalidateCoreClasses(); invalidateCacheDescendants(); }