[Swift-commit] r6438 - branches/faster/src/org/griphyn/vdl/karajan/lib

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Apr 13 20:14:39 CDT 2013


Author: hategan
Date: 2013-04-13 20:14:39 -0500 (Sat, 13 Apr 2013)
New Revision: 6438

Modified:
   branches/faster/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java
Log:
properly wait for app arguments that are not mapped types

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java	2013-04-14 01:14:09 UTC (rev 6437)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java	2013-04-14 01:14:39 UTC (rev 6438)
@@ -24,17 +24,19 @@
 import java.util.List;
 import java.util.Map;
 
+import k.rt.ExecutionException;
 import k.rt.Stack;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.karajan.analyzer.ArgRef;
 import org.globus.cog.karajan.analyzer.Signature;
+import org.griphyn.vdl.mapping.AbstractDataNode;
 import org.griphyn.vdl.mapping.DSHandle;
 
 public class UnwrapClosedList extends SwiftFunction {
 	public static final Logger logger = Logger.getLogger(UnwrapClosedList.class);
 	
-	private ArgRef<List<DSHandle>> list;
+	private ArgRef<List<AbstractDataNode>> list;
 	
 	@Override
     protected Signature getSignature() {
@@ -43,20 +45,34 @@
 
 	@Override
 	public Object function(Stack stack) {
-        List<DSHandle> l = this.list.getValue(stack);
+        List<AbstractDataNode> l = this.list.getValue(stack);
 		
 		List<Object> r = new ArrayList<Object>(l.size());
 		
-		for (DSHandle h : l) {
+		for (AbstractDataNode h : l) {
 		    if (h.getType().isArray()) {
+		        h.waitFor(this);
 		        Map<?, DSHandle> m = h.getArrayValue();
 		        for (DSHandle h2 : m.values()) {
-		            r.add(h2.getValue());
+		            if (h2.getType().isPrimitive()) {
+		                ((AbstractDataNode) h2).waitFor(this);
+		                r.add(h2.getValue());
+		            }
+		            else {
+		                throw new ExecutionException(this, "Cannot pass an array of non-primitives as an application parameter");
+		            }
 		        }
 		    }
-		    else {
+		    else if (h.getType().isPrimitive()) {
+		        // stagein only waits for the root of the parameter
+		        // and the fringes as returned by getFringePaths(), but
+		        // the latter only returns mapped types
+		        h.waitFor(this);
 		        r.add(h.getValue());
 		    }
+		    else {
+		        throw new ExecutionException(this, "Cannot pass a structure as an application parameter");
+		    }
 		}
 		
 		return r;




More information about the Swift-commit mailing list