some attempts to make symbolfiles work again
This commit is contained in:
parent
f6671b5bfd
commit
8fca04027f
5 changed files with 41 additions and 30 deletions
|
|
@ -383,18 +383,28 @@ proc createDb() =
|
||||||
interfHash varchar(256) not null,
|
interfHash varchar(256) not null,
|
||||||
fullHash 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"""
|
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(
|
create table if not exists Symbol(
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
module integer not null,
|
module integer not null,
|
||||||
|
backend integer not null,
|
||||||
name varchar(max) not null,
|
name varchar(max) not null,
|
||||||
data varchar(max) not null,
|
data varchar(max) not null,
|
||||||
created timestamp not null default (DATETIME('now')),
|
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"""
|
db.exec(sql"""
|
||||||
|
|
@ -409,7 +419,3 @@ proc createDb() =
|
||||||
);""")
|
);""")
|
||||||
|
|
||||||
|
|
||||||
#db.exec(sql"""
|
|
||||||
# --create unique index if not exists TsstNameIx on TestResult(name);
|
|
||||||
# """, [])
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,5 @@
|
||||||
const
|
const
|
||||||
MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets?
|
MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets?
|
||||||
VersionAsString* = system.NimVersion
|
VersionAsString* = system.NimVersion
|
||||||
RodFileVersion* = "1215" # modify this if the rod-format changes!
|
RodFileVersion* = "1216" # modify this if the rod-format changes!
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,12 @@ type # please make sure we have under 32 options
|
||||||
optExcessiveStackTrace # fully qualified module filenames
|
optExcessiveStackTrace # fully qualified module filenames
|
||||||
|
|
||||||
TGlobalOptions* = set[TGlobalOption]
|
TGlobalOptions* = set[TGlobalOption]
|
||||||
|
|
||||||
|
const
|
||||||
|
harmlessOptions* = {optForceFullMake, optNoLinking, optReportConceptFailures,
|
||||||
|
optRun, optUseColors, optStdout}
|
||||||
|
|
||||||
|
type
|
||||||
TCommands* = enum # Nim's commands
|
TCommands* = enum # Nim's commands
|
||||||
# **keep binary compatible**
|
# **keep binary compatible**
|
||||||
cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC,
|
cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC,
|
||||||
|
|
|
||||||
|
|
@ -566,7 +566,8 @@ proc processRodFile(r: PRodReader, hash: SecureHash) =
|
||||||
of "GOPTIONS":
|
of "GOPTIONS":
|
||||||
inc(r.pos) # skip ':'
|
inc(r.pos) # skip ':'
|
||||||
var dep = cast[TGlobalOptions](int32(decodeVInt(r.s, r.pos)))
|
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":
|
of "CMD":
|
||||||
inc(r.pos) # skip ':'
|
inc(r.pos) # skip ':'
|
||||||
var dep = cast[TCommands](int32(decodeVInt(r.s, r.pos)))
|
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)):
|
if not condsyms.isDefined(getIdent(w)):
|
||||||
r.reason = rrDefines #MessageOut('not defined, but should: ' + w);
|
r.reason = rrDefines #MessageOut('not defined, but should: ' + w);
|
||||||
if r.s[r.pos] == ' ': inc(r.pos)
|
if r.s[r.pos] == ' ': inc(r.pos)
|
||||||
if (d != countDefinedSymbols()): r.reason = rrDefines
|
if d != countDefinedSymbols(): r.reason = rrDefines
|
||||||
of "FILES":
|
of "FILES":
|
||||||
inc(r.pos, 2) # skip "(\10"
|
inc(r.pos, 2) # skip "(\10"
|
||||||
inc(r.line)
|
inc(r.line)
|
||||||
while r.s[r.pos] != ')':
|
while r.s[r.pos] != ')':
|
||||||
let relativePath = decodeStr(r.s, r.pos)
|
let finalPath = decodeStr(r.s, r.pos)
|
||||||
let resolvedPath = relativePath.findModule(r.origFile)
|
#let resolvedPath = relativePath.findModule(r.origFile)
|
||||||
let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath
|
#let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath
|
||||||
r.files.add(finalPath.fileInfoIdx)
|
r.files.add(finalPath.fileInfoIdx)
|
||||||
inc(r.pos) # skip #10
|
inc(r.pos) # skip #10
|
||||||
inc(r.line)
|
inc(r.line)
|
||||||
|
|
@ -683,8 +684,11 @@ proc newRodReader(modfilename: string, hash: SecureHash,
|
||||||
if version != RodFileVersion:
|
if version != RodFileVersion:
|
||||||
# since ROD files are only for caching, no backwards compatibility is
|
# since ROD files are only for caching, no backwards compatibility is
|
||||||
# needed
|
# needed
|
||||||
|
#echo "expected version ", version, " ", RodFileVersion
|
||||||
|
result.memfile.close
|
||||||
result = nil
|
result = nil
|
||||||
else:
|
else:
|
||||||
|
result.memfile.close
|
||||||
result = nil
|
result = nil
|
||||||
|
|
||||||
proc rrGetType(r: PRodReader, id: int, info: TLineInfo): PType =
|
proc rrGetType(r: PRodReader, id: int, info: TLineInfo): PType =
|
||||||
|
|
@ -818,9 +822,8 @@ proc checkDep(fileIdx: int32): TReasonForRecompile =
|
||||||
var hash = getHash(fileIdx)
|
var hash = getHash(fileIdx)
|
||||||
gMods[fileIdx].reason = rrNone # we need to set it here to avoid cycles
|
gMods[fileIdx].reason = rrNone # we need to set it here to avoid cycles
|
||||||
result = rrNone
|
result = rrNone
|
||||||
var r: PRodReader = nil
|
|
||||||
var rodfile = toGeneratedFile(filename.withPackageName, RodExt)
|
var rodfile = toGeneratedFile(filename.withPackageName, RodExt)
|
||||||
r = newRodReader(rodfile, hash, fileIdx)
|
var r = newRodReader(rodfile, hash, fileIdx)
|
||||||
if r == nil:
|
if r == nil:
|
||||||
result = (if existsFile(rodfile): rrRodInvalid else: rrRodDoesNotExist)
|
result = (if existsFile(rodfile): rrRodInvalid else: rrRodDoesNotExist)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,6 @@ type
|
||||||
|
|
||||||
PRodWriter = ref TRodWriter
|
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 =
|
proc getDefines(): string =
|
||||||
result = ""
|
result = ""
|
||||||
for d in definedSymbolNames():
|
for d in definedSymbolNames():
|
||||||
|
|
@ -86,16 +79,17 @@ proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter =
|
||||||
result.origFile = module.info.toFilename
|
result.origFile = module.info.toFilename
|
||||||
result.data = newStringOfCap(12_000)
|
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, ' ')
|
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
|
const
|
||||||
rodNL = "\x0A"
|
rodNL = "\x0A"
|
||||||
|
|
||||||
proc addInclDep(w: PRodWriter, dep: string) =
|
proc addInclDep(w: PRodWriter, dep: string; info: TLineInfo) =
|
||||||
var resolved = dep.findModule(w.module.info.toFullPath)
|
let resolved = dep.findModule(info.toFullPath)
|
||||||
encodeVInt(fileIdx(w, dep), w.inclDeps)
|
encodeVInt(fileIdx(w, resolved), w.inclDeps)
|
||||||
add(w.inclDeps, " ")
|
add(w.inclDeps, " ")
|
||||||
encodeStr($secureHashFile(resolved), w.inclDeps)
|
encodeStr($secureHashFile(resolved), w.inclDeps)
|
||||||
add(w.inclDeps, rodNL)
|
add(w.inclDeps, rodNL)
|
||||||
|
|
@ -147,7 +141,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
|
||||||
encodeVInt(n.typ.id, result)
|
encodeVInt(n.typ.id, result)
|
||||||
pushType(w, n.typ)
|
pushType(w, n.typ)
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkCharLit..nkInt64Lit:
|
of nkCharLit..nkUInt64Lit:
|
||||||
if n.intVal != 0:
|
if n.intVal != 0:
|
||||||
result.add('!')
|
result.add('!')
|
||||||
encodeVBiggestInt(n.intVal, result)
|
encodeVBiggestInt(n.intVal, result)
|
||||||
|
|
@ -562,13 +556,15 @@ proc process(c: PPassContext, n: PNode): PNode =
|
||||||
# addInterfaceSym(w, a.sons[j].sym);
|
# addInterfaceSym(w, a.sons[j].sym);
|
||||||
# end
|
# end
|
||||||
of nkImportStmt:
|
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)
|
addStmt(w, n)
|
||||||
of nkFromStmt:
|
of nkFromStmt:
|
||||||
addModDep(w, getModuleName(n.sons[0]))
|
addModDep(w, getModuleName(n.sons[0]), n.info)
|
||||||
addStmt(w, n)
|
addStmt(w, n)
|
||||||
of nkIncludeStmt:
|
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:
|
of nkPragma:
|
||||||
addStmt(w, n)
|
addStmt(w, n)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue