public void branchIfTruthy(Label target) { adapter.invokeinterface(p(IRubyObject.class), "isTrue", sig(boolean.class)); btrue(target); }
public void branchIfTruthy(Label target) { adapter.invokeinterface(p(IRubyObject.class), "isTrue", sig(boolean.class)); btrue(target); }
@Override public void BNilInstr(BNilInstr bnilinstr) { visit(bnilinstr.getArg1()); jvm.method().isNil(); jvm.method().btrue(getJVMLabel(bnilinstr.getJumpTarget())); }
@Override public void BTrueInstr(BTrueInstr btrueinstr) { visit(btrueinstr.getArg1()); jvm.method().isTrue(); jvm.method().btrue(getJVMLabel(btrueinstr.getJumpTarget())); }
@Override public void BNilInstr(BNilInstr bnilinstr) { visit(bnilinstr.getArg1()); jvm.method().isNil(); jvm.method().btrue(getJVMLabel(bnilinstr.getJumpTarget())); }
@Override public void BTrueInstr(BTrueInstr btrueinstr) { visit(btrueinstr.getArg1()); jvm.method().isTrue(); jvm.method().btrue(getJVMLabel(btrueinstr.getJumpTarget())); }
@Override public void BTrueInstr(BTrueInstr btrueinstr) { Operand arg1 = btrueinstr.getArg1(); // this is a gross hack because we don't have distinction in boolean instrs between boxed and unboxed if (arg1 instanceof TemporaryBooleanVariable || arg1 instanceof UnboxedBoolean) { // no need to unbox, just branch visit(arg1); jvmMethod().btrue(getJVMLabel(btrueinstr.getJumpTarget())); } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isTrue()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always true, always branch jvmMethod().goTo(getJVMLabel(btrueinstr.getJumpTarget())); } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isFalse()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always false, never branch } else { // unbox and branch visit(arg1); jvmMethod().branchIfTruthy(getJVMLabel(btrueinstr.getJumpTarget())); } }
@Override public void BTrueInstr(BTrueInstr btrueinstr) { Operand arg1 = btrueinstr.getArg1(); // this is a gross hack because we don't have distinction in boolean instrs between boxed and unboxed if (arg1 instanceof TemporaryBooleanVariable || arg1 instanceof UnboxedBoolean) { // no need to unbox, just branch visit(arg1); jvmMethod().btrue(getJVMLabel(btrueinstr.getJumpTarget())); } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isTrue()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always true, always branch jvmMethod().goTo(getJVMLabel(btrueinstr.getJumpTarget())); } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isFalse()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always false, never branch } else { // unbox and branch visit(arg1); jvmMethod().branchIfTruthy(getJVMLabel(btrueinstr.getJumpTarget())); } }