diff options
author | Araq <rumpf_a@web.de> | 2016-08-13 22:06:32 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-08-13 22:06:32 +0200 |
commit | 8fca04027fe03109657b753b95ded86d2f65e6f3 (patch) | |
tree | f57f5eec51439c999069f1d329c36d4546fae31f /compiler | |
parent | f6671b5bfdf1d24cfe026bfab5be06c309b8ba17 (diff) | |
download | Nim-8fca04027fe03109657b753b95ded86d2f65e6f3.tar.gz |
some attempts to make symbolfiles work again
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/canonicalizer.nim | 18 | ||||
-rw-r--r-- | compiler/nversion.nim | 2 | ||||
-rw-r--r-- | compiler/options.nim | 6 | ||||
-rw-r--r-- | compiler/rodread.nim | 17 | ||||
-rw-r--r-- | compiler/rodwrite.nim | 28 |
5 files changed, 41 insertions, 30 deletions
diff --git a/compiler/canonicalizer.nim b/compiler/canonicalizer.nim index 089bce302..2abe0a0e6 100644 --- a/compiler/canonicalizer.nim +++ b/compiler/canonicalizer.nim @@ -383,18 +383,28 @@ proc createDb() = interfHash varchar(256) not null, fullHash varchar(256) not null, - created timestamp not null default (DATETIME('now')), + created timestamp not null default (DATETIME('now')) );""") db.exec(sql""" + create table if not exists Backend( + id integer primary key, + strongdeps varchar(max) not null, + weakdeps varchar(max) not null, + header varchar(max) not null, + code varchar(max) not null + ) + create table if not exists Symbol( id integer primary key, module integer not null, + backend integer not null, name varchar(max) not null, data varchar(max) not null, created timestamp not null default (DATETIME('now')), - foreign key (module) references module(id) + foreign key (module) references Module(id), + foreign key (backend) references Backend(id) );""") db.exec(sql""" @@ -409,7 +419,3 @@ proc createDb() = );""") - #db.exec(sql""" - # --create unique index if not exists TsstNameIx on TestResult(name); - # """, []) - diff --git a/compiler/nversion.nim b/compiler/nversion.nim index adeb0fb6d..2af66f427 100644 --- a/compiler/nversion.nim +++ b/compiler/nversion.nim @@ -13,5 +13,5 @@ const MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets? VersionAsString* = system.NimVersion - RodFileVersion* = "1215" # modify this if the rod-format changes! + RodFileVersion* = "1216" # modify this if the rod-format changes! diff --git a/compiler/options.nim b/compiler/options.nim index a5154cb48..7cf707945 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -70,6 +70,12 @@ type # please make sure we have under 32 options optExcessiveStackTrace # fully qualified module filenames TGlobalOptions* = set[TGlobalOption] + +const + harmlessOptions* = {optForceFullMake, optNoLinking, optReportConceptFailures, + optRun, optUseColors, optStdout} + +type TCommands* = enum # Nim's commands # **keep binary compatible** cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, diff --git a/compiler/rodread.nim b/compiler/rodread.nim index 004b30b41..e1fd46bf4 100644 --- a/compiler/rodread.nim +++ b/compiler/rodread.nim @@ -566,7 +566,8 @@ proc processRodFile(r: PRodReader, hash: SecureHash) = of "GOPTIONS": inc(r.pos) # skip ':' var dep = cast[TGlobalOptions](int32(decodeVInt(r.s, r.pos))) - if gGlobalOptions != dep: r.reason = rrOptions + if gGlobalOptions-harmlessOptions != dep-harmlessOptions: + r.reason = rrOptions of "CMD": inc(r.pos) # skip ':' var dep = cast[TCommands](int32(decodeVInt(r.s, r.pos))) @@ -580,14 +581,14 @@ proc processRodFile(r: PRodReader, hash: SecureHash) = if not condsyms.isDefined(getIdent(w)): r.reason = rrDefines #MessageOut('not defined, but should: ' + w); if r.s[r.pos] == ' ': inc(r.pos) - if (d != countDefinedSymbols()): r.reason = rrDefines + if d != countDefinedSymbols(): r.reason = rrDefines of "FILES": inc(r.pos, 2) # skip "(\10" inc(r.line) while r.s[r.pos] != ')': - let relativePath = decodeStr(r.s, r.pos) - let resolvedPath = relativePath.findModule(r.origFile) - let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath + let finalPath = decodeStr(r.s, r.pos) + #let resolvedPath = relativePath.findModule(r.origFile) + #let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath r.files.add(finalPath.fileInfoIdx) inc(r.pos) # skip #10 inc(r.line) @@ -683,8 +684,11 @@ proc newRodReader(modfilename: string, hash: SecureHash, if version != RodFileVersion: # since ROD files are only for caching, no backwards compatibility is # needed + #echo "expected version ", version, " ", RodFileVersion + result.memfile.close result = nil else: + result.memfile.close result = nil proc rrGetType(r: PRodReader, id: int, info: TLineInfo): PType = @@ -818,9 +822,8 @@ proc checkDep(fileIdx: int32): TReasonForRecompile = var hash = getHash(fileIdx) gMods[fileIdx].reason = rrNone # we need to set it here to avoid cycles result = rrNone - var r: PRodReader = nil var rodfile = toGeneratedFile(filename.withPackageName, RodExt) - r = newRodReader(rodfile, hash, fileIdx) + var r = newRodReader(rodfile, hash, fileIdx) if r == nil: result = (if existsFile(rodfile): rrRodInvalid else: rrRodDoesNotExist) else: diff --git a/compiler/rodwrite.nim b/compiler/rodwrite.nim index d48a9ba40..ab0774164 100644 --- a/compiler/rodwrite.nim +++ b/compiler/rodwrite.nim @@ -39,13 +39,6 @@ type PRodWriter = ref TRodWriter -proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter -proc addModDep(w: PRodWriter, dep: string) -proc addInclDep(w: PRodWriter, dep: string) -proc addInterfaceSym(w: PRodWriter, s: PSym) -proc addStmt(w: PRodWriter, n: PNode) -proc writeRod(w: PRodWriter) - proc getDefines(): string = result = "" for d in definedSymbolNames(): @@ -86,16 +79,17 @@ proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter = result.origFile = module.info.toFilename result.data = newStringOfCap(12_000) -proc addModDep(w: PRodWriter, dep: string) = +proc addModDep(w: PRodWriter, dep: string; info: TLineInfo) = if w.modDeps.len != 0: add(w.modDeps, ' ') - encodeVInt(fileIdx(w, dep), w.modDeps) + let resolved = dep.findModule(info.toFullPath) + encodeVInt(fileIdx(w, resolved), w.modDeps) const rodNL = "\x0A" -proc addInclDep(w: PRodWriter, dep: string) = - var resolved = dep.findModule(w.module.info.toFullPath) - encodeVInt(fileIdx(w, dep), w.inclDeps) +proc addInclDep(w: PRodWriter, dep: string; info: TLineInfo) = + let resolved = dep.findModule(info.toFullPath) + encodeVInt(fileIdx(w, resolved), w.inclDeps) add(w.inclDeps, " ") encodeStr($secureHashFile(resolved), w.inclDeps) add(w.inclDeps, rodNL) @@ -147,7 +141,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode, encodeVInt(n.typ.id, result) pushType(w, n.typ) case n.kind - of nkCharLit..nkInt64Lit: + of nkCharLit..nkUInt64Lit: if n.intVal != 0: result.add('!') encodeVBiggestInt(n.intVal, result) @@ -562,13 +556,15 @@ proc process(c: PPassContext, n: PNode): PNode = # addInterfaceSym(w, a.sons[j].sym); # end of nkImportStmt: - for i in countup(0, sonsLen(n) - 1): addModDep(w, getModuleName(n.sons[i])) + for i in countup(0, sonsLen(n) - 1): + addModDep(w, getModuleName(n.sons[i]), n.info) addStmt(w, n) of nkFromStmt: - addModDep(w, getModuleName(n.sons[0])) + addModDep(w, getModuleName(n.sons[0]), n.info) addStmt(w, n) of nkIncludeStmt: - for i in countup(0, sonsLen(n) - 1): addInclDep(w, getModuleName(n.sons[i])) + for i in countup(0, sonsLen(n) - 1): + addInclDep(w, getModuleName(n.sons[i]), n.info) of nkPragma: addStmt(w, n) else: |