got rid of gGeneratedSyms
This commit is contained in:
parent
43eace163a
commit
d871cadbb3
2 changed files with 16 additions and 10 deletions
|
|
@ -47,7 +47,11 @@ proc findPendingModule(m: BModule, s: PSym): BModule =
|
||||||
for i in countup(0, high(gPendingModules)):
|
for i in countup(0, high(gPendingModules)):
|
||||||
result = gPendingModules[i]
|
result = gPendingModules[i]
|
||||||
if result.module.id == ms.id: return
|
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) =
|
proc initLoc(result: var TLoc, k: TLocKind, typ: PType, s: TStorageLoc) =
|
||||||
result.k = k
|
result.k = k
|
||||||
|
|
@ -599,15 +603,17 @@ proc genProcNoForward(m: BModule, prc: PSym) =
|
||||||
if lfNoDecl in prc.loc.Flags: nil
|
if lfNoDecl in prc.loc.Flags: nil
|
||||||
elif prc.typ.callConv == ccInline:
|
elif prc.typ.callConv == ccInline:
|
||||||
# We add inline procs to the calling module to enable C based inlining.
|
# 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``.
|
# a check for ``m.declaredThings``.
|
||||||
if not ContainsOrIncl(m.declaredThings, prc.id): genProcAux(m, prc)
|
if not ContainsOrIncl(m.declaredThings, prc.id): genProcAux(m, prc)
|
||||||
elif lfDynamicLib in prc.loc.flags:
|
elif lfDynamicLib in prc.loc.flags:
|
||||||
if not ContainsOrIncl(gGeneratedSyms, prc.id):
|
var q = findPendingModule(m, prc)
|
||||||
SymInDynamicLib(findPendingModule(m, prc), prc)
|
if q != nil and not ContainsOrIncl(q.declaredThings, prc.id):
|
||||||
elif sfImportc notin prc.flags:
|
SymInDynamicLib(q, prc)
|
||||||
if not ContainsOrIncl(gGeneratedSyms, prc.id):
|
elif sfImportc notin prc.flags:
|
||||||
genProcAux(findPendingModule(m, prc), prc)
|
var q = findPendingModule(m, prc)
|
||||||
|
if q != nil and not ContainsOrIncl(q.declaredThings, prc.id):
|
||||||
|
genProcAux(q, prc)
|
||||||
|
|
||||||
proc genProc(m: BModule, prc: PSym) =
|
proc genProc(m: BModule, prc: PSym) =
|
||||||
if sfBorrow in prc.flags: return
|
if sfBorrow in prc.flags: return
|
||||||
|
|
@ -659,7 +665,8 @@ proc getFileHeader(cfilenoext: string): PRope =
|
||||||
"/* Compiled for: $2, $3, $4 */$n" &
|
"/* Compiled for: $2, $3, $4 */$n" &
|
||||||
"/* Command for C compiler:$n $5 */$n",
|
"/* Command for C compiler:$n $5 */$n",
|
||||||
"; Generated by Nimrod Compiler v$1$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),
|
"; Command for LLVM compiler:$n $5$n", [toRope(versionAsString),
|
||||||
toRope(platform.OS[targetOS].name),
|
toRope(platform.OS[targetOS].name),
|
||||||
toRope(platform.CPU[targetCPU].name),
|
toRope(platform.CPU[targetCPU].name),
|
||||||
|
|
@ -960,4 +967,4 @@ proc cgenPass(): TPass =
|
||||||
result.close = myClose
|
result.close = myClose
|
||||||
|
|
||||||
InitIiTable(gToTypeInfoId)
|
InitIiTable(gToTypeInfoId)
|
||||||
gGeneratedSyms = initIntSet()
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ var
|
||||||
mainModProcs*, mainModInit*: PRope # parts of the main module
|
mainModProcs*, mainModInit*: PRope # parts of the main module
|
||||||
gMapping*: PRope # the generated mapping file (if requested)
|
gMapping*: PRope # the generated mapping file (if requested)
|
||||||
gProcProfile*: Natural # proc profile counter
|
gProcProfile*: Natural # proc profile counter
|
||||||
gGeneratedSyms*: TIntSet # set of ID's of generated symbols
|
|
||||||
gPendingModules*: seq[BModule] = @[] # list of modules that are not
|
gPendingModules*: seq[BModule] = @[] # list of modules that are not
|
||||||
# finished with code generation
|
# finished with code generation
|
||||||
gForwardedProcsCounter*: int = 0
|
gForwardedProcsCounter*: int = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue