fix compiling after suggest
This commit is contained in:
parent
f52ea04d22
commit
961d3de8e5
3 changed files with 36 additions and 41 deletions
|
|
@ -1266,10 +1266,6 @@ proc updateCachedModule(m: BModule) =
|
||||||
|
|
||||||
addFileToLink(cfilenoext)
|
addFileToLink(cfilenoext)
|
||||||
|
|
||||||
proc updateCachedModules* =
|
|
||||||
for m in cgenModules():
|
|
||||||
if m.fromCache: m.updateCachedModule
|
|
||||||
|
|
||||||
proc myClose(b: PPassContext, n: PNode): PNode =
|
proc myClose(b: PPassContext, n: PNode): PNode =
|
||||||
result = n
|
result = n
|
||||||
if b == nil or passes.skipCodegen(n): return
|
if b == nil or passes.skipCodegen(n): return
|
||||||
|
|
@ -1284,6 +1280,8 @@ proc myClose(b: PPassContext, n: PNode): PNode =
|
||||||
var disp = generateMethodDispatchers()
|
var disp = generateMethodDispatchers()
|
||||||
for i in 0..sonsLen(disp)-1: genProcAux(m, disp.sons[i].sym)
|
for i in 0..sonsLen(disp)-1: genProcAux(m, disp.sons[i].sym)
|
||||||
genMainProc(m)
|
genMainProc(m)
|
||||||
|
|
||||||
|
proc cgenWriteModules* =
|
||||||
# we need to process the transitive closure because recursive module
|
# we need to process the transitive closure because recursive module
|
||||||
# deps are allowed (and the system module is processed in the wrong
|
# deps are allowed (and the system module is processed in the wrong
|
||||||
# order anyway)
|
# order anyway)
|
||||||
|
|
@ -1293,8 +1291,10 @@ proc myClose(b: PPassContext, n: PNode): PNode =
|
||||||
if not m.fromCache:
|
if not m.fromCache:
|
||||||
finishModule(m)
|
finishModule(m)
|
||||||
for m in cgenModules():
|
for m in cgenModules():
|
||||||
if not m.fromCache:
|
if m.fromCache:
|
||||||
writeModule(m, pending=true)
|
m.updateCachedModule
|
||||||
|
else:
|
||||||
|
m.writeModule(pending=true)
|
||||||
writeMapping(gMapping)
|
writeMapping(gMapping)
|
||||||
if generatedHeader != nil: writeHeader(generatedHeader)
|
if generatedHeader != nil: writeHeader(generatedHeader)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,24 +89,23 @@ proc addDep(x: Psym, dep: int32) =
|
||||||
growCache gMemCacheData, dep
|
growCache gMemCacheData, dep
|
||||||
gMemCacheData[x.position].deps.safeAdd(dep)
|
gMemCacheData[x.position].deps.safeAdd(dep)
|
||||||
|
|
||||||
proc ResetModule(fileIdx: int32) =
|
proc resetModule(fileIdx: int32) =
|
||||||
writeStackTrace()
|
|
||||||
# echo "HARD RESETTING ", fileIdx.toFilename
|
# echo "HARD RESETTING ", fileIdx.toFilename
|
||||||
gMemCacheData[fileIdx].needsRecompile = Yes
|
gMemCacheData[fileIdx].needsRecompile = Yes
|
||||||
gCompiledModules[fileIdx] = nil
|
gCompiledModules[fileIdx] = nil
|
||||||
cgendata.gModules[fileIdx] = nil
|
cgendata.gModules[fileIdx] = nil
|
||||||
resetSourceMap(fileIdx)
|
resetSourceMap(fileIdx)
|
||||||
|
|
||||||
proc ResetAllModules =
|
proc resetAllModules =
|
||||||
for i in 0..gCompiledModules.high:
|
for i in 0..gCompiledModules.high:
|
||||||
if gCompiledModules[i] != nil:
|
if gCompiledModules[i] != nil:
|
||||||
ResetModule(i.int32)
|
resetModule(i.int32)
|
||||||
|
|
||||||
# for m in cgenModules(): echo "CGEN MODULE FOUND"
|
# for m in cgenModules(): echo "CGEN MODULE FOUND"
|
||||||
|
|
||||||
proc checkDepMem(fileIdx: int32): TNeedRecompile =
|
proc checkDepMem(fileIdx: int32): TNeedRecompile =
|
||||||
template markDirty =
|
template markDirty =
|
||||||
ResetModule(fileIdx)
|
resetModule(fileIdx)
|
||||||
return Yes
|
return Yes
|
||||||
|
|
||||||
if gMemCacheData[fileIdx].needsRecompile != Maybe:
|
if gMemCacheData[fileIdx].needsRecompile != Maybe:
|
||||||
|
|
@ -150,12 +149,7 @@ proc newModule(fileIdx: int32): PSym =
|
||||||
initStrTable(result.tab)
|
initStrTable(result.tab)
|
||||||
StrTableAdd(result.tab, result) # a module knows itself
|
StrTableAdd(result.tab, result) # a module knows itself
|
||||||
|
|
||||||
proc compileModule(fileIdxArg: int32, flagsArg: TSymFlags): PSym =
|
proc compileModule(fileIdx: int32, flags: TSymFlags): PSym =
|
||||||
let (fileIdx, flags) = if fileIdxArg == gDirtyOriginalIdx:
|
|
||||||
(gDirtyBufferIdx, flagsArg + {sfDirty})
|
|
||||||
else:
|
|
||||||
(fileIdxArg, flagsArg)
|
|
||||||
|
|
||||||
result = getModule(fileIdx)
|
result = getModule(fileIdx)
|
||||||
if result == nil:
|
if result == nil:
|
||||||
growCache gMemCacheData, fileIdx
|
growCache gMemCacheData, fileIdx
|
||||||
|
|
@ -260,14 +254,11 @@ proc CommandCompileToC =
|
||||||
# echo "CHECK DEP COMPLETE"
|
# echo "CHECK DEP COMPLETE"
|
||||||
|
|
||||||
compileProject()
|
compileProject()
|
||||||
|
cgenWriteModules()
|
||||||
if compilationCachePresent:
|
|
||||||
updateCachedModules()
|
|
||||||
|
|
||||||
if gCmd != cmdRun:
|
if gCmd != cmdRun:
|
||||||
extccomp.CallCCompiler(changeFileExt(gProjectFull, ""))
|
extccomp.CallCCompiler(changeFileExt(gProjectFull, ""))
|
||||||
|
|
||||||
if optCaasEnabled in gGlobalOptions:
|
if isServing:
|
||||||
# caas will keep track only of the compilation commands
|
# caas will keep track only of the compilation commands
|
||||||
lastCaasCmd = curCaasCmd
|
lastCaasCmd = curCaasCmd
|
||||||
resetCgenModules()
|
resetCgenModules()
|
||||||
|
|
@ -386,20 +377,23 @@ proc CommandScan =
|
||||||
rawMessage(errCannotOpenFile, f)
|
rawMessage(errCannotOpenFile, f)
|
||||||
|
|
||||||
proc CommandSuggest =
|
proc CommandSuggest =
|
||||||
msgs.gErrorMax = high(int) # do not stop after first error
|
|
||||||
semanticPasses()
|
|
||||||
rodPass()
|
|
||||||
if isServing:
|
if isServing:
|
||||||
# XXX: hacky work-around ahead
|
# XXX: hacky work-around ahead
|
||||||
# Currently, it's possible to issue a idetools command, before
|
# Currently, it's possible to issue a idetools command, before
|
||||||
# issuing the first compile command. This will leave the compiler
|
# issuing the first compile command. This will leave the compiler
|
||||||
# cache in a state where "no recompilation is necessary", but the
|
# cache in a state where "no recompilation is necessary", but the
|
||||||
# cgen pass was never executed at all.
|
# cgen pass was never executed at all.
|
||||||
codegenPass()
|
CommandCompileToC()
|
||||||
compileProject()
|
if gDirtyBufferIdx != 0:
|
||||||
if isServing:
|
discard compileModule(gDirtyBufferIdx, {sfDirty})
|
||||||
|
resetModule(gDirtyBufferIdx)
|
||||||
if optDef in gGlobalOptions:
|
if optDef in gGlobalOptions:
|
||||||
defFromSourceMap(optTrackPos)
|
defFromSourceMap(optTrackPos)
|
||||||
|
else:
|
||||||
|
msgs.gErrorMax = high(int) # do not stop after first error
|
||||||
|
semanticPasses()
|
||||||
|
rodPass()
|
||||||
|
compileProject()
|
||||||
|
|
||||||
proc wantMainModule =
|
proc wantMainModule =
|
||||||
if gProjectFull.len == 0:
|
if gProjectFull.len == 0:
|
||||||
|
|
@ -423,7 +417,7 @@ proc requireMainModuleOption =
|
||||||
proc resetMemory =
|
proc resetMemory =
|
||||||
resetCompilationLists()
|
resetCompilationLists()
|
||||||
ccgutils.resetCaches()
|
ccgutils.resetCaches()
|
||||||
ResetAllModules()
|
resetAllModules()
|
||||||
resetRopeCache()
|
resetRopeCache()
|
||||||
resetSysTypes()
|
resetSysTypes()
|
||||||
gOwners = @[]
|
gOwners = @[]
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ proc serve*(action: proc (){.nimcall.}) =
|
||||||
action()
|
action()
|
||||||
gDirtyBufferIdx = 0
|
gDirtyBufferIdx = 0
|
||||||
gDirtyOriginalIdx = 0
|
gDirtyOriginalIdx = 0
|
||||||
|
gErrorCounter = 0
|
||||||
|
|
||||||
let typ = getConfigVar("server.type")
|
let typ = getConfigVar("server.type")
|
||||||
case typ
|
case typ
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue