diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-06-22 02:50:42 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-06-22 02:50:50 +0200 |
commit | 4b0ba5e3f1b78b3c45a3f1576ed3d60f9a8b6d80 (patch) | |
tree | 2019e7f764acaaf4b5856febcffc6ae0eacf0a05 /compiler/cgen.nim | |
parent | 6b334770b5e310d8a237b88aed5d10380671f7d2 (diff) | |
download | Nim-4b0ba5e3f1b78b3c45a3f1576ed3d60f9a8b6d80.tar.gz |
C code generation now deterministic; fixes #4364
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r-- | compiler/cgen.nim | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 3334f047f..589fcb515 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -500,7 +500,7 @@ proc loadDynamicLib(m: BModule, lib: PLib) = assert(lib != nil) if not lib.generated: lib.generated = true - var tmp = getGlobalTempName() + var tmp = getTempName(m) assert(lib.name == nil) lib.name = tmp # BUGFIX: cgsym has awful side-effects addf(m.s[cfsVars], "static void* $1;$n", [tmp]) @@ -1084,6 +1084,7 @@ proc initProcOptions(m: BModule): TOptions = proc rawNewModule(module: PSym, filename: string): BModule = new(result) + result.tmpBase = rope("T" & $hashOwner(module) & "_") initLinkedList(result.headerFiles) result.declaredThings = initIntSet() result.declaredProtos = initIntSet() @@ -1100,8 +1101,8 @@ proc rawNewModule(module: PSym, filename: string): BModule = initNodeTable(result.dataCache) result.typeStack = @[] result.forwardedProcs = @[] - result.typeNodesName = getTempName() - result.nimTypesName = getTempName() + result.typeNodesName = getTempName(result) + result.nimTypesName = getTempName(result) # no line tracing for the init sections of the system module so that we # don't generate a TFrame which can confuse the stack botton initialization: if sfSystemModule in module.flags: @@ -1126,8 +1127,8 @@ proc resetModule*(m: BModule) = initNodeTable(m.dataCache) m.typeStack = @[] m.forwardedProcs = @[] - m.typeNodesName = getTempName() - m.nimTypesName = getTempName() + m.typeNodesName = getTempName(m) + m.nimTypesName = getTempName(m) if sfSystemModule in m.module.flags: incl m.flags, preventStackTrace else: |