diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java index 39060fa71a69d58f3156c6a12c2fbb2919de3939..40e9f22fcd08fbf186ffa1ef1839447fb9eaf674 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java @@ -37,7 +37,6 @@ import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RComplexVector; import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RDoubleSequence; import com.oracle.truffle.r.runtime.data.RDoubleVector; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RRawVector; @@ -164,13 +163,7 @@ public abstract class CastDoubleNode extends CastDoubleBaseNode { } @Specialization - protected RDoubleVector doDoubleVector(RDoubleVector operand) { - return operand; - } - - @Specialization - protected RDoubleSequence doDoubleVector(RDoubleSequence operand) { - // sequence does not have attributes - nothing to copy or drop + protected RAbstractDoubleVector doDoubleVector(RAbstractDoubleVector operand) { return operand; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java index de06208d8ae22aa300ad17632c7895a5f3113a71..0d7552c06cbfc48169550d8b35dc1d91f002a01c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java @@ -166,14 +166,13 @@ public abstract class CastIntegerNode extends CastIntegerBaseNode { } @Specialization - protected RIntVector doDoubleVector(RAbstractDoubleVector operand) { - naCheck.enable(operand); - return vectorCopy(operand, naCheck.convertDoubleVectorToIntData(operand), naCheck.neverSeenNA()); + protected RAbstractIntVector doDoubleVector(RAbstractDoubleVector operand) { + return castWithReuse(operand, index -> naCheck.convertDoubleToInt(operand.getDataAt(index))); } @Specialization - protected RIntVector doRawVector(RAbstractRawVector operand) { - return createResultVector(operand, index -> RRuntime.raw2int(operand.getDataAt(index))); + protected RAbstractIntVector doRawVector(RAbstractRawVector operand) { + return castWithReuse(operand, index -> RRuntime.raw2int(operand.getDataAt(index))); } @Specialization