@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, method, arg); } // alternate logic to cache the result of respond_to if it's the standard one // FIXME: 1.9's respond_to_missing breaks this, so we have to bail out if (!context.runtime.is1_9() && entry.method.equals(context.runtime.getRespondToMethod())) { String name = arg.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context); respondToTuple = tuple; return tuple.respondsTo; } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, method, arg0, arg1); } // alternate logic to cache the result of respond_to if it's the standard one // FIXME: 1.9's respond_to_missing breaks this, so we have to bail out // FIXME: 1.9's respond_to_missing breaks this, so we have to bail out if (!context.runtime.is1_9() && entry.method.equals(context.runtime.getRespondToMethod())) { String name = arg0.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context); respondToTuple = tuple; return tuple.respondsTo; } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg0, arg1); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, method, arg); } // alternate logic to cache the result of respond_to if it's the standard one if (entry.method.equals(context.runtime.getRespondToMethod())) { String name = arg.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context); // only cache if it's 1.8 OR it does respond_to? OR there's no custom respond_to_missing? logic if (!context.is19 || tuple.respondsTo.isTrue() || selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) { respondToTuple = tuple; return tuple.respondsTo; } } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, selfType, method, arg0, arg1); } // alternate logic to cache the result of respond_to if it's the standard one if (entry.method.equals(context.runtime.getRespondToMethod())) { String name = arg0.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context); // only cache if it does respond_to? OR there's no custom respond_to_missing? logic if (tuple.respondsTo.isTrue() || selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) { respondToTuple = tuple; return tuple.respondsTo; } } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg0, arg1); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, selfType, method, arg0, arg1); } // alternate logic to cache the result of respond_to if it's the standard one if (entry.method.equals(context.runtime.getRespondToMethod())) { String name = arg0.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context); // only cache if it does respond_to? OR there's no custom respond_to_missing? logic if (tuple.respondsTo.isTrue() || selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) { respondToTuple = tuple; return tuple.respondsTo; } } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg0, arg1); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, method, arg0, arg1); } // alternate logic to cache the result of respond_to if it's the standard one if (entry.method.equals(context.runtime.getRespondToMethod())) { String name = arg0.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context); // only cache if it's 1.8 OR it does respond_to? OR there's no custom respond_to_missing? logic if (!context.is19 || tuple.respondsTo.isTrue() || selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) { respondToTuple = tuple; return tuple.respondsTo; } } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg0, arg1); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, selfType, method, arg); } // alternate logic to cache the result of respond_to if it's the standard one if (entry.method.isBuiltin()) { String name = arg.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context); // only cache if it does respond_to? OR there's no custom respond_to_missing? logic if (tuple.respondsTo.isTrue() || selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) { respondToTuple = tuple; return tuple.respondsTo; } } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg); }
@Override protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) { CacheEntry entry = selfType.searchWithCache(methodName); DynamicMethod method = entry.method; if (methodMissing(method, caller)) { return callMethodMissing(context, self, selfType, method, arg); } // alternate logic to cache the result of respond_to if it's the standard one if (entry.method.isBuiltin()) { String name = arg.asJavaString(); RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context); // only cache if it does respond_to? OR there's no custom respond_to_missing? logic if (tuple.respondsTo.isTrue() || selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) { respondToTuple = tuple; return tuple.respondsTo; } } // normal logic if it's not the builtin respond_to? method cache = entry; return method.call(context, self, selfType, methodName, arg); }