summary refs log tree commit diff stats
path: root/compiler/cgendata.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/cgendata.nim')
-rw-r--r--compiler/cgendata.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim
index 72c7ceae5..fabad86ab 100644
--- a/compiler/cgendata.nim
+++ b/compiler/cgendata.nim
@@ -112,14 +112,14 @@ type
     labels*: natural          # for generating unique module-scope names
 
 var
-  mainModProcs*, mainModInit*: PRope # parts of the main module
+  mainModProcs*, mainModInit*, mainDatInit*: PRope # parts of the main module
   gMapping*: PRope             # the generated mapping file (if requested)
   gProcProfile*: Natural       # proc profile counter
   gPendingModules*: seq[BModule] = @[] # list of modules that are not
                                        # finished with code generation
+  gModules*: seq[BModule] = @[] # list of all compiled modules
   gForwardedProcsCounter*: int = 0
-  gNimDat*: BModule            # generated global data
-
+ 
 proc s*(p: BProc, s: TCProcSection): var PRope {.inline.} =
   # section in the current block
   result = p.blocks[p.blocks.len - 1].sections[s]
@@ -128,6 +128,10 @@ proc procSec*(p: BProc, s: TCProcSection): var PRope {.inline.} =
   # top level proc sections
   result = p.blocks[0].sections[s]
 
+proc bmod*(module: PSym): BModule =
+  # obtains the BModule for a given module PSym
+  result = gModules[module.position]
+
 proc newProc*(prc: PSym, module: BModule): BProc = 
   new(result)
   result.prc = prc