@Override public String toString() { return (hasUnusedResult() ? "[DEAD-RESULT]" : "") + result + " = " + super.toString(); }
protected IRubyObject[] prepareArguments(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope dynamicScope, Object[] temp) { return splatMap != null ? prepareArgumentsComplex(context, self, currScope, dynamicScope, temp) : prepareArgumentsSimple(context, self, currScope, dynamicScope, temp); }
/** This is the variable that is being stored into in this scope. This variable * doesn't participate in the computation itself. We just use it as a proxy for * its (a) name (b) offset (c) scope-depth. */ public LocalVariable getLocalVar() { return (LocalVariable) getOperand2(); }
protected void receiveBlockArg(IRScope s, Variable v, Operand argsArray, int argIndex, boolean isClosureArg, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) s.addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else s.addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes s.addInstr(isClosureArg ? new ReceiveClosureInstr(v) : (isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex))); } }
public static BranchInstr create(Operand v1, Operand v2, Label jmpTarget) { if (v2 instanceof BooleanLiteral) { return ((BooleanLiteral) v2).isTrue() ? new BTrueInstr(v1, jmpTarget) : new BFalseInstr(v1, jmpTarget); } if (v2 instanceof Nil) return new BNilInstr(v1, jmpTarget); if (v2 == UndefinedValue.UNDEFINED) return new BUndefInstr(v1, jmpTarget); return new BEQInstr(v1, v2, jmpTarget); }
public static BranchInstr create(Label jmpTarget, Operand v1, Operand v2) { if (v2 instanceof Boolean) { return ((Boolean) v2).isFalse() ? new BTrueInstr(jmpTarget, v1) : new BFalseInstr(jmpTarget, v1); } return new BNEInstr(jmpTarget, v1, v2); }
private void genInheritanceSearchInstrs(IRScope s, Operand startingModule, Variable constVal, Label foundLabel, boolean noPrivateConstants, String name) { s.addInstr(new InheritanceSearchConstInstr(constVal, startingModule, name, noPrivateConstants)); s.addInstr(BNEInstr.create(constVal, UndefinedValue.UNDEFINED, foundLabel)); s.addInstr(new ConstMissingInstr(constVal, startingModule, name)); s.addInstr(new LabelInstr(foundLabel)); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getHelperMethod().ordinal()); e.encode(getArgs()); }
protected void receiveBlockArg(IRScope s, Variable v, Operand argsArray, int argIndex, boolean isClosureArg, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) s.addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else s.addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes s.addInstr(isClosureArg ? new ReceiveClosureInstr(v) : (isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex))); } }
public static BranchInstr create(Operand v1, Operand v2, Label jmpTarget) { if (v2 instanceof BooleanLiteral) { return ((BooleanLiteral) v2).isTrue() ? new BTrueInstr(v1, jmpTarget) : new BFalseInstr(v1, jmpTarget); } if (v2 instanceof Nil) return new BNilInstr(v1, jmpTarget); if (v2 == UndefinedValue.UNDEFINED) return new BUndefInstr(v1, jmpTarget); return new BEQInstr(v1, v2, jmpTarget); }
public static BranchInstr create(Label jmpTarget, Operand v1, Operand v2) { if (v2 instanceof Boolean) { return ((Boolean) v2).isFalse() ? new BTrueInstr(jmpTarget, v1) : new BFalseInstr(jmpTarget, v1); } return new BNEInstr(jmpTarget, v1, v2); }
private void genInheritanceSearchInstrs(IRScope s, Operand startingModule, Variable constVal, Label foundLabel, boolean noPrivateConstants, String name) { s.addInstr(new InheritanceSearchConstInstr(constVal, startingModule, name, noPrivateConstants)); s.addInstr(BNEInstr.create(constVal, UndefinedValue.UNDEFINED, foundLabel)); s.addInstr(new ConstMissingInstr(constVal, startingModule, name)); s.addInstr(new LabelInstr(foundLabel)); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getHelperMethod().ordinal()); e.encode(getArgs()); }
@Override public String toString() { return (hasUnusedResult() ? "[DEAD-RESULT]" : "") + result + " = " + super.toString(); }
protected void receiveBlockArg(Variable v, Operand argsArray, int argIndex, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes addInstr(isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex)); } }
public static BranchInstr create(Operand v1, Operand v2, Label jmpTarget) { if (v2 instanceof BooleanLiteral) { return ((BooleanLiteral) v2).isFalse() ? new BTrueInstr(v1, jmpTarget) : new BFalseInstr(v1, jmpTarget); } return new BNEInstr(v1, v2, jmpTarget); }
protected void receiveBlockArg(Variable v, Operand argsArray, int argIndex, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes addInstr(isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex)); } }
public static BranchInstr create(Operand v1, Operand v2, Label jmpTarget) { if (v2 instanceof BooleanLiteral) { return ((BooleanLiteral) v2).isFalse() ? new BTrueInstr(v1, jmpTarget) : new BFalseInstr(v1, jmpTarget); } return new BNEInstr(v1, v2, jmpTarget); }