public static ToAryInstr decode(IRReaderDecoder d) { return new ToAryInstr(d.decodeVariable(), d.decodeOperand()); }
public static ToAryInstr decode(IRReaderDecoder d) { return new ToAryInstr(d.decodeVariable(), d.decodeOperand()); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new ToAryInstr((Variable) result.cloneForInlining(ii), array.cloneForInlining(ii), (BooleanLiteral) dontToAryArrays.cloneForInlining(ii)); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new ToAryInstr((Variable) result.cloneForInlining(ii), array.cloneForInlining(ii), (BooleanLiteral) dontToAryArrays.cloneForInlining(ii)); }
@Override public Instr clone(CloneInfo ii) { return new ToAryInstr((Variable) result.cloneForInlining(ii), getArray().cloneForInlining(ii)); }
@Override public Instr clone(CloneInfo ii) { return new ToAryInstr((Variable) result.cloneForInlining(ii), getArray().cloneForInlining(ii)); }
public Operand buildToAry(ToAryNode node, IRScope s) { Operand array = build(node.getValue(), s); Variable result = s.getNewTemporaryVariable(); s.addInstr(new ToAryInstr(result, array, manager.getFalse())); return result; }
public Operand buildToAry(ToAryNode node, IRScope s) { Operand array = build(node.getValue(), s); Variable result = s.getNewTemporaryVariable(); s.addInstr(new ToAryInstr(result, array, manager.getFalse())); return result; }
@Override public void buildVersionSpecificAssignment(Node node, IRScope s, Variable v) { switch (node.getNodeType()) { case MULTIPLEASGN19NODE: { s.addInstr(new ToAryInstr(v, v, manager.getFalse())); buildMultipleAsgn19Assignment((MultipleAsgn19Node)node, s, null, v); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
@Override public void buildVersionSpecificAssignment(Node node, IRScope s, Variable v) { switch (node.getNodeType()) { case MULTIPLEASGN19NODE: { s.addInstr(new ToAryInstr(v, v, manager.getFalse())); buildMultipleAsgn19Assignment((MultipleAsgn19Node)node, s, null, v); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public Operand buildMultipleAsgn19(MultipleAsgn19Node multipleAsgnNode, IRScope s) { Operand values = build(multipleAsgnNode.getValueNode(), s); Variable ret = getValueInTemporaryVariable(s, values); s.addInstr(new ToAryInstr(ret, ret, manager.getFalse())); buildMultipleAsgn19Assignment(multipleAsgnNode, s, null, ret); return ret; }
public Operand buildMultipleAsgn19(MultipleAsgn19Node multipleAsgnNode, IRScope s) { Operand values = build(multipleAsgnNode.getValueNode(), s); Variable ret = getValueInTemporaryVariable(s, values); s.addInstr(new ToAryInstr(ret, ret, manager.getFalse())); buildMultipleAsgn19Assignment(multipleAsgnNode, s, null, ret); return ret; }
public Operand buildMultipleAsgn19(MultipleAsgnNode multipleAsgnNode) { Node valueNode = multipleAsgnNode.getValueNode(); Operand values = build(valueNode); Variable ret = getValueInTemporaryVariable(values); if (valueNode instanceof ArrayNode) { buildMultipleAsgn19Assignment(multipleAsgnNode, null, ret); } else { Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, ret)); buildMultipleAsgn19Assignment(multipleAsgnNode, null, tmp); } return ret; }
public Operand buildMultipleAsgn19(MultipleAsgnNode multipleAsgnNode) { Node valueNode = multipleAsgnNode.getValueNode(); Operand values = build(valueNode); Variable ret = getValueInTemporaryVariable(values); if (valueNode instanceof ArrayNode) { buildMultipleAsgn19Assignment(multipleAsgnNode, null, ret); } else { Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, ret)); buildMultipleAsgn19Assignment(multipleAsgnNode, null, tmp); } return ret; }
public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, int blockArityValue) { Operand yieldInstrArg = yi.getYieldArg(); if ((yieldInstrArg == UndefinedValue.UNDEFINED) || blockArityValue == 0) { yieldArg = new Array(); // Zero-elt array } else if (yieldInstrArg instanceof Array) { yieldArg = yieldInstrArg; // 1:1 arg match if (((Array) yieldInstrArg).size() == blockArityValue) canMapArgsStatically = true; } else if (blockArityValue == 1 && yi.unwrapArray == false) { yieldArg = yieldInstrArg; canMapArgsStatically = true; } else { // SSS FIXME: The code below is not entirely correct. We have to process 'yi.getYieldArg()' similar // to how InterpretedIRBlockBody (1.8 and 1.9 modes) processes it. We may need a special instruction // that takes care of aligning the stars and bringing good fortune to arg yielder and arg receiver. IRScope callerScope = getHostScope(); Variable yieldArgArray = callerScope.createTemporaryVariable(); yieldBB.addInstr(new ToAryInstr(yieldArgArray, yieldInstrArg)); yieldArg = yieldArgArray; } yieldResult = yi.getResult(); }
public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, int blockArityValue) { Operand yieldInstrArg = yi.getYieldArg(); if ((yieldInstrArg == UndefinedValue.UNDEFINED) || blockArityValue == 0) { yieldArg = new Array(); // Zero-elt array } else if (yieldInstrArg instanceof Array) { yieldArg = yieldInstrArg; // 1:1 arg match if (((Array) yieldInstrArg).size() == blockArityValue) canMapArgsStatically = true; } else if (blockArityValue == 1 && yi.unwrapArray == false) { yieldArg = yieldInstrArg; canMapArgsStatically = true; } else { // SSS FIXME: The code below is not entirely correct. We have to process 'yi.getYieldArg()' similar // to how InterpretedIRBlockBody (1.8 and 1.9 modes) processes it. We may need a special instruction // that takes care of aligning the stars and bringing good fortune to arg yielder and arg receiver. IRScope callerScope = getHostScope(); Variable yieldArgArray = callerScope.createTemporaryVariable(); yieldBB.addInstr(new ToAryInstr(yieldArgArray, yieldInstrArg)); yieldArg = yieldArgArray; } yieldResult = yi.getResult(); }
public void buildVersionSpecificAssignment(Node node, IRScope s, Variable v) { switch (node.getNodeType()) { case MULTIPLEASGNNODE: { Operand valuesArg; MultipleAsgnNode childNode = (MultipleAsgnNode) node; if (childNode.getHeadNode() != null && ((ListNode)childNode.getHeadNode()).childNodes().size() > 0) { // Invoke to_ary on the operand only if it is not an array already Variable result = s.getNewTemporaryVariable(); s.addInstr(new ToAryInstr(result, v, manager.getTrue())); valuesArg = result; } else { s.addInstr(new EnsureRubyArrayInstr(v, v)); valuesArg = v; } buildMultipleAsgnAssignment(childNode, s, null, valuesArg); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void receiveRequiredArg(Node node, int argIndex, Signature signature) { switch (node.getNodeType()) { case ARGUMENTNODE: { RubySymbol argName = ((ArgumentNode)node).getName(); if (scope instanceof IRMethod) addArgumentDescription(ArgumentType.req, argName); addArgReceiveInstr(argumentResult(argName), argIndex, signature); break; } case MULTIPLEASGNNODE: { MultipleAsgnNode childNode = (MultipleAsgnNode) node; Variable v = createTemporaryVariable(); addArgReceiveInstr(v, argIndex, signature); if (scope instanceof IRMethod) addArgumentDescription(ArgumentType.anonreq, null); Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, v)); buildMultipleAsgn19Assignment(childNode, tmp, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void receiveRequiredArg(Node node, IRScope s, int argIndex, boolean post, int numPreReqd, int numPostRead) { switch (node.getNodeType()) { case ARGUMENTNODE: { ArgumentNode a = (ArgumentNode)node; String argName = a.getName(); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("req", argName); addArgReceiveInstr(s, s.getNewLocalVariable(argName, 0), argIndex, post, numPreReqd, numPostRead); break; } case MULTIPLEASGN19NODE: { MultipleAsgn19Node childNode = (MultipleAsgn19Node) node; Variable v = s.getNewTemporaryVariable(); addArgReceiveInstr(s, v, argIndex, post, numPreReqd, numPostRead); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", ""); s.addInstr(new ToAryInstr(v, v, manager.getFalse())); buildMultipleAsgn19Assignment(childNode, s, v, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void receiveRequiredArg(Node node, int argIndex, Signature signature) { switch (node.getNodeType()) { case ARGUMENTNODE: { RubySymbol argName = ((ArgumentNode)node).getName(); if (scope instanceof IRMethod) addArgumentDescription(ArgumentType.req, argName); addArgReceiveInstr(argumentResult(argName), argIndex, signature); break; } case MULTIPLEASGNNODE: { MultipleAsgnNode childNode = (MultipleAsgnNode) node; Variable v = createTemporaryVariable(); addArgReceiveInstr(v, argIndex, signature); if (scope instanceof IRMethod) addArgumentDescription(ArgumentType.anonreq, null); Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, v)); buildMultipleAsgn19Assignment(childNode, tmp, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }