From 6b901967fe7256284f27c77801246cdc756d2e92 Mon Sep 17 00:00:00 2001 From: Christian Humer <christian.humer@oracle.com> Date: Mon, 4 Jan 2016 19:50:41 +0100 Subject: [PATCH] Fix but in RMissing filter of CachedVectorNodes. Improved comment about its rationale. --- .../r/nodes/access/vector/CachedVectorNode.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedVectorNode.java index ed260c4288..183b7e1e15 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedVectorNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedVectorNode.java @@ -77,10 +77,17 @@ abstract class CachedVectorNode extends RBaseNode { } } - @ExplodeLoop protected Object[] filterPositions(Object[] positions) { - // we assume that the positions count cannot change as the isRemovePosition check - // is just based on types and therefore does not change per position instance. + /* + * we assume that the positions count cannot change as the isRemovePosition check is just + * based on types and therefore does not change per position instance. + * + * normally empty positions are just empty but with S3 function dispatch it may happen that + * positions are also of type RMissing. These values should not contribute to the access + * dimensions. + * + * Example test case: dimensions.x<-data.frame(c(1,2), c(3,4)); x[1] + */ assert initializeFilteredPositionsCount(positions) == filteredPositionsLength; if (filteredPositionsLength != -1) { Object[] newPositions = new Object[filteredPositionsLength]; -- GitLab