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

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


Author: hategan
Date: 2013-04-13 20:13:18 -0500 (Sat, 13 Apr 2013)
New Revision: 6436

Modified:
   branches/faster/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
Log:
optimize data copying a bit

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2013-04-14 01:12:13 UTC (rev 6435)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2013-04-14 01:13:18 UTC (rev 6436)
@@ -185,25 +185,32 @@
 	}
 	
 	protected void deepCopy(DSHandle dest, DSHandle source, Stack stack) {
-	    State state = this.state.getValue(stack);
-        if (state == null) {
-            state = new State();
-            this.state.setValue(stack, state);
+	    // don't create a state if only a non-composite is copied
+	    ((AbstractDataNode) source).waitFor(this);
+        if (source.getType().isPrimitive()) {
+            dest.setValue(source.getValue());
         }
-        
-        deepCopy(dest, source, state, 0);
-        
-        this.state.setValue(stack, null);
+        else {
+    	    State state = this.state.getValue(stack);
+            if (state == null) {
+                state = new State();
+                this.state.setValue(stack, state);
+            }
+            
+            deepCopy(dest, source, state, 0);
+            
+            this.state.setValue(stack, null);
+        }
 	}
 	
     /** make dest look like source - if its a simple value, copy that
 	    and if its an array then recursively copy */
 	public void deepCopy(DSHandle dest, DSHandle source, State state, int level) {
 	    ((AbstractDataNode) source).waitFor(this);
-		if (source.getType().isPrimitive()) {
-			dest.setValue(source.getValue());
-		}
-		else if (source.getType().isArray()) {
+        if (source.getType().isPrimitive()) {
+            dest.setValue(source.getValue());
+        }
+        else if (source.getType().isArray()) {
 		    copyArray(dest, source, state, level);
 		}
 		else if (source.getType().isComposite()) {




More information about the Swift-commit mailing list