summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
authorOscar NihlgÄrd <oscarnihlgard@gmail.com>2018-06-29 16:00:53 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-06-29 16:00:53 +0200
commitae69e571e1c9c2ce5e29b938ad9c376c74b3cd5b (patch)
tree98e5b8bb146e30968d0709743db181a6822ba403 /compiler/vm.nim
parent64c84a7d11697a03a7b2e54a5ef4bffa099535fe (diff)
downloadNim-ae69e571e1c9c2ce5e29b938ad9c376c74b3cd5b.tar.gz
VM regression fixes (#8146)
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index b16eb0fd4..c8e595f5d 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -209,7 +209,7 @@ proc writeField(n: var PNode, x: TFullReg) =
   of rkNone: discard
   of rkInt: n.intVal = x.intVal
   of rkFloat: n.floatVal = x.floatVal
-  of rkNode: n = x.node
+  of rkNode: n = copyValue(x.node)
   of rkRegisterAddr: writeField(n, x.regAddr[])
   of rkNodeAddr: n = x.nodeAddr[]
 
@@ -912,6 +912,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       if a.kind == nkSym:
         regs[ra].node = if a.sym.ast.isNil: newNode(nkNilLit)
                         else: copyTree(a.sym.ast)
+        regs[ra].node.flags.incl nfIsRef
       else:
         stackTrace(c, tos, pc, "node is not a symbol")
     of opcEcho:
@@ -1462,6 +1463,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       else:
         regs[ra].node = newNodeI(nkIdent, c.debug[pc])
         regs[ra].node.ident = getIdent(c.cache, regs[rb].node.strVal)
+        regs[ra].node.flags.incl nfIsRef
     of opcSetType:
       if regs[ra].kind != rkNode:
         internalError(c.config, c.debug[pc], "cannot set type")