diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-11-06 19:36:29 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-11-06 19:36:39 +0100 |
commit | 24902394f713ba540e5c26dc5585fdc70ec11853 (patch) | |
tree | 8351c93f24f69ab518f89f14bb4a813303763598 /compiler/vm.nim | |
parent | 66a76d3165fba77b081f358dfa768b8a3203b7d8 (diff) | |
download | Nim-24902394f713ba540e5c26dc5585fdc70ec11853.tar.gz |
VM: don't inject destructor calls, refs #7041
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r-- | compiler/vm.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index 05ee3b90e..4eef91dfc 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -503,7 +503,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = of opcAsgnFloat64FromInt: let rb = instr.regB ensureKind(rkFloat) - regs[ra].floatVal = cast[float64](int64(regs[rb].intVal)) + regs[ra].floatVal = cast[float64](int64(regs[rb].intVal)) of opcAsgnComplex: asgnComplex(regs[ra], regs[instr.regB]) of opcAsgnRef: @@ -945,10 +945,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = let a = regs[rb].node if a.kind == nkSym: regs[ra].node = if a.sym.ast.isNil: newNode(nkNilLit) - else: + else: let ast = a.sym.ast.shallowCopy for i in 0..<a.sym.ast.len: - ast[i] = a.sym.ast[i] + ast[i] = a.sym.ast[i] ast[bodyPos] = transformBody(c.graph, a.sym) ast.copyTree() of opcSymOwner: @@ -1822,7 +1822,7 @@ proc execProc*(c: PCtx; sym: PSym; args: openArray[PNode]): PNode = "NimScript: attempt to call non-routine: " & sym.name.s) proc evalStmt*(c: PCtx, n: PNode) = - let n = transformExpr(c.graph, c.module, n) + let n = transformExpr(c.graph, c.module, n, noDestructors = true) let start = genStmt(c, n) # execute new instructions; this redundant opcEof check saves us lots # of allocations in 'execute': @@ -1830,7 +1830,7 @@ proc evalStmt*(c: PCtx, n: PNode) = discard execute(c, start) proc evalExpr*(c: PCtx, n: PNode): PNode = - let n = transformExpr(c.graph, c.module, n) + let n = transformExpr(c.graph, c.module, n, noDestructors = true) let start = genExpr(c, n) assert c.code[start].opcode != opcEof result = execute(c, start) @@ -1877,7 +1877,7 @@ const evalPass* = makePass(myOpen, myProcess, myClose) proc evalConstExprAux(module: PSym; g: ModuleGraph; prc: PSym, n: PNode, mode: TEvalMode): PNode = - let n = transformExpr(g, module, n) + let n = transformExpr(g, module, n, noDestructors = true) setupGlobalCtx(module, g) var c = PCtx g.vm let oldMode = c.mode |