diff options
author | Oscar NihlgÄrd <oscarnihlgard@gmail.com> | 2018-05-08 12:02:48 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-05-08 17:00:00 +0200 |
commit | 7cf87dfac62d68d1d9ef7fbedca05b9950b71ced (patch) | |
tree | f7be268192acaf512e50addbf3a3ce11312c00e7 /compiler/vm.nim | |
parent | 6758fbd06e5cd88b620939b60deb5bfa00345efc (diff) | |
download | Nim-7cf87dfac62d68d1d9ef7fbedca05b9950b71ced.tar.gz |
VM fix for refs
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r-- | compiler/vm.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index 6c36a1458..27135d2e7 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -210,8 +210,14 @@ proc putIntoNode(n: var PNode; x: TFullReg) = of rkInt: n.intVal = x.intVal of rkFloat: n.floatVal = x.floatVal of rkNode: - if nfIsRef in x.node.flags: n = x.node - else: n[] = x.node[] + if nfIsRef in x.node.flags: + n = x.node + else: + let destIsRef = nfIsRef in n.flags + n[] = x.node[] + # Ref-ness must be kept for the destination + if destIsRef: + n.flags.incl nfIsRef of rkRegisterAddr: putIntoNode(n, x.regAddr[]) of rkNodeAddr: n[] = x.nodeAddr[][] |