--newruntime: progress

This commit is contained in:
Andreas Rumpf 2019-03-14 19:53:14 +01:00
commit e263702688
15 changed files with 111 additions and 109 deletions

View file

@ -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)

View file

@ -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}

View file

@ -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)

View file

@ -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()

View file

@ -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"

View file

@ -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