@Override public Instr cloneForBlockCloning(InlinerInfo ii) { return new BNEInstr(getArg1().cloneForInlining(ii), getArg2().cloneForInlining(ii), getJumpTarget()); }
@Override public void BNEInstr(BNEInstr bneinstr) { Operand[] args = bneinstr.getOperands(); jvm.method().loadLocal(0); visit(args[0]); visit(args[1]); jvm.method().invokeHelper("BNE", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvm.method().adapter.iftrue(getJVMLabel(bneinstr.getJumpTarget())); }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
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)); }
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); }
case BINDING_STORE: return StoreLocalVarInstr.decode(this); case BLOCK_GIVEN: return BlockGivenInstr.decode(this); case BNE: return BNEInstr.decode(this); case BREAK: return BreakInstr.decode(this); case BUILD_BACKREF: return BuildBackrefInstr.decode(this);
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currScope, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
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)); }
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); }
case BINDING_STORE: return StoreLocalVarInstr.decode(this); case BLOCK_GIVEN: return BlockGivenInstr.decode(this); case BNE: return BNEInstr.decode(this); case BREAK: return BreakInstr.decode(this); case BUILD_BACKREF: return BuildBackrefInstr.decode(this);
@Override public Instr cloneForBlockCloning(InlinerInfo ii) { return new BNEInstr(getArg1().cloneForInlining(ii), getArg2().cloneForInlining(ii), getJumpTarget()); }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currScope, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
protected int receiveOptArgs(final ArgsNode argsNode, IRScope s, int opt, int argIndex) { ListNode optArgs = argsNode.getOptArgs(); for (int j = 0; j < opt; j++, argIndex++) { // Jump to 'l' if this arg is not null. If null, fall through and build the default value! Label l = s.getNewLabel(); LocalAsgnNode n = (LocalAsgnNode)optArgs.get(j); String argName = n.getName(); Variable av = s.getLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); s.addInstr(new ReceiveOptArgInstr(av, argIndex-j, argIndex-j, j)); s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n, s); s.addInstr(new LabelInstr(l)); } return 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); }
@Override public void BNEInstr(BNEInstr bneinstr) { Operand[] args = bneinstr.getOperands(); jvm.method().loadLocal(0); visit(args[0]); visit(args[1]); jvm.method().invokeHelper("BNE", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvm.method().adapter.iftrue(getJVMLabel(bneinstr.getJumpTarget())); }
@Override public Instr clone(CloneInfo ii) { return new BNEInstr(ii.getRenamedLabel(getJumpTarget()), getArg1().cloneForInlining(ii), getArg2().cloneForInlining(ii)); }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
protected int receiveOptArgs(final ArgsNode argsNode, IRScope s, int opt, int argIndex) { ListNode optArgs = argsNode.getOptArgs(); for (int j = 0; j < opt; j++, argIndex++) { // Jump to 'l' if this arg is not null. If null, fall through and build the default value! Label l = s.getNewLabel(); LocalAsgnNode n = (LocalAsgnNode)optArgs.get(j); String argName = n.getName(); Variable av = s.getLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); s.addInstr(new ReceiveOptArgInstr(av, argIndex-j, argIndex-j, j)); s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n, s); s.addInstr(new LabelInstr(l)); } return 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); }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { return new BNEInstr(getArg1().cloneForInlining(ii), getArg2().cloneForInlining(ii), ii.getRenamedLabel(getJumpTarget())); }