summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-03-14 19:53:14 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-14 19:53:27 +0100
commite26370268885718c6b48a9fa5e940fdc8b4df090 (patch)
treef5d3882b85c3a1049aa55338d70ce7a213ee8ce9 /lib/system
parentf1a945b05f307178c86f8948c33358b48905dac4 (diff)
downloadNim-e26370268885718c6b48a9fa5e940fdc8b4df090.tar.gz
--newruntime: progress
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/alloc.nim4
-rw-r--r--lib/system/ansi_c.nim7
-rw-r--r--lib/system/excpt.nim7
-rw-r--r--lib/system/gc_common.nim1
-rw-r--r--lib/system/mmdisp.nim3
-rw-r--r--lib/system/threads.nim2
6 files changed, 9 insertions, 15 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim
index e938dc475..d4c686869 100644
--- a/lib/system/alloc.nim
+++ b/lib/system/alloc.nim
@@ -224,10 +224,6 @@ proc addChunkToMatrix(a: var MemRegion; b: PBigChunk) =
   setBit(sl, a.slBitmap[fl])
   setBit(fl, a.flBitmap)
 
-{.push stack_trace: off.}
-proc initAllocator() = discard "nothing to do anymore"
-{.pop.}
-
 proc incCurrMem(a: var MemRegion, bytes: int) {.inline.} =
   inc(a.currMem, bytes)
 
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim
index 552962775..47d30886c 100644
--- a/lib/system/ansi_c.nim
+++ b/lib/system/ansi_c.nim
@@ -139,4 +139,11 @@ proc c_free(p: pointer) {.
 proc c_realloc(p: pointer, newsize: csize): pointer {.
   importc: "realloc", header: "<stdlib.h>".}
 
+proc c_fwrite(buf: pointer, size, n: csize, f: CFilePtr): cint {.
+  importc: "fwrite", header: "<stdio.h>".}
+
+proc rawWrite(f: CFilePtr, s: cstring) {.compilerproc, nonreloadable, inline.} =
+  # we cannot throw an exception here!
+  discard c_fwrite(s, 1, s.len, f)
+
 {.pop}
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 551e54fae..8849caee5 100644
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -17,13 +17,6 @@ var
     ## instead of `stdmsg.write` when printing stacktrace.
     ## Unstable API.
 
-proc c_fwrite(buf: pointer, size, n: csize, f: CFilePtr): cint {.
-  importc: "fwrite", header: "<stdio.h>".}
-
-proc rawWrite(f: CFilePtr, s: cstring) {.compilerproc, nonreloadable, hcrInline.} =
-  # we cannot throw an exception here!
-  discard c_fwrite(s, 1, s.len, f)
-
 when not defined(windows) or not defined(guiapp):
   proc writeToStdErr(msg: cstring) = rawWrite(cstderr, msg)
 
diff --git a/lib/system/gc_common.nim b/lib/system/gc_common.nim
index 91c0244ea..b86ef84f0 100644
--- a/lib/system/gc_common.nim
+++ b/lib/system/gc_common.nim
@@ -167,7 +167,6 @@ when declared(threadType):
     ## This function is available only when ``--threads:on`` and ``--tlsEmulation:off``
     ## switches are used
     if threadType == ThreadType.None:
-      initAllocator()
       var stackTop {.volatile.}: pointer
       nimGC_setStackBottom(addr(stackTop))
       initGC()
diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim
index a2cddc472..905fdcc94 100644
--- a/lib/system/mmdisp.nim
+++ b/lib/system/mmdisp.nim
@@ -497,7 +497,8 @@ else:
     # XXX due to bootstrapping reasons, we cannot use  compileOption("gc", "stack") here
     include "system/gc_regions"
   elif defined(nimV2):
-    include "core/runtime_v2"
+    var allocator {.rtlThreadVar.}: MemRegion
+    instantiateForRegion(allocator)
   elif defined(gcMarkAndSweep) or defined(gcDestructors):
     # XXX use 'compileOption' here
     include "system/gc_ms"
diff --git a/lib/system/threads.nim b/lib/system/threads.nim
index 7a988db46..ec22a2b12 100644
--- a/lib/system/threads.nim
+++ b/lib/system/threads.nim
@@ -456,8 +456,6 @@ template threadProcWrapperBody(closure: untyped): untyped =
   var thrd = cast[ptr Thread[TArg]](closure)
   var core = thrd.core
   when declared(globalsSlot): threadVarSetValue(globalsSlot, thrd.core)
-  when declared(initAllocator):
-    initAllocator()
   threadProcWrapStackFrame(thrd)
   # Since an unhandled exception terminates the whole process (!), there is
   # no need for a ``try finally`` here, nor would it be correct: The current
54b2d4e78212cd12'>^
0535f63 ^
f3158b3 ^

















13a6a3f ^
f3158b3 ^

13a6a3f ^
f3158b3 ^













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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136