summary refs log tree commit diff stats
path: root/lib/system/gc2.nim
diff options
context:
space:
mode:
authorYuriy Glukhov <yuriy.glukhov@gmail.com>2016-10-05 20:36:22 +0300
committerYuriy Glukhov <yuriy.glukhov@gmail.com>2016-10-05 20:36:22 +0300
commit1bfcea5d5c3f45fb467fdc9d69f644872b3e82f9 (patch)
tree14fd4d35388cb5a148fac1465c3931860c959594 /lib/system/gc2.nim
parent989f7949275808b102da54f3f4e399dbf8d83cfc (diff)
downloadNim-1bfcea5d5c3f45fb467fdc9d69f644872b3e82f9.tar.gz
Make gc v2 compile with --threads:on
Diffstat (limited to 'lib/system/gc2.nim')
-rw-r--r--lib/system/gc2.nim12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/system/gc2.nim b/lib/system/gc2.nim
index 089c9c915..ce2bfc2ae 100644
--- a/lib/system/gc2.nim
+++ b/lib/system/gc2.nim
@@ -33,6 +33,9 @@ when withRealTime and not declared(getTicks):
 when defined(memProfiler):
   proc nimProfile(requestedSize: int) {.benign.}
 
+when hasThreadSupport:
+  include sharedlist
+
 type
   ObjectSpaceIter = object
     state: range[-1..0]
@@ -96,7 +99,7 @@ type
     stat: GcStat
     additionalRoots: CellSeq # dummy roots for GC_ref/unref
     spaceIter: ObjectSpaceIter
-    dumpHeapFile: File # File that is used for GC_dumpHeap
+    pDumpHeapFile: pointer # File that is used for GC_dumpHeap
     when hasThreadSupport:
       toDispose: SharedList[pointer]
 
@@ -612,6 +615,9 @@ template checkTime {.dirty.} =
 
 # ---------------- dump heap ----------------
 
+template dumpHeapFile(gch: var GcHeap): File =
+  cast[File](gch.pDumpHeapFile)
+
 proc debugGraph(s: PCell) =
   c_fprintf(gch.dumpHeapFile, "child %p\n", s)
 
@@ -625,7 +631,7 @@ proc GC_dumpHeap*(file: File) =
   ## Dumps the GCed heap's content to a file. Can be useful for
   ## debugging. Produces an undocumented text file format that
   ## can be translated into "dot" syntax via the "heapdump2dot" tool.
-  gch.dumpHeapFile = file
+  gch.pDumpHeapFile = file
   var spaceIter: ObjectSpaceIter
   var d = gch.decStack.d
   for i in 0 .. < gch.decStack.len:
@@ -643,7 +649,7 @@ proc GC_dumpHeap*(file: File) =
       writeCell(file, "cell ", c)
       forAllChildren(c, waDebug)
       c_fprintf(file, "end\n")
-  gch.dumpHeapFile = nil
+  gch.pDumpHeapFile = nil
 
 proc GC_dumpHeap() =
   var f: File
href='/ahoang/Nim/commit/readme.md?h=devel&id=57dc4ca22b97864e074fa2884a9e2df9bfb31737'>57dc4ca22 ^
a16e6bd22 ^





a16e6bd22 ^



bc9749310 ^
ce94d1340 ^
830e0c000 ^
bc9749310 ^




a16e6bd22 ^

49d810f34 ^


a16e6bd22 ^
bc9749310 ^


a16e6bd22 ^
49d810f34 ^









a16e6bd22 ^
3ea644690 ^
45f9c5b94 ^
3ea644690 ^


a16e6bd22 ^

57dc4ca22 ^


1c9b4e5d3 ^
a16e6bd22 ^


5b32e31a2 ^
da825a0fe ^
168d0fe94 ^

52d3a8239 ^

dc854f348 ^

c6d653f30 ^


52d3a8239 ^
c6d653f30 ^
52d3a8239 ^
c6d653f30 ^
52d3a8239 ^
c6d653f30 ^
52d3a8239 ^
c6d653f30 ^
52d3a8239 ^
c6d653f30 ^
52d3a8239 ^

c6d653f30 ^
52d3a8239 ^
c6d653f30 ^
52d3a8239 ^

c6d653f30 ^
52d3a8239 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107