diff options
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/alloc.nim | 4 | ||||
-rw-r--r-- | lib/system/ansi_c.nim | 7 | ||||
-rw-r--r-- | lib/system/excpt.nim | 7 | ||||
-rw-r--r-- | lib/system/gc_common.nim | 1 | ||||
-rw-r--r-- | lib/system/mmdisp.nim | 3 | ||||
-rw-r--r-- | lib/system/threads.nim | 2 |
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 |