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
This commit is contained in:
cooldome 2018-10-18 19:21:25 +01:00 • committed by Andreas Rumpf
commit eaca5be9d6
22 changed files with 188 additions and 85 deletions

View file

@ -32,7 +32,7 @@ import
ast, astalgo, strutils, hashes, trees, platform, magicsys, extccomp, options,
nversion, nimsets, msgs, std / sha1, bitsets, idents, types, os, tables,
times, ropes, math, passes, ccgutils, wordrecg, renderer,
intsets, cgmeth, lowerings, sighashes, lineinfos, rodutils, pathutils
intsets, cgmeth, lowerings, sighashes, lineinfos, rodutils, pathutils, transf
from modulegraphs import ModuleGraph, PPassContext
@ -2021,7 +2021,8 @@ proc genProc(oldProc: PProc, prc: PSym): Rope =
else:
returnStmt = "return $#;$n" % [a.res]
p.nested: genStmt(p, prc.getBody)
let transformed_body = transformBody(oldProc.module.graph, prc, cache = false)
p.nested: genStmt(p, transformed_body)
var def: Rope
if not prc.constraint.isNil:
@ -2271,7 +2272,8 @@ proc genModule(p: PProc, n: PNode) =
add(p.body, frameCreate(p,
makeJSString("module " & p.module.module.name.s),
makeJSString(toFilename(p.config, p.module.module.info))))
genStmt(p, n)
let n_transformed = transformStmt(p.module.graph, p.module.module, n)
genStmt(p, n_transformed)
if optStackTrace in p.options:
add(p.body, frameDestroy(p))