IC: further progress

This commit is contained in:
Araq
2018-11-20 19:29:39 +01:00
parent 39ad3a0da6
commit eeb7cc6780
3 changed files with 11 additions and 4 deletions

View File

@@ -1188,6 +1188,7 @@ proc genTypeInfo(m: BModule, t: PType; info: TLineInfo): Rope =
let owner = t.skipTypes(typedescPtrs).owner.getModule
if owner != m.module:
# make sure the type info is created in the owner module
assert m.g.modules[owner.position] != nil
discard genTypeInfo(m.g.modules[owner.position], origType, info)
# reference the type info as extern here
discard cgsym(m, "TNimType")

View File

@@ -59,8 +59,8 @@ when nimIncremental:
let id = row[0]
let fullhash = hashFileCached(conf, fileIdx, AbsoluteFile fullpath)
if id.len == 0:
result = int incr.db.insertID(sql"insert into filenames(fullpath, fullhash) values (?, ?)",
fullpath, fullhash)
result = int incr.db.insertID(sql"insert into filenames(nimid, fullpath, fullhash) values (?, ?, ?)",
int(fileIdx), fullpath, fullhash)
else:
if row[1] != fullhash:
incr.db.exec(sql"update filenames set fullhash = ? where fullpath = ?", fullhash, fullpath)
@@ -102,6 +102,7 @@ when nimIncremental:
db.exec(sql"""
create table if not exists filenames(
id integer primary key,
nimid integer not null,
fullpath varchar(8000) not null,
fullHash varchar(256) not null
);

View File

@@ -847,8 +847,9 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) =
internalAssert g.config, false
of nkImportStmt:
for x in n:
internalAssert g.config, x.kind == nkStrLit
let imported = g.importModuleCallback(g, module, fileInfoIdx(g.config, AbsoluteFile n[0].strVal))
internalAssert g.config, x.kind == nkSym
let modpath = AbsoluteFile toFullPath(g.config, x.sym.info)
let imported = g.importModuleCallback(g, module, fileInfoIdx(g.config, modpath))
internalAssert g.config, imported.id < 0
of nkStmtList, nkStmtListExpr:
for x in n: replay(g, module, x)
@@ -883,6 +884,10 @@ proc setupModuleCache*(g: ModuleGraph) =
database="nim")
let oldConfig = db.getValue(sql"select config from config")
g.incr.configChanged = oldConfig != encodeConfig(g)
# ensure the filename IDs stay consistent:
for row in db.rows(sql"select fullpath, nimid from filenames order by nimid"):
let id = fileInfoIdx(g.config, AbsoluteFile row[0])
doAssert id.int == parseInt(row[1])
db.exec(sql"pragma journal_mode=off")
# This MUST be turned off, otherwise it's way too slow even for testing purposes:
db.exec(sql"pragma SYNCHRONOUS=off")