private Operand putConstant(RubySymbol name, Operand value) { addInstr(new PutConstInstr(findContainerModule(), name, value)); return value; }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new PutConstInstr(operands[TARGET].cloneForInlining(ii), ref, operands[VALUE].cloneForInlining(ii)); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new PutConstInstr(operands[TARGET].cloneForInlining(ii), ref, operands[VALUE].cloneForInlining(ii)); }
private Operand putConstant(RubySymbol name, Operand value) { addInstr(new PutConstInstr(findContainerModule(), name, value)); return value; }
public static PutConstInstr decode(IRReaderDecoder d) { return new PutConstInstr(d.decodeOperand(), d.decodeSymbol(), d.decodeOperand()); }
public static PutConstInstr decode(IRReaderDecoder d) { return new PutConstInstr(d.decodeOperand(), d.decodeSymbol(), d.decodeOperand()); }
private Operand putConstant(Colon3Node node, Operand value) { addInstr(new PutConstInstr(new ObjectClass(), node.getName(), value)); return value; }
private Operand putConstant(Colon2Node node, Operand value) { addInstr(new PutConstInstr(build(node.getLeftNode()), node.getName(), value)); return value; }
private Operand putConstant(Colon3Node node, Operand value) { addInstr(new PutConstInstr(new ObjectClass(), node.getName(), value)); return value; }
private Operand putConstant(Colon2Node node, Operand value) { addInstr(new PutConstInstr(build(node.getLeftNode()), node.getName(), value)); return value; }
public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, IRScope s, Operand val) { Node constNode = constDeclNode.getConstNode(); if (constNode == null) { s.addInstr(new PutConstInstr(findContainerModule(s), constDeclNode.getName(), val)); } else if (constNode.getNodeType() == NodeType.COLON2NODE) { Operand module = build(((Colon2Node) constNode).getLeftNode(), s); s.addInstr(new PutConstInstr(module, constDeclNode.getName(), val)); } else { // colon3, assign in Object ScopeModule object = new ScopeModule(manager.getObject()); s.addInstr(new PutConstInstr(object, constDeclNode.getName(), val)); } return val; }
public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, IRScope s, Operand val) { Node constNode = constDeclNode.getConstNode(); if (constNode == null) { s.addInstr(new PutConstInstr(findContainerModule(s), constDeclNode.getName(), val)); } else if (constNode.getNodeType() == NodeType.COLON2NODE) { Operand module = build(((Colon2Node) constNode).getLeftNode(), s); s.addInstr(new PutConstInstr(module, constDeclNode.getName(), val)); } else { // colon3, assign in Object ScopeModule object = new ScopeModule(manager.getObject()); s.addInstr(new PutConstInstr(object, constDeclNode.getName(), val)); } return val; }
@Override public Instr clone(CloneInfo ii) { return new PutConstInstr(getTarget().cloneForInlining(ii), getName(), getValue().cloneForInlining(ii)); }
@Override public Instr clone(CloneInfo ii) { return new PutConstInstr(getTarget().cloneForInlining(ii), getName(), getValue().cloneForInlining(ii)); }
public Operand buildOpAsgnConstDeclNode(OpAsgnConstDeclNode node) { if (node.isOr()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, false); addInstr(BNEInstr.create(done, result, UndefinedValue.UNDEFINED)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } else if (node.isAnd()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, true); addInstr(new BFalseInstr(done, result)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } Variable result = createTemporaryVariable(); Operand lhs = build(node.getFirstNode()); Operand rhs = build(node.getSecondNode()); addInstr(CallInstr.create(scope, result, node.getSymbolOperator(), lhs, new Operand[] { rhs }, null)); return addResultInstr(new CopyInstr(createTemporaryVariable(), putConstantAssignment(node, result))); }
public Operand buildOpAsgnConstDeclNode(OpAsgnConstDeclNode node) { if (node.isOr()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, false); addInstr(BNEInstr.create(done, result, UndefinedValue.UNDEFINED)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } else if (node.isAnd()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, true); addInstr(new BFalseInstr(done, result)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } Variable result = createTemporaryVariable(); Operand lhs = build(node.getFirstNode()); Operand rhs = build(node.getSecondNode()); addInstr(CallInstr.create(scope, result, node.getSymbolOperator(), lhs, new Operand[] { rhs }, null)); return addResultInstr(new CopyInstr(createTemporaryVariable(), putConstantAssignment(node, result))); }