GC: get rid of pathological behaviour for stack marking
This commit is contained in:
parent
e390d8ec4a
commit
c40aac8e20
5 changed files with 326 additions and 323 deletions
|
|
@ -2021,7 +2021,7 @@ proc `$`*[T: tuple|object](x: T): string =
|
||||||
result = "("
|
result = "("
|
||||||
var firstElement = true
|
var firstElement = true
|
||||||
for name, value in fieldPairs(x):
|
for name, value in fieldPairs(x):
|
||||||
if not(firstElement): result.add(", ")
|
if not firstElement: result.add(", ")
|
||||||
result.add(name)
|
result.add(name)
|
||||||
result.add(": ")
|
result.add(": ")
|
||||||
result.add($value)
|
result.add($value)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nim's Runtime Library
|
# Nim's Runtime Library
|
||||||
# (c) Copyright 2013 Andreas Rumpf
|
# (c) Copyright 2015 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -1050,7 +1050,11 @@ when useMarkForDebug or useBackupGc:
|
||||||
markGlobals(gch)
|
markGlobals(gch)
|
||||||
|
|
||||||
proc collectCT(gch: var TGcHeap) =
|
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
|
getOccupiedMem(gch.region)>=gch.cycleThreshold) or alwaysGC) and
|
||||||
gch.recGcLock == 0:
|
gch.recGcLock == 0:
|
||||||
when useMarkForDebug:
|
when useMarkForDebug:
|
||||||
|
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -53,7 +53,6 @@ Bugs
|
||||||
- VM: Pegs do not work at compile-time
|
- VM: Pegs do not work at compile-time
|
||||||
- VM: ptr/ref T cannot work in general
|
- VM: ptr/ref T cannot work in general
|
||||||
- scopes are still broken for generic instantiation!
|
- 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 ...
|
- blocks can "export" an identifier but the CCG generates {} for them ...
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue