remove the last global variables in the C code generator

This commit is contained in:
Andreas Rumpf 2018-05-28 18:18:43 +02:00
commit 5ad1acc60c
2 changed files with 19 additions and 21 deletions

View file

@ -119,6 +119,17 @@ type
graph*: ModuleGraph
strVersion*, seqVersion*: int # version of the string/seq implementation to use
nimtv*: Rope # Nim thread vars; the struct body
nimtvDeps*: seq[PType] # type deps: every module needs whole struct
nimtvDeclared*: IntSet # so that every var/field exists only once
# in the struct
# 'nimtv' is incredibly hard to modularize! Best
# effort is to store all thread vars in a ROD
# section and with their type deps and load them
# unconditionally...
# nimtvDeps is VERY hard to cache because it's
# not a list of IDs nor can it be made to be one.
TCGen = object of TPassContext # represents a C source file
s*: TCFileSections # sections of the C file
flags*: set[Codegenflag]
@ -177,7 +188,7 @@ proc newProc*(prc: PSym, module: BModule): BProc =
proc newModuleList*(g: ModuleGraph): BModuleList =
BModuleList(modules: @[], typeInfoMarker: initTable[SigHash, Rope](), config: g.config,
graph: g)
graph: g, nimtvDeps: @[], nimtvDeclared: initIntSet())
iterator cgenModules*(g: BModuleList): BModule =
for i in 0..high(g.modules):