Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 52d963cd5342
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b736210d1a05
Choose a head ref
  • 2 commits
  • 13 files changed
  • 1 contributor

Commits on Dec 20, 2016

  1. Copy the full SHA
    82c006b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b736210 View commit details
Original file line number Diff line number Diff line change
@@ -32,14 +32,6 @@ public YieldingCoreMethodNode(RubyContext context, SourceSection sourceSection)
dispatchNode = new YieldNode(context);
}

private boolean booleanCast(VirtualFrame frame, Object value) {
if (booleanCastNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
booleanCastNode = insert(BooleanCastNodeGen.create(null));
}
return booleanCastNode.executeBoolean(frame, value);
}

public Object yield(VirtualFrame frame, DynamicObject block, Object... arguments) {
return dispatchNode.dispatch(frame, block, arguments);
}
@@ -49,7 +41,15 @@ public Object yieldWithBlock(VirtualFrame frame, DynamicObject block, DynamicObj
}

public boolean yieldIsTruthy(VirtualFrame frame, DynamicObject block, Object... arguments) {
return booleanCast(frame, yield(frame, block, arguments));
return booleanCast(yield(frame, block, arguments));
}

private boolean booleanCast(Object value) {
if (booleanCastNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
booleanCastNode = insert(BooleanCastNodeGen.create(null));
}
return booleanCastNode.executeToBoolean(value);
}

}
Original file line number Diff line number Diff line change
@@ -56,7 +56,6 @@
import org.jruby.truffle.core.rope.RopeNodes;
import org.jruby.truffle.core.rope.RopeNodesFactory;
import org.jruby.truffle.core.string.StringCachingGuards;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.NotProvided;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
@@ -66,13 +65,11 @@
import org.jruby.truffle.language.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.language.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.language.dispatch.MissingBehavior;
import org.jruby.truffle.language.methods.InternalMethod;
import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.IsFrozenNode;
import org.jruby.truffle.language.objects.IsFrozenNodeGen;
import org.jruby.truffle.language.objects.PropagateTaintNode;
import org.jruby.truffle.language.objects.TaintNode;
import org.jruby.truffle.language.objects.TaintNodeGen;
import org.jruby.truffle.language.yield.YieldNode;

