public Operand getArg(int index) { int n = getArgsCount(); return index < n ? (inClosureInlineMode ? ((Array)yieldArg).get(index) : callArgs[index]) : null; }
public Operand getArg(int index) { int n = getArgsCount(); return index < n ? (inClosureInlineMode ? ((Array)yieldArg).get(index) : callArgs[index]) : null; }
@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 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 Instr cloneForInlining(InlinerInfo ii) { // SSS FIXME: Need to add kwArgLoss information in InlinerInfo // Added this copy for code clarity // argIndex is relative to start of opt args and not the start of arg array int optArgIndex = this.argIndex; int minReqdArgs = optArgIndex + numUsedArgs; if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); return new CopyInstr(ii.getRenamedVariable(result), minReqdArgs < n ? ii.getArg(argOffset + optArgIndex) : UndefinedValue.UNDEFINED); } else { return new OptArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), argOffset + optArgIndex, minReqdArgs); } }
@Override public Instr cloneForInlining(InlinerInfo ii) { // SSS FIXME: Need to add kwArgLoss information in InlinerInfo // Added this copy for code clarity // argIndex is relative to start of opt args and not the start of arg array int optArgIndex = this.argIndex; int minReqdArgs = optArgIndex + numUsedArgs; if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); return new CopyInstr(ii.getRenamedVariable(result), minReqdArgs < n ? ii.getArg(argOffset + optArgIndex) : UndefinedValue.UNDEFINED); } else { return new OptArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), argOffset + optArgIndex, minReqdArgs); } }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); int remaining = n - preReqdArgsCount; Operand argVal; if (remaining <= argIndex) { // SSS: FIXME: Argh! argVal = ii.getInlineHostScope().getManager().getNil(); } else { argVal = (remaining > postReqdArgsCount) ? ii.getArg(n - postReqdArgsCount + argIndex) : ii.getArg(preReqdArgsCount + argIndex); } return new CopyInstr(ii.getRenamedVariable(result), argVal); } else { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), preReqdArgsCount, postReqdArgsCount, argIndex); } }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); int remaining = n - preReqdArgsCount; Operand argVal; if (remaining <= argIndex) { // SSS: FIXME: Argh! argVal = ii.getInlineHostScope().getManager().getNil(); } else { argVal = (remaining > postReqdArgsCount) ? ii.getArg(n - postReqdArgsCount + argIndex) : ii.getArg(preReqdArgsCount + argIndex); } return new CopyInstr(ii.getRenamedVariable(result), argVal); } else { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), preReqdArgsCount, postReqdArgsCount, argIndex); } }