@Override public Instr clone(CloneInfo ii) { return new CheckArgsArrayArityInstr(getArgsArray().cloneForInlining(ii), required, opt, rest); }
public Operand getArgsArray() { return getOperand1(); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { RubyArray args = (RubyArray) getArgsArray().retrieve(context, self, currScope, currDynScope, temp); Helpers.irCheckArgsArrayArity(context, args, required, opt, rest); return null; }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new CheckArgsArrayArityInstr(argsArray.cloneForInlining(ii), required, opt, rest); }
case CALL_0O: case CALL: return CallInstr.decode(this); case CHECK_ARGS_ARRAY_ARITY: return CheckArgsArrayArityInstr.decode(this); case CHECK_ARITY: return CheckArityInstr.decode(this); case CHECK_FOR_LJE: return CheckForLJEInstr.decode(this);
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { RubyArray args = (RubyArray) getArgsArray().retrieve(context, self, currScope, currDynScope, temp); Helpers.irCheckArgsArrayArity(context, args, required, opt, rest); return null; }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new CheckArgsArrayArityInstr(argsArray.cloneForInlining(ii), required, opt, rest); }
case CALL_0O: case CALL: return CallInstr.decode(this); case CHECK_ARGS_ARRAY_ARITY: return CheckArgsArrayArityInstr.decode(this); case CHECK_ARITY: return CheckArityInstr.decode(this); case CHECK_FOR_LJE: return CheckForLJEInstr.decode(this);
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getArgsArray()); e.encode(required); e.encode(opt); e.encode(rest); }
@Override public Instr clone(CloneInfo ii) { return new CheckArgsArrayArityInstr(getArgsArray().cloneForInlining(ii), required, opt, rest); }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { // Since we know arity at a callsite, arity check passes or we have an ArgumentError int numArgs = ii.getArgsCount(); if ((numArgs < required) || ((rest == -1) && (numArgs > (required + opt)))) { return new RaiseArgumentErrorInstr(required, opt, rest, rest); } return null; } else { return new CheckArgsArrayArityInstr(ii.getArgs(), required, opt, rest); } }
public Operand getArgsArray() { return getOperand1(); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getArgsArray()); e.encode(required); e.encode(opt); e.encode(rest); }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { // Since we know arity at a callsite, arity check passes or we have an ArgumentError int numArgs = ii.getArgsCount(); if ((numArgs < required) || ((rest == -1) && (numArgs > (required + opt)))) { return new RaiseArgumentErrorInstr(required, opt, rest, rest); } return null; } else { return new CheckArgsArrayArityInstr(ii.getArgs(), required, opt, rest); } }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvmMethod().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvmAdapter().pushInt(checkargsarrayarityinstr.required); jvmAdapter().pushInt(checkargsarrayarityinstr.opt); jvmAdapter().pushBoolean(checkargsarrayarityinstr.rest); jvmMethod().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, boolean)")); }
public static CheckArgsArrayArityInstr decode(IRReaderDecoder d) { return new CheckArgsArrayArityInstr(d.decodeOperand(), d.decodeInt(), d.decodeInt(), d.decodeBoolean()); }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvmMethod().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvmAdapter().pushInt(checkargsarrayarityinstr.required); jvmAdapter().pushInt(checkargsarrayarityinstr.opt); jvmAdapter().pushBoolean(checkargsarrayarityinstr.rest); jvmMethod().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, boolean)")); }
public static CheckArgsArrayArityInstr decode(IRReaderDecoder d) { return new CheckArgsArrayArityInstr(d.decodeOperand(), d.decodeInt(), d.decodeInt(), d.decodeBoolean()); }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvm.method().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvm.method().adapter.pushInt(checkargsarrayarityinstr.required); jvm.method().adapter.pushInt(checkargsarrayarityinstr.opt); jvm.method().adapter.pushInt(checkargsarrayarityinstr.rest); jvm.method().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, int)")); }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) return new CheckArityInstr(required, opt, rest, receivesKeywords, restKey); InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.canMapArgsStatically()) { // we can error on bad arity or remove check_arity int numArgs = ii.getArgsCount(); if (numArgs < required || (!rest && numArgs > (required + opt))) { return new RaiseArgumentErrorInstr(required, opt, rest, numArgs); } return null; } return new CheckArgsArrayArityInstr(ii.getArgs(), required, opt, rest); }