import java.util.Arrays;
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public BooleanCastNode() {
public BooleanCastNode(BooleanCastNode node) {
}

public abstract boolean executeBoolean(VirtualFrame frame, Object value);
public abstract boolean executeToBoolean(Object value);

@Specialization(guards = "isNil(nil)")
public boolean doNil(Object nil) {
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.string.StringSupport;
import org.jruby.truffle.language.backtrace.InternalRootNode;

/**
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ public byte[] formatInfinite(int width, int precision, double dval) {
expSign = 1;
}
for (; i < strlen; ) {
expVal = expVal * 10 + ((int) str.charAt(i++) - (int) '0');
expVal = expVal * 10 + (str.charAt(i++) - '0');
}
exponent += expVal * expSign;
}
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public abstract class FormatIntegerNode extends FormatNode {

private static final byte[] PREFIX_NEGATIVE = {'.', '.'};

private static final BigInteger BIG_32 = BigInteger.valueOf(((long)Integer.MAX_VALUE + 1L) << 1);
private static final BigInteger BIG_32 = BigInteger.valueOf((Integer.MAX_VALUE + 1L) << 1);
private static final BigInteger BIG_64 = BIG_32.shiftLeft(32);
private static final BigInteger BIG_MINUS_32 = BigInteger.valueOf((long)Integer.MIN_VALUE << 1);
private static final BigInteger BIG_MINUS_64 = BIG_MINUS_32.shiftLeft(32);
@@ -401,7 +401,7 @@ private static byte[] stringToBytes(CharSequence s, boolean upper) {
byte[] bytes = new byte[len];
if (upper) {
for (int i = len; --i >= 0; ) {
int b = (byte) ((int) s.charAt(i) & 0xff);
int b = (byte) (s.charAt(i) & 0xff);
if (b >= 'a' && b <= 'z') {
bytes[i] = (byte) (b & ~0x20);
} else {
@@ -410,7 +410,7 @@ private static byte[] stringToBytes(CharSequence s, boolean upper) {
}
} else {
for (int i = len; --i >= 0; ) {
bytes[i] = (byte) ((int) s.charAt(i) & 0xff);
bytes[i] = (byte) (s.charAt(i) & 0xff);
}
}
return bytes;
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public class EncodeUM {
b64_xtable[i] = -1;
}
for (int i = 0; i < 64; i++) {
b64_xtable[(int) b64_table[i]] = i;
b64_xtable[b64_table[i]] = i;
}
}

Original file line number Diff line number Diff line change
@@ -351,7 +351,7 @@ public boolean equal(VirtualFrame frame, DynamicObject a, DynamicObject b) {

final Object reversedResult = reverseCallNode.call(frame, b, "==", a);

return booleanCastNode.executeBoolean(frame, reversedResult);
return booleanCastNode.executeToBoolean(reversedResult);
}
}

Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ public Object execute(VirtualFrame frame) {
leftCast = insert(BooleanCastNodeGen.create(null));
}

final boolean leftBoolean = leftCast.executeBoolean(frame, leftValue);
final boolean leftBoolean = leftCast.executeToBoolean(leftValue);

if (conditionProfile.profile(leftBoolean)) {
return right.execute(frame);
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ public OrNode(RubyNode left, RubyNode right) {
@Override
public Object execute(VirtualFrame frame) {
final Object leftValue = left.execute(frame);
final boolean leftBoolean = leftCast.executeBoolean(frame, leftValue);
final boolean leftBoolean = leftCast.executeToBoolean(leftValue);

if (conditionProfile.profile(leftBoolean)) {
return leftValue;
Original file line number Diff line number Diff line change
@@ -61,8 +61,7 @@ public boolean callBoolean(
CompilerDirectives.transferToInterpreterAndInvalidate();
booleanCastNode = insert(BooleanCastNodeGen.create(null));
}
return booleanCastNode.executeBoolean(frame,
dispatch(frame, receiverObject, methodName, blockObject, argumentsObjects));
return booleanCastNode.executeToBoolean(dispatch(frame, receiverObject, methodName, blockObject, argumentsObjects));
}

}
Original file line number Diff line number Diff line change
@@ -165,7 +165,7 @@ public Object isDefined(VirtualFrame frame) {

if (method == null) {
final Object r = respondToMissing(frame, receiverObject);
if (r != DispatchNode.MISSING && !castRespondToMissingToBoolean(frame, r)) {
if (r != DispatchNode.MISSING && !castRespondToMissingToBoolean(r)) {
return nil();
}
} else if (method.isUndefined()) {
@@ -186,12 +186,12 @@ private Object respondToMissing(VirtualFrame frame, Object receiverObject) {
return respondToMissing.call(frame, receiverObject, "respond_to_missing?", method, false);
}

private boolean castRespondToMissingToBoolean(VirtualFrame frame, final Object r) {
private boolean castRespondToMissingToBoolean(Object r) {
if (respondToMissingCast == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
respondToMissingCast = insert(BooleanCastNodeGen.create(null));
}
return respondToMissingCast.executeBoolean(frame, r);
return respondToMissingCast.executeToBoolean(r);
}

public String getName() {
Original file line number Diff line number Diff line change
@@ -119,8 +119,7 @@ public DynamicObject createInfinity(
final int exceptionConstant = getIntegerConstantNode
.executeGetIntegerConstant(frame, getBigDecimalClass(), "EXCEPTION_INFINITY");

final boolean raise = booleanCastNode.executeBoolean(
frame,
final boolean raise = booleanCastNode.executeToBoolean(
modeCallNode.call(frame, getBigDecimalClass(), "boolean_mode", exceptionConstant));

if (raiseProfile.profile(raise)) {
@@ -146,8 +145,7 @@ public DynamicObject createNaN(
final int exceptionConstant = getIntegerConstantNode.executeGetIntegerConstant
(frame, getBigDecimalClass(), "EXCEPTION_NaN");

final boolean raise = booleanCastNode.executeBoolean(
frame,
final boolean raise = booleanCastNode.executeToBoolean(
modeCallNode.call(frame, getBigDecimalClass(), "boolean_mode", exceptionConstant));

if (raiseProfile.profile(raise)) {