@Override public void BFalseInstr(BFalseInstr bFalseInstr) { visit(bFalseInstr.getArg1()); jvm.method().isTrue(); jvm.method().bfalse(getJVMLabel(bFalseInstr.getJumpTarget())); }
@Override public void BFalseInstr(BFalseInstr bFalseInstr) { visit(bFalseInstr.getArg1()); jvm.method().isTrue(); jvm.method().bfalse(getJVMLabel(bFalseInstr.getJumpTarget())); }
@Override public void BFalseInstr(BFalseInstr bFalseInstr) { Operand arg1 = bFalseInstr.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 visit(arg1); jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget())); } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isTrue()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always true, don't branch } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isFalse()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always false, always branch jvmAdapter().go_to(getJVMLabel(bFalseInstr.getJumpTarget())); } else { // unbox visit(arg1); jvmAdapter().invokeinterface(p(IRubyObject.class), "isTrue", sig(boolean.class)); jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget())); } }
@Override public void BFalseInstr(BFalseInstr bFalseInstr) { Operand arg1 = bFalseInstr.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 visit(arg1); jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget())); } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isTrue()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always true, don't branch } else if ((arg1 instanceof Boolean && ((Boolean) arg1).isFalse()) || arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) { // always false, always branch jvmAdapter().go_to(getJVMLabel(bFalseInstr.getJumpTarget())); } else { // unbox visit(arg1); jvmAdapter().invokeinterface(p(IRubyObject.class), "isTrue", sig(boolean.class)); jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget())); } }