summary refs log tree commit diff stats
path: root/compiler/vmgen.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2014-06-26 20:51:44 +0200
committerAndreas Rumpf <rumpf_a@web.de>2014-06-26 20:51:44 +0200
commit8c93d3e1f9ddedc83d1fc90c5b938343cfe1d36f (patch)
tree6eac2d9d42faa1469f5099db20d3c52f8f04fde3 /compiler/vmgen.nim
parentf793523ade7aa48dcf13ede123a0a434e39e54e0 (diff)
parentbdd3b6c612a29723954f62e242888eedee0b35e4 (diff)
downloadNim-8c93d3e1f9ddedc83d1fc90c5b938343cfe1d36f.tar.gz
Merge pull request #1306 from flyx/devel
Fixed handling swap in vmgen
Diffstat (limited to 'compiler/vmgen.nim')
-rw-r--r--compiler/vmgen.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 186d27ae4..305ea7f9e 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -787,10 +787,12 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
     c.freeTemp(tmp)
   of mSwap: 
     unused(n, dest)
-    var d = c.genx(n.sons[1])
-    var tmp = c.genx(n.sons[2])
-    c.gABC(n, opcSwap, d, tmp)
-    c.freeTemp(tmp)
+    var
+      d1 = c.genx(n.sons[1])
+      d2 = c.genx(n.sons[2])
+    c.gABC(n, opcSwap, d1, d2)
+    c.genAsgnPatch(n.sons[1], d1)
+    c.genAsgnPatch(n.sons[2], d2)
   of mIsNil: genUnaryABC(c, n, dest, opcIsNil)
   of mCopyStr:
     if dest < 0: dest = c.getTemp(n.typ)