ARC: solves phase ordering problems (#12654)

This commit is contained in:
Andreas Rumpf 2019-11-14 23:19:18 +01:00 • committed by GitHub
commit a14abc5708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 62 deletions

View file

@ -33,7 +33,7 @@ import
nversion, msgs, idents, types, tables,
ropes, math, passes, ccgutils, wordrecg, renderer,
intsets, cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils,
transf
transf, injectdestructors
from modulegraphs import ModuleGraph, PPassContext
@ -2259,7 +2259,10 @@ proc genProc(oldProc: PProc, prc: PSym): Rope =
else:
returnStmt = "return $#;$n" % [a.res]
let transformedBody = transformBody(oldProc.module.graph, prc, cache = false)
var transformedBody = transformBody(oldProc.module.graph, prc, cache = false)
if sfInjectDestructors in prc.flags:
transformedBody = injectDestructorCalls(oldProc.module.graph, prc, transformedBody)
p.nested: genStmt(p, transformedBody)
var def: Rope
@ -2540,7 +2543,9 @@ 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))))
let transformedN = transformStmt(p.module.graph, p.module.module, n)
var transformedN = transformStmt(p.module.graph, p.module.module, n)
if sfInjectDestructors in p.module.module.flags:
transformedN = injectDestructorCalls(p.module.graph, p.module.module, transformedN)
if p.config.hcrOn and n.kind == nkStmtList:
let moduleSym = p.module.module
var moduleLoadedVar = rope(moduleSym.name.s) & "_loaded" &