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: 0f72afb650d3
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6991cfb0bbef
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on May 29, 2015

  1. Copy the full SHA
    d44874c View commit details
  2. Copy the full SHA
    6991cfb View commit details
8 changes: 8 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
Original file line number Diff line number Diff line change
@@ -146,4 +146,12 @@ public static boolean isRubyBigDecimal(RubyBasicObject value) {
return value.getDynamicObject().getShape().getObjectType() == BigDecimalNodes.BIG_DECIMAL_TYPE;
}

public static boolean isNegative(int size) {
return size < 0;
}

public static boolean isNegative(long size) {
return size < 0;
}

}
Original file line number Diff line number Diff line change
@@ -18,10 +18,6 @@ public static boolean isEmpty(RubyArray array) {
return ArrayNodes.getSize(array) == 0;
}

public static boolean isOtherEmpty(RubyArray array, RubyArray other) {
return ArrayNodes.getSize(other) == 0;
}

public static boolean isNull(RubyArray array) {
return ArrayNodes.getStore(array) == null;
}
@@ -46,52 +42,6 @@ public static boolean isObject(RubyArray array) {
return ArrayNodes.getStore(array) instanceof Object[];
}

public static boolean isOtherNull(RubyArray array, RubyArray other) {
return ArrayNodes.getStore(other) == null;
}

public static boolean isOtherIntegerFixnum(RubyArray array, RubyArray other) {
return ArrayNodes.getStore(other) instanceof int[];
}

public static boolean isOtherLongFixnum(RubyArray array, RubyArray other) {
return ArrayNodes.getStore(other) instanceof long[];
}

public static boolean isOtherFloat(RubyArray array, RubyArray other) {
return ArrayNodes.getStore(other) instanceof double[];
}

public static boolean isOtherObject(RubyArray array, RubyArray other) {
return ArrayNodes.getStore(other) instanceof Object[];
}

public static boolean areBothNull(RubyArray a, RubyArray b) {
return ArrayNodes.getStore(a) == null && ArrayNodes.getStore(b) == null;
}

public static boolean areBothIntegerFixnum(RubyArray a, RubyArray b) {
return ArrayNodes.getStore(a) instanceof int[] && ArrayNodes.getStore(b) instanceof int[];
}

public static boolean areBothIntegerFixnum(RubyArray array, RubyRange.IntegerFixnumRange range, RubyArray other) {
return ArrayNodes.getStore(array) instanceof int[] && ArrayNodes.getStore(other) instanceof int[];
}

public static boolean areBothLongFixnum(RubyArray a, RubyArray b) {
return ArrayNodes.getStore(a) instanceof long[] && ArrayNodes.getStore(b) instanceof long[];
}

public static boolean areBothFloat(RubyArray a, RubyArray b) {
return ArrayNodes.getStore(a) instanceof double[] && ArrayNodes.getStore(b) instanceof double[];
}

public static boolean areBothObject(RubyArray a, RubyArray b) {
return ArrayNodes.getStore(a) instanceof Object[] && ArrayNodes.getStore(b) instanceof Object[];
}

// New names being used for the new primitive nodes - old guards will be removed over time

public static boolean isNullArray(RubyArray array) {
return ArrayNodes.getStore(array) == null;
}
@@ -112,29 +62,19 @@ public static boolean isObjectArray(RubyArray array) {
return ArrayNodes.getStore(array) instanceof Object[];
}

public static boolean isOtherSingleIntegerFixnumArray(RubyArray array, Object[] others) {
public static boolean isSingleIntegerFixnumArray(Object[] others) {
return others.length == 1 && others[0] instanceof RubyArray && ArrayNodes.getStore(((RubyArray) others[0])) instanceof int[];
}

public static boolean isOtherSingleObjectArray(RubyArray array, Object[] others) {
public static boolean isSingleObjectArray(Object[] others) {
return others.length == 1 && others[0] instanceof RubyArray && ArrayNodes.getStore(((RubyArray) others[0])) instanceof Object[];
}

public static boolean isArgsLengthTwo(RubyArray array, Object[] others) {
public static boolean isArgsLengthTwo(Object[] others) {
return others.length == 2;
}

public static boolean isIntIndexAndOtherSingleObjectArg(RubyArray array, Object[] others) {
public static boolean isIntIndexAndOtherSingleObjectArg(Object[] others) {
return others.length == 2 && others[0] instanceof Integer && others[1] instanceof Object;
}

public static boolean isNegative(RubyArray array, int size) {
return size < 0;
}

public static boolean isNegative(RubyArray array, long size) {
return size < 0;
}


}
Loading