@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())); } }