GC: get rid of pathological behaviour for stack marking

This commit is contained in:
Araq 2015-03-08 13:05:44 +01:00
commit c40aac8e20
5 changed files with 326 additions and 323 deletions

View file

@ -2021,7 +2021,7 @@ proc `$`*[T: tuple|object](x: T): string =
result = "("
var firstElement = true
for name, value in fieldPairs(x):
if not(firstElement): result.add(", ")
if not firstElement: result.add(", ")
result.add(name)
result.add(": ")
result.add($value)

View file

@ -1,7 +1,7 @@
#
#
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
# (c) Copyright 2015 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
@ -1050,7 +1050,11 @@ when useMarkForDebug or useBackupGc:
markGlobals(gch)
proc collectCT(gch: var TGcHeap) =
if (gch.zct.len >= ZctThreshold or (cycleGC and
# stackMarkCosts prevents some pathological behaviour: Stack marking
# becomes more expensive with large stacks and large stacks mean that
# cells with RC=0 are more likely to be kept alive by the stack.
let stackMarkCosts = max(stackSize() div (16*sizeof(int)), ZctThreshold)
if (gch.zct.len >= stackMarkCosts or (cycleGC and
getOccupiedMem(gch.region)>=gch.cycleThreshold) or alwaysGC) and
gch.recGcLock == 0:
when useMarkForDebug:

View file

@ -53,7 +53,6 @@ Bugs
- VM: Pegs do not work at compile-time
- VM: ptr/ref T cannot work in general
- scopes are still broken for generic instantiation!
- compilation of niminst takes way too long. looks like a regression
- blocks can "export" an identifier but the CCG generates {} for them ...