/** * Prepare a binder for this call site's target, forcing varargs if specified * * @param varargs whether to only call an arg-boxed variable arity path * @return the prepared binder */ public Binder prepareBinder(boolean varargs) { SmartBinder binder = SmartBinder.from(signature); if (varargs || arity > 3) { // we know we want to call varargs path always, so prepare args[] here if (arity == -1) { // do nothing, already have IRubyObject[] in args } else if (arity == 0) { binder = binder.insert(argOffset, "args", IRubyObject.NULL_ARRAY); } else { binder = binder .collect("args", "arg[0-9]+"); } } // add block if needed if (signature.lastArgType() != Block.class) { binder = binder.append("block", Block.NULL_BLOCK); } // bind to site binder = binder.insert(0, "site", this); return binder.binder(); }
/** * Prepare a binder for this call site's target, forcing varargs if specified * * @param varargs whether to only call an arg-boxed variable arity path * @return the prepared binder */ public Binder prepareBinder(boolean varargs) { SmartBinder binder = SmartBinder.from(signature); if (varargs || arity > 3) { // we know we want to call varargs path always, so prepare args[] here if (arity == -1) { // do nothing, already have IRubyObject[] in args } else if (arity == 0) { binder = binder.insert(argOffset, "args", IRubyObject.NULL_ARRAY); } else { binder = binder .collect("args", "arg[0-9]+"); } } // add block if needed if (signature.lastArgType() != Block.class) { binder = binder.append("block", Block.NULL_BLOCK); } // bind to site binder = binder.insert(0, "site", this); return binder.binder(); }
SmartHandle rewriteHandle = SmartBinder.from(lookup(), site.signature().insertArg(0, "throwable", Throwable.class)) .permute("throwable") .append("runtime", method.getImplementationClass().getRuntime()) .invokeStaticQuiet(lookup(), Helpers.class, "rewriteStackTraceAndThrow");
SmartHandle rewriteHandle = SmartBinder.from(lookup(), site.signature().insertArg(0, "throwable", Throwable.class)) .permute("throwable") .append("runtime", method.getImplementationClass().getRuntime()) .invokeStaticQuiet(lookup(), Helpers.class, "rewriteStackTraceAndThrow");
binder = binder.append("block", Block.NULL_BLOCK); } else if (!nc.hasBlock() && blockGiven) { binder = binder.drop("block");
binder = binder.append("block", Block.NULL_BLOCK); } else if (!nc.hasBlock() && blockGiven) { binder = binder.drop("block");
SmartHandle arityCheck = SmartBinder .from(ARITY_CHECK_FOLD) .append(new String[]{"min", "max"}, new Class[]{int.class, int.class}, specificArity, specificArity) .cast(ARITY_CHECK_SIGNATURE) .invokeStaticQuiet(LOOKUP, Arity.class, "checkArgumentCount");
SmartHandle arityCheck = SmartBinder .from(ARITY_CHECK_FOLD) .append(new String[]{"min", "max"}, new Class[]{int.class, int.class}, specificArity, specificArity) .cast(ARITY_CHECK_SIGNATURE) .invokeStaticQuiet(LOOKUP, Arity.class, "checkArgumentCount");