summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2018-10-18 19:21:25 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-10-18 20:21:25 +0200
commiteaca5be9d6e205e8aa7055306122a6c053ef35a6 (patch)
tree784c5f2726a94b656e3f85ab231c4dfc377cc167 /compiler/vm.nim
parent15dbd973dec848f1c429fe7043e53254a501812b (diff)
downloadNim-eaca5be9d6e205e8aa7055306122a6c053ef35a6.tar.gz
Change the order of compilation passes, transformation is made lazy at code gen (#8489)
* Ast no transformation
* Add getImplNoTransform to the macros module
* progress on delaying transf
* Fix methods tranformation
* Fix lazy lambdalifting
* fix create thread wrapper
* transform for lambda lifting
* improve getImplTransformed
* Fix destructor tests
* try to fix nimprof for linux
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 4255ba3fc..420934470 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -924,6 +924,17 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
         regs[ra].node.flags.incl nfIsRef
       else:
         stackTrace(c, tos, pc, "node is not a symbol")
+    of opcGetImplTransf:
+      decodeB(rkNode)
+      let a = regs[rb].node
+      if a.kind == nkSym:
+        regs[ra].node = if a.sym.ast.isNil: newNode(nkNilLit)
+                        else: 
+                          let ast = a.sym.ast.shallowCopy
+                          for i in 0..<a.sym.ast.len:
+                            ast[i] = a.sym.ast[i]                        
+                          ast[bodyPos] = transformBody(c.graph, a.sym)
+                          ast.copyTree()
     of opcSymOwner:
       decodeB(rkNode)
       let a = regs[rb].node