got rid of gGeneratedSyms

This commit is contained in:
Araq
2011-10-21 21:02:03 +02:00
parent 43eace163a
commit d871cadbb3
2 changed files with 16 additions and 10 deletions

View File

@@ -47,7 +47,11 @@ proc findPendingModule(m: BModule, s: PSym): BModule =
for i in countup(0, high(gPendingModules)):
result = gPendingModules[i]
if result.module.id == ms.id: return
InternalError(s.info, "no pending module found for: " & s.name.s)
# else we found no pending module: This can happen for procs that are in
# a module that is already closed. This is fine, don't generate code for
# it then:
result = nil
#InternalError(s.info, "no pending module found for: " & s.name.s)
proc initLoc(result: var TLoc, k: TLocKind, typ: PType, s: TStorageLoc) =
result.k = k
@@ -599,15 +603,17 @@ proc genProcNoForward(m: BModule, prc: PSym) =
if lfNoDecl in prc.loc.Flags: nil
elif prc.typ.callConv == ccInline:
# We add inline procs to the calling module to enable C based inlining.
# This also means that a check with ``gGeneratedSyms`` is wrong, we need
# This also means that a check with ``q.declaredThings`` is wrong, we need
# a check for ``m.declaredThings``.
if not ContainsOrIncl(m.declaredThings, prc.id): genProcAux(m, prc)
elif lfDynamicLib in prc.loc.flags:
if not ContainsOrIncl(gGeneratedSyms, prc.id):
SymInDynamicLib(findPendingModule(m, prc), prc)
elif sfImportc notin prc.flags:
if not ContainsOrIncl(gGeneratedSyms, prc.id):
genProcAux(findPendingModule(m, prc), prc)
var q = findPendingModule(m, prc)
if q != nil and not ContainsOrIncl(q.declaredThings, prc.id):
SymInDynamicLib(q, prc)
elif sfImportc notin prc.flags:
var q = findPendingModule(m, prc)
if q != nil and not ContainsOrIncl(q.declaredThings, prc.id):
genProcAux(q, prc)
proc genProc(m: BModule, prc: PSym) =
if sfBorrow in prc.flags: return
@@ -659,7 +665,8 @@ proc getFileHeader(cfilenoext: string): PRope =
"/* Compiled for: $2, $3, $4 */$n" &
"/* Command for C compiler:$n $5 */$n",
"; Generated by Nimrod Compiler v$1$n" &
"; (c) 2011 Andreas Rumpf$n" & "; Compiled for: $2, $3, $4$n" &
"; (c) 2011 Andreas Rumpf$n" &
"; Compiled for: $2, $3, $4$n" &
"; Command for LLVM compiler:$n $5$n", [toRope(versionAsString),
toRope(platform.OS[targetOS].name),
toRope(platform.CPU[targetCPU].name),
@@ -960,4 +967,4 @@ proc cgenPass(): TPass =
result.close = myClose
InitIiTable(gToTypeInfoId)
gGeneratedSyms = initIntSet()

View File

@@ -98,7 +98,6 @@ var
mainModProcs*, mainModInit*: PRope # parts of the main module
gMapping*: PRope # the generated mapping file (if requested)
gProcProfile*: Natural # proc profile counter
gGeneratedSyms*: TIntSet # set of ID's of generated symbols
gPendingModules*: seq[BModule] = @[] # list of modules that are not
# finished with code generation
gForwardedProcsCounter*: int = 0