clean up a few stray c_stdout's in gc debug code

This commit is contained in:
Jacek Sieka 2016-07-31 08:34:42 +08:00
commit b3846124e6
5 changed files with 20 additions and 19 deletions

View file

@ -189,7 +189,7 @@ proc writeCell(file: File; msg: cstring, c: PCell) =
msg, id, kind, c.refcount shr rcShift, col)
proc writeCell(msg: cstring, c: PCell) =
c_stdout.writeCell(msg, c)
stdout.writeCell(msg, c)
proc myastToStr[T](x: T): string {.magic: "AstToStr", noSideEffect.}
@ -263,7 +263,7 @@ proc nimGCunref(p: pointer) {.compilerProc.} =
template markGrey(x: PCell) =
if x.color != 1-gch.black and gch.phase == Phase.Marking:
if not isAllocatedPtr(gch.region, x):
c_fprintf(c_stdout, "[GC] markGrey proc: %p\n", x)
c_fprintf(stdout, "[GC] markGrey proc: %p\n", x)
#GC_dumpHeap()
sysAssert(false, "wtf")
x.setColor(rcGrey)
@ -679,7 +679,7 @@ proc sweep(gch: var GcHeap): bool =
takeStartTime(100)
#echo "loop start"
let white = 1-gch.black
#cfprintf(cstdout, "black is %d\n", black)
#c_fprintf(stdout, "black is %d\n", black)
while true:
let x = allObjectsAsProc(gch.region, addr gch.spaceIter)
if gch.spaceIter.state < 0: break
@ -719,7 +719,7 @@ proc markIncremental(gch: var GcHeap): bool =
while L[] > 0:
var c = gch.greyStack.d[0]
if not isAllocatedPtr(gch.region, c):
c_fprintf(c_stdout, "[GC] not allocated anymore: %p\n", c)
c_fprintf(stdout, "[GC] not allocated anymore: %p\n", c)
#GC_dumpHeap()
sysAssert(false, "wtf")
@ -764,7 +764,7 @@ proc doOperation(p: pointer, op: WalkOp) =
case op
of waZctDecRef:
#if not isAllocatedPtr(gch.region, c):
# c_fprintf(c_stdout, "[GC] decref bug: %p", c)
# c_fprintf(stdout, "[GC] decref bug: %p", c)
gcAssert(isAllocatedPtr(gch.region, c), "decRef: waZctDecRef")
gcAssert(c.refcount >=% rcIncrement, "doOperation 2")
#c.refcount = c.refcount -% rcIncrement
@ -783,14 +783,14 @@ proc doOperation(p: pointer, op: WalkOp) =
else:
#gcAssert(isAllocatedPtr(gch.region, c), "doOperation: waMarkGlobal")
if not isAllocatedPtr(gch.region, c):
c_fprintf(c_stdout, "[GC] not allocated anymore: MarkGlobal %p\n", c)
c_fprintf(stdout, "[GC] not allocated anymore: MarkGlobal %p\n", c)
#GC_dumpHeap()
sysAssert(false, "wtf")
handleRoot()
discard allocInv(gch.region)
of waMarkGrey:
if not isAllocatedPtr(gch.region, c):
c_fprintf(c_stdout, "[GC] not allocated anymore: MarkGrey %p\n", c)
c_fprintf(stdout, "[GC] not allocated anymore: MarkGrey %p\n", c)
#GC_dumpHeap()
sysAssert(false, "wtf")
if c.color == 1-gch.black:
@ -816,7 +816,7 @@ proc collectCycles(gch: var GcHeap): bool =
gch.phase = Phase.Marking
markGlobals(gch)
cfprintf(stdout, "collectCycles: introduced bug E %ld\n", gch.phase)
c_fprintf(stdout, "collectCycles: introduced bug E %ld\n", gch.phase)
discard allocInv(gch.region)
of Phase.Marking:
# since locals do not have a write barrier, we need
@ -930,7 +930,7 @@ proc collectCTBody(gch: var GcHeap) =
gch.stat.maxPause = max(gch.stat.maxPause, duration)
when defined(reportMissedDeadlines):
if gch.maxPause > 0 and duration > gch.maxPause:
c_fprintf(c_stdout, "[GC] missed deadline: %ld\n", duration)
c_fprintf(stdout, "[GC] missed deadline: %ld\n", duration)
when defined(nimCoroutines):
proc currentStackSizes(): int =