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

Commits on May 29, 2015

  1. Copy the full SHA
    1978373 View commit details
  2. Copy the full SHA
    9be6351 View commit details
Original file line number Diff line number Diff line change
@@ -38,57 +38,57 @@ public AppendManyNode(RubyContext context, SourceSection sourceSection) {

// TODO CS 12-May-15 differentiate between null and empty but possibly having enough space

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendManyEmpty(RubyArray array, int otherSize, int[] other) {
ArrayNodes.setStore(array, Arrays.copyOf(other, otherSize), otherSize);
return array;
}

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendManyEmpty(RubyArray array, int otherSize, long[] other) {
ArrayNodes.setStore(array, Arrays.copyOf(other, otherSize), otherSize);
return array;
}

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendManyEmpty(RubyArray array, int otherSize, double[] other) {
ArrayNodes.setStore(array, Arrays.copyOf(other, otherSize), otherSize);
return array;
}

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendManyEmpty(RubyArray array, int otherSize, Object[] other) {
ArrayNodes.setStore(array, Arrays.copyOf(other, otherSize), otherSize);
return array;
}

// Append of the correct type

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray appendManySameType(RubyArray array, int otherSize, int[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManySameTypeGeneric(array, ArrayMirror.reflect((int[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other), extendProfile);
return array;
}

@Specialization(guards = "isLongFixnum(array)")
@Specialization(guards = "isLongArray(array)")
public RubyArray appendManySameType(RubyArray array, int otherSize, long[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManySameTypeGeneric(array, ArrayMirror.reflect((long[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other), extendProfile);
return array;
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray appendManySameType(RubyArray array, int otherSize, double[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManySameTypeGeneric(array, ArrayMirror.reflect((double[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other), extendProfile);
return array;
}

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray appendManySameType(RubyArray array, int otherSize, Object[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManySameTypeGeneric(array, ArrayMirror.reflect((Object[]) ArrayNodes.getStore(array)),
@@ -116,21 +116,21 @@ public void appendManySameTypeGeneric(RubyArray array, ArrayMirror storeMirror,

// Append something else into an Object[]

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray appendManyBoxIntoObject(RubyArray array, int otherSize, int[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManyBoxIntoObjectGeneric(array, otherSize, ArrayMirror.reflect(other), extendProfile);
return array;
}

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray appendManyBoxIntoObject(RubyArray array, int otherSize, long[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManyBoxIntoObjectGeneric(array, otherSize, ArrayMirror.reflect(other), extendProfile);
return array;
}

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray appendManyBoxIntoObject(RubyArray array, int otherSize, double[] other,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendManyBoxIntoObjectGeneric(array, otherSize, ArrayMirror.reflect(other), extendProfile);
@@ -157,7 +157,7 @@ public void appendManyBoxIntoObjectGeneric(RubyArray array, int otherSize, Array

// Append forcing a generalization from int[] to long[]

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray appendManyLongIntoInteger(RubyArray array, int otherSize, long[] other) {
final int oldSize = ArrayNodes.getSize(array);
final int newSize = oldSize + otherSize;
@@ -173,49 +173,49 @@ public RubyArray appendManyLongIntoInteger(RubyArray array, int otherSize, long[

// Append forcing a generalization to Object[]

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray appendManyGeneralizeIntegerDouble(RubyArray array, int otherSize, double[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((int[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
return array;
}

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray appendManyGeneralizeIntegerDouble(RubyArray array, int otherSize, Object[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((int[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
return array;
}

@Specialization(guards = "isLongFixnum(array)")
@Specialization(guards = "isLongArray(array)")
public RubyArray appendManyGeneralizeLongDouble(RubyArray array, int otherSize, double[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((long[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
return array;
}

@Specialization(guards = "isLongFixnum(array)")
@Specialization(guards = "isLongArray(array)")
public RubyArray appendManyGeneralizeLongDouble(RubyArray array, int otherSize, Object[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((long[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
return array;
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray appendManyGeneralizeDoubleInteger(RubyArray array, int otherSize, int[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((double[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
return array;
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray appendManyGeneralizeDoubleLong(RubyArray array, int otherSize, long[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((double[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
return array;
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray appendManyGeneralizeDoubleObject(RubyArray array, int otherSize, Object[] other) {
appendManyGeneralizeGeneric(array, ArrayMirror.reflect((double[]) ArrayNodes.getStore(array)),
otherSize, ArrayMirror.reflect(other));
Original file line number Diff line number Diff line change
@@ -35,54 +35,54 @@ public AppendOneNode(RubyContext context, SourceSection sourceSection) {

// TODO CS 12-May-15 differentiate between null and empty but possibly having enough space

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendOneEmpty(RubyArray array, int value) {
ArrayNodes.setStore(array, new int[]{value}, 1);
return array;
}

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendOneEmpty(RubyArray array, long value) {
ArrayNodes.setStore(array, new long[]{value}, 1);
return array;
}

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendOneEmpty(RubyArray array, double value) {
ArrayNodes.setStore(array, new double[]{value}, 1);
return array;
}

@Specialization(guards = "isEmpty(array)")
@Specialization(guards = "isEmptyArray(array)")
public RubyArray appendOneEmpty(RubyArray array, Object value) {
ArrayNodes.setStore(array, new Object[]{value}, 1);
return array;
}

// Append of the correct type

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray appendOneSameType(RubyArray array, int value,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendOneSameTypeGeneric(array, ArrayMirror.reflect((int[]) ArrayNodes.getStore(array)), value, extendProfile);
return array;
}

@Specialization(guards = "isLongFixnum(array)")
@Specialization(guards = "isLongArray(array)")
public RubyArray appendOneSameType(RubyArray array, long value,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendOneSameTypeGeneric(array, ArrayMirror.reflect((long[]) ArrayNodes.getStore(array)), value, extendProfile);
return array;
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray appendOneSameType(RubyArray array, double value,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendOneSameTypeGeneric(array, ArrayMirror.reflect((double[]) ArrayNodes.getStore(array)), value, extendProfile);
return array;
}

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray appendOneSameType(RubyArray array, Object value,
@Cached("createBinaryProfile()") ConditionProfile extendProfile) {
appendOneSameTypeGeneric(array, ArrayMirror.reflect((Object[]) ArrayNodes.getStore(array)), value, extendProfile);
@@ -107,7 +107,7 @@ public void appendOneSameTypeGeneric(RubyArray array, ArrayMirror storeMirror, O

// Append forcing a generalization from int[] to long[]

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray appendOneLongIntoInteger(RubyArray array, long value) {
final int oldSize = ArrayNodes.getSize(array);
final int newSize = oldSize + 1;
@@ -122,19 +122,19 @@ public RubyArray appendOneLongIntoInteger(RubyArray array, long value) {

// Append forcing a generalization to Object[]

@Specialization(guards = {"isIntegerFixnum(array)", "!isInteger(value)", "!isLong(value)"})
@Specialization(guards = {"isIntArray(array)", "!isInteger(value)", "!isLong(value)"})
public RubyArray appendOneGeneralizeInteger(RubyArray array, Object value) {
appendOneGeneralizeGeneric(array, ArrayMirror.reflect((int[]) ArrayNodes.getStore(array)), value);
return array;
}

@Specialization(guards = {"isLongFixnum(array)", "!isInteger(value)", "!isLong(value)"})
@Specialization(guards = {"isLongArray(array)", "!isInteger(value)", "!isLong(value)"})
public RubyArray appendOneGeneralizeLong(RubyArray array, Object value) {
appendOneGeneralizeGeneric(array, ArrayMirror.reflect((long[]) ArrayNodes.getStore(array)), value);
return array;
}

@Specialization(guards = {"isFloat(array)", "!isDouble(value)"})
@Specialization(guards = {"isDoubleArray(array)", "!isDouble(value)"})
public RubyArray appendOneGeneralizeDouble(RubyArray array, Object value) {
appendOneGeneralizeGeneric(array, ArrayMirror.reflect((double[]) ArrayNodes.getStore(array)), value);
return array;
Original file line number Diff line number Diff line change
@@ -31,14 +31,14 @@ public ArrayDropTailNode(RubyContext context, SourceSection sourceSection, int i
this.index = index;
}

@Specialization(guards = "isNull(array)")
@Specialization(guards = "isNullArray(array)")
public RubyArray getHeadNull(RubyArray array) {
CompilerDirectives.transferToInterpreter();

return createEmptyArray();
}

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray getHeadIntegerFixnum(RubyArray array) {
CompilerDirectives.transferToInterpreter();

@@ -49,7 +49,7 @@ public RubyArray getHeadIntegerFixnum(RubyArray array) {
}
}

@Specialization(guards = "isLongFixnum(array)")
@Specialization(guards = "isLongArray(array)")
public RubyArray geHeadLongFixnum(RubyArray array) {
CompilerDirectives.transferToInterpreter();

@@ -61,7 +61,7 @@ public RubyArray geHeadLongFixnum(RubyArray array) {
}
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray getHeadFloat(RubyArray array) {
CompilerDirectives.transferToInterpreter();

@@ -73,7 +73,7 @@ public RubyArray getHeadFloat(RubyArray array) {
}
}

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray getHeadObject(RubyArray array) {
CompilerDirectives.transferToInterpreter();

Original file line number Diff line number Diff line change
@@ -34,27 +34,27 @@ public ArrayDupNode(RubyContext context, SourceSection sourceSection) {

public abstract RubyArray executeDup(VirtualFrame frame, RubyArray array);

@Specialization(guards = "isNull(from)")
@Specialization(guards = "isNullArray(from)")
public RubyArray dupNull(RubyArray from) {
return createEmptyArray();
}

@Specialization(guards = "isIntegerFixnum(from)")
@Specialization(guards = "isIntArray(from)")
public RubyArray dupIntegerFixnum(RubyArray from) {
return createArray(Arrays.copyOf((int[]) ArrayNodes.getStore(from), ArrayNodes.getSize(from)), ArrayNodes.getSize(from));
}

@Specialization(guards = "isLongFixnum(from)")
@Specialization(guards = "isLongArray(from)")
public RubyArray dupLongFixnum(RubyArray from) {
return createArray(Arrays.copyOf((long[]) ArrayNodes.getStore(from), ArrayNodes.getSize(from)), ArrayNodes.getSize(from));
}

@Specialization(guards = "isFloat(from)")
@Specialization(guards = "isDoubleArray(from)")
public RubyArray dupFloat(RubyArray from) {
return createArray(Arrays.copyOf((double[]) ArrayNodes.getStore(from), ArrayNodes.getSize(from)), ArrayNodes.getSize(from));
}

@Specialization(guards = "isObject(from)")
@Specialization(guards = "isObjectArray(from)")
public RubyArray dupObject(RubyArray from) {
return createArray(Arrays.copyOf((Object[]) ArrayNodes.getStore(from), ArrayNodes.getSize(from)), ArrayNodes.getSize(from));
}
Original file line number Diff line number Diff line change
@@ -31,14 +31,14 @@ public ArrayGetTailNode(RubyContext context, SourceSection sourceSection, int in
this.index = index;
}

@Specialization(guards = "isNull(array)")
@Specialization(guards = "isNullArray(array)")
public RubyArray getTailNull(RubyArray array) {
CompilerDirectives.transferToInterpreter();

return createEmptyArray();
}

@Specialization(guards = "isIntegerFixnum(array)")
@Specialization(guards = "isIntArray(array)")
public RubyArray getTailIntegerFixnum(RubyArray array) {
CompilerDirectives.transferToInterpreter();

@@ -49,7 +49,7 @@ public RubyArray getTailIntegerFixnum(RubyArray array) {
}
}

@Specialization(guards = "isLongFixnum(array)")
@Specialization(guards = "isLongArray(array)")
public RubyArray getTailLongFixnum(RubyArray array) {
CompilerDirectives.transferToInterpreter();

@@ -60,7 +60,7 @@ public RubyArray getTailLongFixnum(RubyArray array) {
}
}

@Specialization(guards = "isFloat(array)")
@Specialization(guards = "isDoubleArray(array)")
public RubyArray getTailFloat(RubyArray array) {
CompilerDirectives.transferToInterpreter();

@@ -71,7 +71,7 @@ public RubyArray getTailFloat(RubyArray array) {
}
}

@Specialization(guards = "isObject(array)")
@Specialization(guards = "isObjectArray(array)")
public RubyArray getTailObject(RubyArray array) {
CompilerDirectives.transferToInterpreter();

Loading