bugfix: --gc:none -d:useMalloc works again

This commit is contained in:
Araq 2013-09-06 00:25:48 +02:00
commit 827dc054fb
2 changed files with 55 additions and 54 deletions

View file

@ -27,8 +27,6 @@ else:
proc writeToStdErr(msg: CString) = proc writeToStdErr(msg: CString) =
discard MessageBoxA(0, msg, nil, 0) discard MessageBoxA(0, msg, nil, 0)
proc registerSignalHandler()
proc chckIndx(i, a, b: int): int {.inline, compilerproc.} proc chckIndx(i, a, b: int): int {.inline, compilerproc.}
proc chckRange(i, a, b: int): int {.inline, compilerproc.} proc chckRange(i, a, b: int): int {.inline, compilerproc.}
proc chckRangeF(x, a, b: float): float {.inline, compilerproc.} proc chckRangeF(x, a, b: float): float {.inline, compilerproc.}
@ -278,6 +276,7 @@ when defined(endb):
var var
dbgAborting: bool # whether the debugger wants to abort dbgAborting: bool # whether the debugger wants to abort
when not defined(noSignalHandler):
proc signalHandler(sig: cint) {.exportc: "signalHandler", noconv.} = proc signalHandler(sig: cint) {.exportc: "signalHandler", noconv.} =
template processSignal(s, action: expr) {.immediate.} = template processSignal(s, action: expr) {.immediate.} =
if s == SIGINT: action("SIGINT: Interrupted by Ctrl-C.\n") if s == SIGINT: action("SIGINT: Interrupted by Ctrl-C.\n")
@ -317,7 +316,6 @@ proc registerSignalHandler() =
c_signal(SIGILL, signalHandler) c_signal(SIGILL, signalHandler)
c_signal(SIGBUS, signalHandler) c_signal(SIGBUS, signalHandler)
when not defined(noSignalHandler):
registerSignalHandler() # call it in initialization section registerSignalHandler() # call it in initialization section
proc setControlCHook(hook: proc () {.noconv.}) = proc setControlCHook(hook: proc () {.noconv.}) =

View file

@ -117,6 +117,7 @@ proc reprSet(p: pointer, typ: PNimType): string {.compilerRtl.} =
type type
TReprClosure {.final.} = object # we cannot use a global variable here TReprClosure {.final.} = object # we cannot use a global variable here
# as this wouldn't be thread-safe # as this wouldn't be thread-safe
when defined(TCellSet):
marked: TCellSet marked: TCellSet
recdepth: int # do not recurse endlessly recdepth: int # do not recurse endlessly
indent: int # indentation indent: int # indentation
@ -127,12 +128,13 @@ when not defined(useNimRtl):
# have to do it here ... # have to do it here ...
when hasThreadSupport and hasSharedHeap and defined(heapLock): when hasThreadSupport and hasSharedHeap and defined(heapLock):
AcquireSys(HeapLock) AcquireSys(HeapLock)
when defined(TCellSet):
Init(cl.marked) Init(cl.marked)
cl.recdepth = -1 # default is to display everything! cl.recdepth = -1 # default is to display everything!
cl.indent = 0 cl.indent = 0
proc deinitReprClosure(cl: var TReprClosure) = proc deinitReprClosure(cl: var TReprClosure) =
Deinit(cl.marked) when defined(TCellSet): Deinit(cl.marked)
when hasThreadSupport and hasSharedHeap and defined(heapLock): when hasThreadSupport and hasSharedHeap and defined(heapLock):
ReleaseSys(HeapLock) ReleaseSys(HeapLock)
@ -195,6 +197,7 @@ when not defined(useNimRtl):
proc reprRef(result: var string, p: pointer, typ: PNimType, proc reprRef(result: var string, p: pointer, typ: PNimType,
cl: var TReprClosure) = cl: var TReprClosure) =
# we know that p is not nil here: # we know that p is not nil here:
when defined(TCellSet):
when defined(boehmGC) or defined(nogc): when defined(boehmGC) or defined(nogc):
var cell = cast[PCell](p) var cell = cast[PCell](p)
else: else: