summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-01-14 04:00:06 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-01-14 04:00:06 +0100
commit823fbd4e40fa19aca1eab1a425f668463d654f3c (patch)
tree9ba118d6a4f1f97c4cca5e982d22757e6cd2fffc /compiler
parent9753782f96bcd9b35a4c45d6cb20de2a85c33e55 (diff)
downloadNim-823fbd4e40fa19aca1eab1a425f668463d654f3c.tar.gz
default GC can do a sort of heap dump via -d:nimTypeNames and dumpNumberOfInstances()
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgtypes.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index 20e6342c3..8a11f954f 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -880,10 +880,13 @@ proc genTypeInfoAuxBase(m: BModule; typ, origType: PType; name, base: Rope) =
   #else MessageOut("can contain a cycle: " & typeToString(typ))
   if flags != 0:
     addf(m.s[cfsTypeInit3], "$1.flags = $2;$n", [name, rope(flags)])
+  discard cgsym(m, "TNimType")
   if isDefined("nimTypeNames"):
     addf(m.s[cfsTypeInit3], "$1.name = $2;$n",
         [name, makeCstring typeToString(origType, preferName)])
-  discard cgsym(m, "TNimType")
+    discard cgsym(m, "nimTypeRoot")
+    addf(m.s[cfsTypeInit3], "$1.nextType = nimTypeRoot; nimTypeRoot=&$1;$n",
+         [name])
   addf(m.s[cfsVars], "TNimType $1;$n", [name])
 
 proc genTypeInfoAux(m: BModule, typ, origType: PType, name: Rope) =