incremental compilation: fixes basic caching logic of 'module' table
This commit is contained in:
parent
d26beedfb1
commit
cd9bc941e1
1 changed files with 6 additions and 4 deletions
|
|
@ -54,6 +54,8 @@ proc needsRecompile(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile;
|
||||||
|
|
||||||
proc getModuleId*(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile): int =
|
proc getModuleId*(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile): int =
|
||||||
## Analyse the known dependency graph.
|
## Analyse the known dependency graph.
|
||||||
|
if g.config.symbolFiles == disabledSf: return getID()
|
||||||
|
when false:
|
||||||
if g.config.symbolFiles in {disabledSf, writeOnlySf} or
|
if g.config.symbolFiles in {disabledSf, writeOnlySf} or
|
||||||
g.incr.configChanged:
|
g.incr.configChanged:
|
||||||
return getID()
|
return getID()
|
||||||
|
|
@ -70,7 +72,7 @@ proc getModuleId*(g: ModuleGraph; fileIdx: FileIndex; fullpath: AbsoluteFile): i
|
||||||
# not changed, so use the cached AST:
|
# not changed, so use the cached AST:
|
||||||
doAssert(result != 0)
|
doAssert(result != 0)
|
||||||
var cycleCheck = initIntSet()
|
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
|
echo "cached successfully! ", string fullpath
|
||||||
return -result
|
return -result
|
||||||
db.exec(sql"update modules set fullHash = ? where id = ?", currentFullhash, module[0])
|
db.exec(sql"update modules set fullHash = ? where id = ?", currentFullhash, module[0])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue