diff options
author | Araq <rumpf_a@web.de> | 2018-10-19 16:27:11 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-10-19 16:27:20 +0200 |
commit | cd9bc941e1315f47efd1ec567249a16347c0319a (patch) | |
tree | 06ae5cad7fb30b026e29b38526a2db30d357f5b6 /compiler/rodimpl.nim | |
parent | d26beedfb154d75840e61c97da9f89d14b677584 (diff) | |
download | Nim-cd9bc941e1315f47efd1ec567249a16347c0319a.tar.gz |
incremental compilation: fixes basic caching logic of 'module' table
Diffstat (limited to 'compiler/rodimpl.nim')
-rw-r--r-- | compiler/rodimpl.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rodimpl.nim b/compiler/rodimpl.nim index eab305d5c..839a9c6ca 100644 --- a/compiler/rodimpl.nim +++ b/compiler/rodimpl.nim @@ -54,9 +54,11 @@ proc needsRecompile(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile; proc getModuleId*(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile): int = ## Analyse the known dependency graph. - if g.config.symbolFiles in {disabledSf, writeOnlySf} or - g.incr.configChanged: - return getID() + if g.config.symbolFiles == disabledSf: return getID() + when false: + if g.config.symbolFiles in {disabledSf, writeOnlySf} or + g.incr.configChanged: + return getID() let module = g.incr.db.getRow( sql"select id, fullHash, nimid from modules where fullpath = ?", string fullpath) let currentFullhash = hashFileCached(g.config, fileIdx, fullpath) @@ -70,7 +72,7 @@ proc getModuleId*(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile): i # not changed, so use the cached AST: doAssert(result != 0) var cycleCheck = initIntSet() - if not needsRecompile(g, fileIdx, fullpath, cycleCheck): + if not needsRecompile(g, fileIdx, fullpath, cycleCheck) and not g.incr.configChanged: echo "cached successfully! ", string fullpath return -result db.exec(sql"update modules set fullHash = ? where id = ?", currentFullhash, module[0]) |