IC: further progress
This commit is contained in:
parent
39ad3a0da6
commit
eeb7cc6780
3 changed files with 11 additions and 4 deletions
|
|
@ -1188,6 +1188,7 @@ proc genTypeInfo(m: BModule, t: PType; info: TLineInfo): Rope =
|
||||||
let owner = t.skipTypes(typedescPtrs).owner.getModule
|
let owner = t.skipTypes(typedescPtrs).owner.getModule
|
||||||
if owner != m.module:
|
if owner != m.module:
|
||||||
# make sure the type info is created in the owner 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)
|
discard genTypeInfo(m.g.modules[owner.position], origType, info)
|
||||||
# reference the type info as extern here
|
# reference the type info as extern here
|
||||||
discard cgsym(m, "TNimType")
|
discard cgsym(m, "TNimType")
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ when nimIncremental:
|
||||||
let id = row[0]
|
let id = row[0]
|
||||||
let fullhash = hashFileCached(conf, fileIdx, AbsoluteFile fullpath)
|
let fullhash = hashFileCached(conf, fileIdx, AbsoluteFile fullpath)
|
||||||
if id.len == 0:
|
if id.len == 0:
|
||||||
result = int incr.db.insertID(sql"insert into filenames(fullpath, fullhash) values (?, ?)",
|
result = int incr.db.insertID(sql"insert into filenames(nimid, fullpath, fullhash) values (?, ?, ?)",
|
||||||
fullpath, fullhash)
|
int(fileIdx), fullpath, fullhash)
|
||||||
else:
|
else:
|
||||||
if row[1] != fullhash:
|
if row[1] != fullhash:
|
||||||
incr.db.exec(sql"update filenames set fullhash = ? where fullpath = ?", fullhash, fullpath)
|
incr.db.exec(sql"update filenames set fullhash = ? where fullpath = ?", fullhash, fullpath)
|
||||||
|
|
@ -102,6 +102,7 @@ when nimIncremental:
|
||||||
db.exec(sql"""
|
db.exec(sql"""
|
||||||
create table if not exists filenames(
|
create table if not exists filenames(
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
|
nimid integer not null,
|
||||||
fullpath varchar(8000) not null,
|
fullpath varchar(8000) not null,
|
||||||
fullHash varchar(256) not null
|
fullHash varchar(256) not null
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -847,8 +847,9 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) =
|
||||||
internalAssert g.config, false
|
internalAssert g.config, false
|
||||||
of nkImportStmt:
|
of nkImportStmt:
|
||||||
for x in n:
|
for x in n:
|
||||||
internalAssert g.config, x.kind == nkStrLit
|
internalAssert g.config, x.kind == nkSym
|
||||||
let imported = g.importModuleCallback(g, module, fileInfoIdx(g.config, AbsoluteFile n[0].strVal))
|
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
|
internalAssert g.config, imported.id < 0
|
||||||
of nkStmtList, nkStmtListExpr:
|
of nkStmtList, nkStmtListExpr:
|
||||||
for x in n: replay(g, module, x)
|
for x in n: replay(g, module, x)
|
||||||
|
|
@ -883,6 +884,10 @@ proc setupModuleCache*(g: ModuleGraph) =
|
||||||
database="nim")
|
database="nim")
|
||||||
let oldConfig = db.getValue(sql"select config from config")
|
let oldConfig = db.getValue(sql"select config from config")
|
||||||
g.incr.configChanged = oldConfig != encodeConfig(g)
|
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")
|
db.exec(sql"pragma journal_mode=off")
|
||||||
# This MUST be turned off, otherwise it's way too slow even for testing purposes:
|
# This MUST be turned off, otherwise it's way too slow even for testing purposes:
|
||||||
db.exec(sql"pragma SYNCHRONOUS=off")
|
db.exec(sql"pragma SYNCHRONOUS=off")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue