IC: much faster caching

This commit is contained in:
Araq
2018-12-04 22:09:42 +01:00
parent 633832d0de
commit d50336837d

View File

@@ -113,7 +113,8 @@ proc encodeNode(g: ModuleGraph; fInfo: TLineInfo, n: PNode,
result.add(',')
encodeVInt(int n.info.line, result)
result.add(',')
encodeVInt(toDbFileId(g.incr, g.config, n.info.fileIndex), result)
#encodeVInt(toDbFileId(g.incr, g.config, n.info.fileIndex), result)
encodeVInt(n.info.fileIndex.int, result)
elif fInfo.line != n.info.line:
result.add('?')
encodeVInt(n.info.col, result)
@@ -296,7 +297,8 @@ proc encodeSym(g: ModuleGraph, s: PSym, result: var string) =
result.add(',')
encodeVInt(int s.info.line, result)
result.add(',')
encodeVInt(toDbFileId(g.incr, g.config, s.info.fileIndex), result)
#encodeVInt(toDbFileId(g.incr, g.config, s.info.fileIndex), result)
encodeVInt(s.info.fileIndex.int, result)
if s.owner != nil:
result.add('*')
encodeVInt(s.owner.id, result)
@@ -380,7 +382,7 @@ proc storeType(g: ModuleGraph; t: PType) =
proc transitiveClosure(g: ModuleGraph) =
var i = 0
while true:
if i > 10_000:
if i > 100_000:
doAssert false, "loop never ends!"
if w.sstack.len > 0:
let s = w.sstack.pop()
@@ -457,9 +459,11 @@ proc decodeLineInfo(g; b; info: var TLineInfo) =
else: info.line = uint16(decodeVInt(b.s, b.pos))
if b.s[b.pos] == ',':
inc(b.pos)
info.fileIndex = fromDbFileId(g.incr, g.config, decodeVInt(b.s, b.pos))
#info.fileIndex = fromDbFileId(g.incr, g.config, decodeVInt(b.s, b.pos))
info.fileIndex = FileIndex decodeVInt(b.s, b.pos)
proc skipNode(b) =
# ')' itself cannot be part of a string literal so that this is correct.
assert b.s[b.pos] == '('
var par = 0
var pos = b.pos+1