Skip to content
Snippets Groups Projects
Commit 53a0d0f9 authored by Mick Jordan's avatar Mick Jordan
Browse files

bug fixes

parent 761d8fcf
No related branches found
No related tags found
No related merge requests found
......@@ -80,7 +80,7 @@ $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh
cp examples-header.R examples-footer.R $(FASTR_SHARE_DIR)/R
includedir: Makefile $(TOPDIR)/include/jni/include/R.h
cp -rp $(TOPDIR)/include/jni/include $(FASTR_R_HOME)/include
cp -r $(TOPDIR)/include/jni/include $(FASTR_R_HOME)/include
clean:
rm -rf $(FASTR_BIN_DIR)
......
......@@ -121,7 +121,19 @@ public abstract class Mapply extends RBuiltinNode {
for (int i = 0; i < maxLength; i++) {
/* Evaluate and store the arguments */
for (int listIndex = 0; listIndex < dotsLength; listIndex++) {
RAbstractContainer vec = (RAbstractContainer) dots.getDataAt(listIndex);
Object listElem = dots.getDataAt(listIndex);
RAbstractContainer vec = null;
if (listElem instanceof RAbstractContainer) {
vec = (RAbstractContainer) listElem;
} else {
// TODO scalar types are a nuisance!
if (listElem instanceof String) {
vec = RDataFactory.createStringVectorFromScalar((String) listElem);
} else {
throw RInternalError.unimplemented();
}
}
int adjIndex = i % lengths[listIndex];
RArgsValuesAndNames indexArg;
if (adjIndex < INDEX_CACHE.length) {
......
......@@ -139,6 +139,13 @@ public abstract class Unlist extends RBuiltinNode {
return RNull.instance;
}
@SuppressWarnings("unused")
@Specialization(guards = "isOneNull(list)")
protected RNull unlistOneNullList(VirtualFrame frame, RList list, byte recursive, byte useNames) {
controlVisibility();
return RNull.instance;
}
// TODO: initially unlist was on the slow path - hence initial recursive implementation is on
// the slow path as well; ultimately we may consider (non-recursive) optimization
@Specialization(guards = "!isEmpty(list)")
......@@ -276,6 +283,7 @@ public abstract class Unlist extends RBuiltinNode {
}
return RDataFactory.createList(result, namesInfo != null && namesInfo.namesAssigned ? RDataFactory.createStringVector(namesData, RDataFactory.INCOMPLETE_VECTOR) : null);
}
default:
throw RInternalError.unimplemented();
}
......@@ -693,4 +701,8 @@ public abstract class Unlist extends RBuiltinNode {
public static boolean isEmpty(RAbstractVector vector) {
return vector.getLength() == 0;
}
public static boolean isOneNull(RList list) {
return list.getLength() == 1 && list.getDataAt(0) == RNull.instance;
}
}
......@@ -153,9 +153,11 @@ public class ConnectionSupport implements RContext.StateFactory {
if (con instanceof TextConnections.TextRConnection) {
RError.warning(RError.NO_NODE, RError.Message.UNUSED_TEXTCONN, con.descriptor, ((TextConnections.TextRConnection) con).description);
}
int index = con.descriptor;
closeAndDestroy(con);
allConnections.set(index, null);
if (con != null) {
int index = con.descriptor;
closeAndDestroy(con);
allConnections.set(index, null);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment