summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-12-02 11:44:28 +0100
committerAraq <rumpf_a@web.de>2016-12-02 11:44:28 +0100
commit42ae2064dd16033c8f8cf26a12df0e1d9b17312b (patch)
tree3155b6c9313a6ea7cda78939af423f8aa1644738 /compiler
parentd2cbf7f242fd9f277875d182943d0cb241c95861 (diff)
downloadNim-42ae2064dd16033c8f8cf26a12df0e1d9b17312b.tar.gz
more tests work
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgtypes.nim7
-rw-r--r--compiler/cgen.nim1
-rw-r--r--compiler/cgendata.nim1
-rw-r--r--compiler/pragmas.nim5
-rw-r--r--compiler/sighashes.nim2
5 files changed, 13 insertions, 3 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index cf1a96bf2..2ef494b26 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -43,7 +43,12 @@ proc idOrSig(m: BModule; s: PSym): Rope =
     # signatures for exported routines are reliable enough to
     # produce a unique name and this means produced C++ is more stable wrt
     # Nim changes:
-    result = rope($hashProc(s))
+    let sig = hashProc(s)
+    result = rope($sig)
+    let counter = m.sigConflicts.getOrDefault(sig)
+    if counter != 0:
+      result.add "_" & rope counter
+    m.sigConflicts.inc(sig)
   else:
     result = "_" & rope s.id
 
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 259bfc9c7..7033c89c4 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -1099,6 +1099,7 @@ proc rawNewModule(module: PSym, filename: string): BModule =
   result.forwTypeCache = initTable[SigHash, Rope]()
   result.module = module
   result.typeInfoMarker = initTable[SigHash, Rope]()
+  result.sigConflicts = initCountTable[SigHash]()
   result.initProc = newProc(nil, result)
   result.initProc.options = initProcOptions(result)
   result.preInitProc = newPreInitProc(result)
diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim
index 230ab7b48..8063315c8 100644
--- a/compiler/cgendata.nim
+++ b/compiler/cgendata.nim
@@ -130,6 +130,7 @@ type
     extensionLoaders*: array['0'..'9', Rope] # special procs for the
                                               # OpenGL wrapper
     injectStmt*: Rope
+    sigConflicts*: CountTable[SigHash]
 
 var
   mainModProcs*, mainModInit*, otherModsInit*, mainDatInit*: Rope
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index ffb2aa812..6697abe5e 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -557,7 +557,10 @@ proc typeBorrow(sym: PSym, n: PNode) =
   incl(sym.typ.flags, tfBorrowDot)
 
 proc markCompilerProc(s: PSym) =
-  makeExternExport(s, "$1", s.info)
+  # minor hack ahead: FlowVar is the only generic .compilerProc type which
+  # should not have an external name set:
+  if s.kind != skType or s.name.s != "FlowVar":
+    makeExternExport(s, "$1", s.info)
   incl(s.flags, sfCompilerProc)
   incl(s.flags, sfUsed)
   registerCompilerProc(s)
diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim
index c0776801f..1774197e9 100644
--- a/compiler/sighashes.nim
+++ b/compiler/sighashes.nim
@@ -250,7 +250,7 @@ proc hashProc*(s: PSym): SigHash =
   # so that createThread[void]() (aka generic specialization) gets a unique
   # hash, we also hash the line information. This is pretty bad, but the best
   # solution for now:
-  c &= s.info.line
+  #c &= s.info.line
   md5Final c, result.Md5Digest
 
 proc hashOwner*(s: PSym): SigHash =