Skip to content

Commit

Permalink
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Original file line number Diff line number Diff line change
@@ -1974,6 +1974,9 @@ public static RubyArray newArray(ThreadContext context, IRubyObject obj0, IRubyO
return RubyArray.newArray(context.runtime, obj0, obj1);
}

@JIT @Interp


private static IRRuntimeHelpersSites sites(ThreadContext context) {
return context.sites.IRRuntimeHelpers;
}
9 changes: 7 additions & 2 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -593,8 +593,11 @@ public void BFalseInstr(BFalseInstr bFalseInstr) {
// no need to unbox
visit(arg1);
jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget()));
} else if (arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) {
} 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);
@@ -906,9 +909,11 @@ public void BTrueInstr(BTrueInstr btrueinstr) {
// no need to unbox, just branch
visit(arg1);
jvmMethod().btrue(getJVMLabel(btrueinstr.getJumpTarget()));
} else if (arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) {
} 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);

0 comments on commit 11db41f

Please sign in to comment.